void data(void) { gflag = debug['g']; debug['g'] = 0; if(estrdat == nil) { strdat = mal(sizeof(*pc)); clearp(strdat); estrdat = strdat; } if(savepc) fatal("data phase error"); savepc = pc; pc = estrdat; }
/* * add mov b,rn * just after r */ void addmove(Reg *r, int bn, int rn, int f) { Prog *p, *p1; Adr *a; Var *v; p1 = mal(sizeof(*p1)); clearp(p1); p1->pc = 9999; p = r->f.prog; p1->link = p->link; p->link = p1; p1->lineno = p->lineno; v = var + bn; a = &p1->to; a->offset = v->offset; a->etype = v->etype; a->type = v->name; a->node = v->node; a->sym = linksym(v->node->sym); // need to clean this up with wptr and // some of the defaults p1->as = AMOVL; switch(v->etype) { default: fatal("unknown type %E", v->etype); case TINT8: case TUINT8: case TBOOL: p1->as = AMOVB; break; case TINT16: case TUINT16: p1->as = AMOVW; break; case TINT64: case TUINT64: case TUINTPTR: case TPTR64: p1->as = AMOVQ; break; case TFLOAT32: p1->as = AMOVSS; break; case TFLOAT64: p1->as = AMOVSD; break; case TINT: case TUINT: case TINT32: case TUINT32: case TPTR32: break; } p1->from.type = rn; if(!f) { p1->from = *a; *a = zprog.from; a->type = rn; if(v->etype == TUINT8) p1->as = AMOVB; if(v->etype == TUINT16) p1->as = AMOVW; } if(debug['R'] && debug['v']) print("%P ===add=== %P\n", p, p1); ostats.nspill++; }