reg[i] = 1;
for(i=D_AX; i<=D_R15; i++)
reg[i] = 0;
- for(i=D_X0; i<=D_X7; i++)
+ for(i=D_X0; i<=D_X15; i++)
reg[i] = 0;
for(i=0; i<nelem(resvd); i++)
for(i=D_AX; i<=D_R15; i++)
if(reg[i])
yyerror("reg %R left allocated\n", i);
- for(i=D_X0; i<=D_X7; i++)
+ for(i=D_X0; i<=D_X15; i++)
if(reg[i])
yyerror("reg %R left allocated\n", i);
}
case TFLOAT64:
if(o != N && o->op == OREGISTER) {
i = o->val.u.reg;
- if(i >= D_X0 && i <= D_X7)
+ if(i >= D_X0 && i <= D_X15)
goto out;
}
- for(i=D_X0; i<=D_X7; i++)
+ for(i=D_X0; i<=D_X15; i++)
if(reg[i] == 0)
goto out;
fatal("out of floating registers");
Reg *r;
int t;
+ if(debug['P'] && debug['v'])
+ print("subprop %P\n", r0->prog);
p = r0->prog;
v1 = &p->from;
- if(!regtyp(v1))
+ if(!regtyp(v1)) {
+ if(debug['P'] && debug['v'])
+ print("\tnot regtype %D; return 0\n", v1);
return 0;
+ }
v2 = &p->to;
- if(!regtyp(v2))
+ if(!regtyp(v2)) {
+ if(debug['P'] && debug['v'])
+ print("\tnot regtype %D; return 0\n", v2);
return 0;
+ }
for(r=uniqp(r0); r!=R; r=uniqp(r)) {
- if(uniqs(r) == R)
+ if(debug['P'] && debug['v'])
+ print("\t? %P\n", r->prog);
+ if(uniqs(r) == R) {
+ if(debug['P'] && debug['v'])
+ print("\tno unique successor\n");
break;
+ }
p = r->prog;
switch(p->as) {
case ACALL:
+ if(debug['P'] && debug['v'])
+ print("\tfound %P; return 0\n", p);
return 0;
case AIMULL:
case AMOVSB:
case AMOVSL:
case AMOVSQ:
+ if(debug['P'] && debug['v'])
+ print("\tfound %P; return 0\n", p);
return 0;
case AMOVL:
case AMOVQ:
+ case AMOVSS:
+ case AMOVSD:
if(p->to.type == v1->type)
goto gotit;
break;
}
if(copyau(&p->from, v2) ||
- copyau(&p->to, v2))
+ copyau(&p->to, v2)) {
+ if(debug['P'] && debug['v'])
+ print("\tcopyau %D failed\n", v2);
break;
+ }
if(copysub(&p->from, v1, v2, 0) ||
- copysub(&p->to, v1, v2, 0))
+ copysub(&p->to, v1, v2, 0)) {
+ if(debug['P'] && debug['v'])
+ print("\tcopysub failed\n");
break;
+ }
}
+ if(debug['P'] && debug['v'])
+ print("\tran off end; return 0\n", p);
return 0;
gotit:
Adr *v1, *v2;
Reg *r;
+ if(debug['P'] && debug['v'])
+ print("copyprop %P\n", r0->prog);
p = r0->prog;
v1 = &p->from;
v2 = &p->to;
copyau(Adr *a, Adr *v)
{
- if(copyas(a, v))
+ if(copyas(a, v)) {
+ if(debug['P'] && debug['v'])
+ print("\tcopyau: copyas returned 1\n");
return 1;
+ }
if(regtyp(v)) {
- if(a->type-D_INDIR == v->type)
+ if(a->type-D_INDIR == v->type) {
+ if(debug['P'] && debug['v'])
+ print("\tcopyau: found indir use - return 1\n");
return 1;
- if(a->index == v->type)
+ }
+ if(a->index == v->type) {
+ if(debug['P'] && debug['v'])
+ print("\tcopyau: found index use - return 1\n");
return 1;
+ }
}
return 0;
}