Commit 3537b793 authored by Ken Thompson's avatar Ken Thompson

arm bug address of a string

R=r
CC=golang-dev
https://golang.org/cl/4004042
parent 3965519a
...@@ -336,6 +336,7 @@ subprop(Reg *r0) ...@@ -336,6 +336,7 @@ subprop(Reg *r0)
case ACMN: case ACMN:
case AADD: case AADD:
case ASUB: case ASUB:
case ASBC:
case ARSB: case ARSB:
case ASLL: case ASLL:
case ASRL: case ASRL:
...@@ -621,8 +622,8 @@ shiftprop(Reg *r) ...@@ -621,8 +622,8 @@ shiftprop(Reg *r)
case AADC: case AADC:
case AORR: case AORR:
case ASUB: case ASUB:
case ARSB:
case ASBC: case ASBC:
case ARSB:
case ARSC: case ARSC:
if(p1->reg == n || (p1->reg == NREG && p1->to.type == D_REG && p1->to.reg == n)) { if(p1->reg == n || (p1->reg == NREG && p1->to.type == D_REG && p1->to.reg == n)) {
if(p1->from.type != D_REG) if(p1->from.type != D_REG)
...@@ -1006,6 +1007,7 @@ copyu(Prog *p, Adr *v, Adr *s) ...@@ -1006,6 +1007,7 @@ copyu(Prog *p, Adr *v, Adr *s)
case AADD: /* read, read, write */ case AADD: /* read, read, write */
case ASUB: case ASUB:
case ASBC:
case ARSB: case ARSB:
case ASLL: case ASLL:
case ASRL: case ASRL:
......
...@@ -253,8 +253,7 @@ regopt(Prog *firstp) ...@@ -253,8 +253,7 @@ regopt(Prog *firstp)
* funny * funny
*/ */
case ABL: case ABL:
for(z=0; z<BITS; z++) setaddrs(bit);
addrs.b[z] |= bit.b[z];
break; break;
} }
...@@ -272,6 +271,18 @@ regopt(Prog *firstp) ...@@ -272,6 +271,18 @@ regopt(Prog *firstp)
if(firstr == R) if(firstr == R)
return; return;
for(i=0; i<nvar; i++) {
Var *v = var+i;
if(v->addr) {
bit = blsh(i);
for(z=0; z<BITS; z++)
addrs.b[z] |= bit.b[z];
}
// print("bit=%2d addr=%d et=%-6E w=%-2d s=%S + %lld\n",
// i, v->addr, v->etype, v->width, v->sym, v->offset);
}
/* /*
* pass 2 * pass 2
* turn branch references to pointers * turn branch references to pointers
...@@ -637,6 +648,10 @@ mkvar(Reg *r, Adr *a, int docon) ...@@ -637,6 +648,10 @@ mkvar(Reg *r, Adr *a, int docon)
t = a->type; t = a->type;
n = D_NONE; n = D_NONE;
flag = 0;
// if(a->pun)
// flag = 1;
switch(t) { switch(t) {
default: default:
print("type %d %d %D\n", t, a->name, a); print("type %d %d %D\n", t, a->name, a);
...@@ -647,15 +662,19 @@ mkvar(Reg *r, Adr *a, int docon) ...@@ -647,15 +662,19 @@ mkvar(Reg *r, Adr *a, int docon)
case D_BRANCH: case D_BRANCH:
break; break;
case D_CONST:
flag = 1;
goto onereg;
case D_REGREG: case D_REGREG:
if(a->offset != NREG) if(a->offset != NREG)
r->regu |= RtoB(a->offset); r->regu |= RtoB(a->offset);
// fallthrough goto onereg;
case D_CONST:
case D_REG: case D_REG:
case D_SHIFT: case D_SHIFT:
case D_OREG: case D_OREG:
onereg:
if(a->reg != NREG) if(a->reg != NREG)
r->regu |= RtoB(a->reg); r->regu |= RtoB(a->reg);
break; break;
...@@ -678,10 +697,6 @@ mkvar(Reg *r, Adr *a, int docon) ...@@ -678,10 +697,6 @@ mkvar(Reg *r, Adr *a, int docon)
break; break;
} }
flag = 0;
// if(a->pun)
// flag = 1;
s = a->sym; s = a->sym;
if(s == S) if(s == S)
goto none; goto none;
...@@ -736,7 +751,6 @@ mkvar(Reg *r, Adr *a, int docon) ...@@ -736,7 +751,6 @@ mkvar(Reg *r, Adr *a, int docon)
if(debug['R']) if(debug['R'])
print("bit=%2d et=%E pun=%d %D\n", i, et, flag, a); print("bit=%2d et=%E pun=%d %D\n", i, et, flag, a);
out:
bit = blsh(i); bit = blsh(i);
if(n == D_EXTERN || n == D_STATIC) if(n == D_EXTERN || n == D_STATIC)
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
...@@ -744,8 +758,6 @@ out: ...@@ -744,8 +758,6 @@ out:
if(n == D_PARAM) if(n == D_PARAM)
for(z=0; z<BITS; z++) for(z=0; z<BITS; z++)
params.b[z] |= bit.b[z]; params.b[z] |= bit.b[z];
if(t == D_CONST)
setaddrs(bit);
return bit; return bit;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment