summaryrefslogtreecommitdiff
path: root/src/cmd/8g/ggen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/8g/ggen.c')
-rw-r--r--src/cmd/8g/ggen.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/cmd/8g/ggen.c b/src/cmd/8g/ggen.c
index 25adb38c0..6db0474c9 100644
--- a/src/cmd/8g/ggen.c
+++ b/src/cmd/8g/ggen.c
@@ -20,6 +20,32 @@ defframe(Prog *ptxt)
maxstksize = 0;
}
+// Sweep the prog list to mark any used nodes.
+void
+markautoused(Prog* p)
+{
+ for (; p; p = p->link) {
+ if (p->from.type == D_AUTO && p->from.node)
+ p->from.node->used++;
+
+ if (p->to.type == D_AUTO && p->to.node)
+ p->to.node->used++;
+ }
+}
+
+// Fixup instructions after compactframe has moved all autos around.
+void
+fixautoused(Prog* p)
+{
+ for (; p; p = p->link) {
+ if (p->from.type == D_AUTO && p->from.node)
+ p->from.offset += p->from.node->stkdelta;
+
+ if (p->to.type == D_AUTO && p->to.node)
+ p->to.offset += p->to.node->stkdelta;
+ }
+}
+
void
clearfat(Node *nl)
{
@@ -141,15 +167,15 @@ cgen_callinter(Node *n, Node *res, int proc)
nodindreg(&nodsp, types[tptr], D_SP);
nodo.xoffset += widthptr;
- cgen(&nodo, &nodsp); // 0(SP) = 8(REG) -- i.s
+ cgen(&nodo, &nodsp); // 0(SP) = 4(REG) -- i.data
nodo.xoffset -= widthptr;
- cgen(&nodo, &nodr); // REG = 0(REG) -- i.m
+ cgen(&nodo, &nodr); // REG = 0(REG) -- i.tab
if(n->left->xoffset == BADWIDTH)
fatal("cgen_callinter: badwidth");
nodo.xoffset = n->left->xoffset + 3*widthptr + 8;
- cgen(&nodo, &nodr); // REG = 32+offset(REG) -- i.m->fun[f]
+ cgen(&nodo, &nodr); // REG = 20+offset(REG) -- i.tab->fun[f]
// BOTCH nodr.type = fntype;
nodr.type = n->left->type;