summaryrefslogtreecommitdiff
path: root/src/cmd/5g/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/5g/reg.c')
-rw-r--r--src/cmd/5g/reg.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cmd/5g/reg.c b/src/cmd/5g/reg.c
index 4762df506..b78c268df 100644
--- a/src/cmd/5g/reg.c
+++ b/src/cmd/5g/reg.c
@@ -36,6 +36,11 @@
#define NREGVAR 32
#define REGBITS ((uint32)0xffffffff)
+/*c2go enum {
+ NREGVAR = 32,
+ REGBITS = 0xffffffff,
+};
+*/
void addsplits(void);
static Reg* firstr;
@@ -194,7 +199,7 @@ regopt(Prog *firstp)
proginfo(&info, p);
// Avoid making variables for direct-called functions.
- if(p->as == ABL && p->to.type == D_EXTERN)
+ if(p->as == ABL && p->to.name == D_EXTERN)
continue;
bit = mkvar(r, &p->from);
@@ -222,6 +227,10 @@ regopt(Prog *firstp)
for(z=0; z<BITS; z++)
r->set.b[z] |= bit.b[z];
}
+
+ /* the mod/div runtime routines smash R12 */
+ if(p->as == ADIV || p->as == ADIVU || p->as == AMOD || p->as == AMODU)
+ r->set.b[0] |= RtoB(12);
}
if(firstr == R)
return;
@@ -1306,6 +1315,7 @@ void
addreg(Adr *a, int rn)
{
a->sym = nil;
+ a->node = nil;
a->name = D_NONE;
a->type = D_REG;
a->reg = rn;