cgen_asop sudoaddable

R=rsc
APPROVED=rsc
DELTA=14  (4 added, 0 deleted, 10 changed)
OCL=35190
CL=35210
This commit is contained in:
Kai Backman 2009-10-01 06:50:59 -07:00
parent a1b4796394
commit 8fd53f4754
2 changed files with 62 additions and 22 deletions

View File

@ -111,7 +111,7 @@ void
ginscall(Node *f, int proc) ginscall(Node *f, int proc)
{ {
Prog *p; Prog *p;
// Node reg, con; Node n1, r, con;
switch(proc) { switch(proc) {
default: default:
@ -125,17 +125,53 @@ ginscall(Node *f, int proc)
case 1: // call in new proc (go) case 1: // call in new proc (go)
case 2: // defered call (defer) case 2: // defered call (defer)
fatal("ginscall new proc/defered not implemented"); regalloc(&r, types[tptr], N);
// nodreg(&reg, types[TINT64], D_AX); p = gins(AMOVW, N, &r);
// gins(APUSHQ, f, N); p->from.type = D_OREG;
// nodconst(&con, types[TINT32], argsize(f->type)); p->from.reg = REGSP;
// gins(APUSHQ, &con, N);
// if(proc == 1) p = gins(AMOVW, &r, N);
// ginscall(newproc, 0); p->to.type = D_OREG;
// else p->to.reg = REGSP;
// ginscall(deferproc, 0); p->to.offset = -8;
// gins(APOPQ, N, &reg); p->scond |= C_WBIT;
// gins(APOPQ, N, &reg);
memset(&n1, 0, sizeof n1);
n1.op = OADDR;
n1.left = f;
gins(AMOVW, &n1, &r);
p = gins(AMOVW, &r, N);
p->to.type = D_OREG;
p->to.reg = REGSP;
p->to.offset = 8;
nodconst(&con, types[TINT32], argsize(f->type));
gins(AMOVW, &con, &r);
p = gins(AMOVW, &r, N);
p->to.type = D_OREG;
p->to.reg = REGSP;
p->to.offset = 4;
regfree(&r);
if(proc == 1)
ginscall(newproc, 0);
else
ginscall(deferproc, 0);
regalloc(&r, types[tptr], N);
p = gins(AMOVW, N, &r);
p->from.type = D_OREG;
p->from.reg = REGSP;
p->from.offset = 0;
p = gins(AMOVW, &r, N);
p->to.type = D_OREG;
p->to.reg = REGSP;
p->to.offset = 8;
p->scond |= C_WBIT;
regfree(&r);
break; break;
} }
} }
@ -338,7 +374,7 @@ cgen_asop(Node *n)
{ {
Node n1, n2, n3, n4; Node n1, n2, n3, n4;
Node *nl, *nr; Node *nl, *nr;
// Prog *p1; Prog *p1;
Addr addr; Addr addr;
int a, w; int a, w;
@ -379,15 +415,18 @@ cgen_asop(Node *n)
} }
if(nr->ullman < UINF) if(nr->ullman < UINF)
if(sudoaddable(a, nl, &addr, &w)) { if(sudoaddable(a, nl, &addr, &w)) {
fatal("cgen_asop sudoaddable not implemented"); regalloc(&n2, nl->type, N);
// regalloc(&n2, nr->type, N); regalloc(&n3, nr->type, N);
// cgen(nr, &n2); p1 = gins(AMOVW, N, &n2);
// p1 = gins(a, &n2, N); p1->from = addr;
// p1->to = addr; cgen(nr, &n3);
// p1->reg = w; gins(a, &n3, &n2);
// regfree(&n2); p1 = gins(AMOVW, &n2, N);
// sudoclean(); p1->to = addr;
// goto ret; regfree(&n2);
regfree(&n3);
sudoclean();
goto ret;
} }
} }

View File

@ -192,6 +192,7 @@ func2.go
func3.go func3.go
func4.go func4.go
gc1.go gc1.go
hashmap.go
helloworld.go helloworld.go
if.go if.go
import1.go import1.go