summaryrefslogtreecommitdiff
path: root/src/cmd/6c/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/6c/reg.c')
-rw-r--r--src/cmd/6c/reg.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/cmd/6c/reg.c b/src/cmd/6c/reg.c
index edd93a0a0..348d747b7 100644
--- a/src/cmd/6c/reg.c
+++ b/src/cmd/6c/reg.c
@@ -663,8 +663,10 @@ brk:
r1 = 0; /* set */
for(r = firstr; r != R; r = r->link) {
p = r->prog;
- if(p->to.type == D_BRANCH)
+ if(p->to.type == D_BRANCH) {
p->to.offset = r->s2->pc;
+ p->to.u.branch = r->s2->prog;
+ }
r1 = r;
}
@@ -691,7 +693,7 @@ void
addmove(Reg *r, int bn, int rn, int f)
{
Prog *p, *p1;
- Adr *a;
+ Addr *a;
Var *v;
p1 = alloc(sizeof(*p1));
@@ -715,7 +717,7 @@ addmove(Reg *r, int bn, int rn, int f)
p1->as = AMOVB;
if(v->etype == TSHORT || v->etype == TUSHORT)
p1->as = AMOVW;
- if(v->etype == TVLONG || v->etype == TUVLONG || v->etype == TIND)
+ if(v->etype == TVLONG || v->etype == TUVLONG || (v->etype == TIND && ewidth[TIND] == 8))
p1->as = AMOVQ;
if(v->etype == TFLOAT)
p1->as = AMOVSS;
@@ -759,13 +761,13 @@ doregbits(int r)
}
Bits
-mkvar(Reg *r, Adr *a)
+mkvar(Reg *r, Addr *a)
{
Var *v;
int i, t, n, et, z;
int32 o;
Bits bit;
- Sym *s;
+ LSym *s;
/*
* mark registers used
@@ -792,7 +794,7 @@ mkvar(Reg *r, Adr *a)
break;
}
s = a->sym;
- if(s == S)
+ if(s == nil)
goto none;
if(s->name[0] == '.')
goto none;
@@ -1181,7 +1183,7 @@ uint32
regset(Reg *r, uint32 bb)
{
uint32 b, set;
- Adr v;
+ Addr v;
int c;
set = 0;
@@ -1202,7 +1204,7 @@ uint32
reguse(Reg *r, uint32 bb)
{
uint32 b, set;
- Adr v;
+ Addr v;
int c;
set = 0;
@@ -1349,7 +1351,7 @@ paint3(Reg *r, int bn, int32 rb, int rn)
}
void
-addreg(Adr *a, int rn)
+addreg(Addr *a, int rn)
{
a->sym = 0;
@@ -1371,6 +1373,8 @@ BtoR(int32 b)
{
b &= 0xffffL;
+ if(nacl)
+ b &= ~((1<<(D_BP-D_AX)) | (1<<(D_R15-D_AX)));
if(b == 0)
return 0;
return bitno(b) + D_AX;
@@ -1459,10 +1463,11 @@ fixjmp(Reg *firstr)
for(r=firstr; r; r=r->link) {
p = r->prog;
if(debug['R'] && debug['v'])
- print("%04d %P\n", r->pc, p);
+ print("%04d %P\n", (int)r->pc, p);
if(p->as != ACALL && p->to.type == D_BRANCH && r->s2 && r->s2->prog->as == AJMP) {
r->s2 = chasejmp(r->s2, &jmploop);
p->to.offset = r->s2->pc;
+ p->to.u.branch = r->s2->prog;
if(debug['R'] && debug['v'])
print("->%P\n", p);
}
@@ -1483,7 +1488,7 @@ fixjmp(Reg *firstr)
// Let it stay.
} else {
if(debug['R'] && debug['v'])
- print("del %04d %P\n", r->pc, p);
+ print("del %04d %P\n", (int)r->pc, p);
p->as = ANOP;
}
}
@@ -1496,7 +1501,7 @@ fixjmp(Reg *firstr)
p = r->prog;
if(p->as == AJMP && p->to.type == D_BRANCH && r->s2 == r->link) {
if(debug['R'] && debug['v'])
- print("del %04d %P\n", r->pc, p);
+ print("del %04d %P\n", (int)r->pc, p);
p->as = ANOP;
}
}
@@ -1517,7 +1522,7 @@ fixjmp(Reg *firstr)
if(debug['R'] && debug['v']) {
print("\n");
for(r=firstr; r; r=r->link)
- print("%04d %P\n", r->pc, r->prog);
+ print("%04d %P\n", (int)r->pc, r->prog);
print("\n");
}
}