diff options
Diffstat (limited to 'src/cmd/5g')
-rw-r--r-- | src/cmd/5g/ggen.c | 32 | ||||
-rw-r--r-- | src/cmd/5g/gobj.c | 4 | ||||
-rw-r--r-- | src/cmd/5g/gsubr.c | 13 | ||||
-rw-r--r-- | src/cmd/5g/reg.c | 43 |
4 files changed, 68 insertions, 24 deletions
diff --git a/src/cmd/5g/ggen.c b/src/cmd/5g/ggen.c index 0bc1b38fc..d5b00b34d 100644 --- a/src/cmd/5g/ggen.c +++ b/src/cmd/5g/ggen.c @@ -22,6 +22,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.name == D_AUTO && p->from.node) + p->from.node->used++; + + if (p->to.name == 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.name == D_AUTO && p->from.node) + p->from.offset += p->from.node->stkdelta; + + if (p->to.name == D_AUTO && p->to.node) + p->to.offset += p->to.node->stkdelta; + } +} + /* * generate: * call f @@ -147,13 +173,13 @@ cgen_callinter(Node *n, Node *res, int proc) nodindreg(&nodsp, types[tptr], REGSP); nodsp.xoffset = 4; nodo.xoffset += widthptr; - cgen(&nodo, &nodsp); // 4(SP) = 8(REG) -- i.s + cgen(&nodo, &nodsp); // 4(SP) = 4(REG) -- i.data nodo.xoffset -= widthptr; - cgen(&nodo, &nodr); // REG = 0(REG) -- i.m + cgen(&nodo, &nodr); // REG = 0(REG) -- i.tab 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; diff --git a/src/cmd/5g/gobj.c b/src/cmd/5g/gobj.c index acece6c0d..27c8be67d 100644 --- a/src/cmd/5g/gobj.c +++ b/src/cmd/5g/gobj.c @@ -182,6 +182,8 @@ dumpfuncs(void) // fix up pc pcloc = 0; for(pl=plist; pl!=nil; pl=pl->link) { + if(isblank(pl->name)) + continue; for(p=pl->firstpc; p!=P; p=p->link) { p->loc = pcloc; if(p->as != ADATA && p->as != AGLOBL) @@ -191,6 +193,8 @@ dumpfuncs(void) // put out functions for(pl=plist; pl!=nil; pl=pl->link) { + if(isblank(pl->name)) + continue; if(debug['S']) { s = S; diff --git a/src/cmd/5g/gsubr.c b/src/cmd/5g/gsubr.c index caaa3e246..2d9218461 100644 --- a/src/cmd/5g/gsubr.c +++ b/src/cmd/5g/gsubr.c @@ -102,6 +102,19 @@ patch(Prog *p, Prog *to) p->to.offset = to->loc; } +Prog* +unpatch(Prog *p) +{ + Prog *q; + + if(p->to.type != D_BRANCH) + fatal("unpatch: not a branch"); + q = p->to.branch; + p->to.branch = P; + p->to.offset = 0; + return q; +} + /* * start a new Prog list. */ diff --git a/src/cmd/5g/reg.c b/src/cmd/5g/reg.c index 5fba02c9e..77d0a87eb 100644 --- a/src/cmd/5g/reg.c +++ b/src/cmd/5g/reg.c @@ -1525,6 +1525,7 @@ noreturn(Prog *p) symlist[1] = pkglookup("panicslice", runtimepkg); symlist[2] = pkglookup("throwinit", runtimepkg); symlist[3] = pkglookup("panic", runtimepkg); + symlist[4] = pkglookup("panicwrap", runtimepkg); } s = p->to.sym; @@ -1555,27 +1556,27 @@ dumpone(Reg *r) r->regdiff.b[z] | r->act.b[z] | 0; -// if(bany(&bit)) { -// print("\t"); -// if(bany(&r->set)) -// print(" s:%Q", r->set); -// if(bany(&r->use1)) -// print(" u1:%Q", r->use1); -// if(bany(&r->use2)) -// print(" u2:%Q", r->use2); -// if(bany(&r->refbehind)) -// print(" rb:%Q ", r->refbehind); -// if(bany(&r->refahead)) -// print(" ra:%Q ", r->refahead); -// if(bany(&r->calbehind)) -// print("cb:%Q ", r->calbehind); -// if(bany(&r->calahead)) -// print(" ca:%Q ", r->calahead); -// if(bany(&r->regdiff)) -// print(" d:%Q ", r->regdiff); -// if(bany(&r->act)) -// print(" a:%Q ", r->act); -// } + if(bany(&bit)) { + print("\t"); + if(bany(&r->set)) + print(" s:%Q", r->set); + if(bany(&r->use1)) + print(" u1:%Q", r->use1); + if(bany(&r->use2)) + print(" u2:%Q", r->use2); + if(bany(&r->refbehind)) + print(" rb:%Q ", r->refbehind); + if(bany(&r->refahead)) + print(" ra:%Q ", r->refahead); + if(bany(&r->calbehind)) + print("cb:%Q ", r->calbehind); + if(bany(&r->calahead)) + print(" ca:%Q ", r->calahead); + if(bany(&r->regdiff)) + print(" d:%Q ", r->regdiff); + if(bany(&r->act)) + print(" a:%Q ", r->act); + } print("\n"); } |