summaryrefslogtreecommitdiff
path: root/src/cmd/5c/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/5c/reg.c')
-rw-r--r--src/cmd/5c/reg.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/cmd/5c/reg.c b/src/cmd/5c/reg.c
index 1ccf74a35..42c5193de 100644
--- a/src/cmd/5c/reg.c
+++ b/src/cmd/5c/reg.c
@@ -66,12 +66,6 @@ rcmp(const void *a1, const void *a2)
void
regopt(Prog *p)
{
- USED(p);
- // TODO(kaib): optimizer disabled because it smashes R8 when running out of registers
- // the disable is unconventionally here because the call is in common code shared by 5c/6c/8c
- return;
-
-#ifdef NOTDEF
Reg *r, *r1, *r2;
Prog *p1;
int i, z;
@@ -191,6 +185,14 @@ regopt(Prog *p)
break;
/*
+ * right side read
+ */
+ case APLD:
+ for(z=0; z<BITS; z++)
+ r->use2.b[z] |= bit.b[z];
+ break;
+
+ /*
* funny
*/
case ABL:
@@ -492,7 +494,6 @@ brk:
r1->link = freer;
freer = firstr;
}
-#endif
}
void
@@ -1149,12 +1150,13 @@ addreg(Adr *a, int rn)
* 1 R1
* ... ...
* 10 R10
+ * 12 R12
*/
int32
RtoB(int r)
{
- if(r < 2 || r >= REGTMP-2) // excluded R9 and R10 for m and g
+ if(r < 2 || (r >= REGTMP-2 && r != 12)) // excluded R9 and R10 for m and g, but not R12
return 0;
return 1L << r;
}
@@ -1162,7 +1164,7 @@ RtoB(int r)
int
BtoR(int32 b)
{
- b &= 0x01fcL; // excluded R9 and R10 for m and g
+ b &= 0x11fcL; // excluded R9 and R10 for m and g, but not R12
if(b == 0)
return 0;
return bitno(b);
@@ -1173,7 +1175,7 @@ BtoR(int32 b)
* 18 F2
* 19 F3
* ... ...
- * 23 F7
+ * 31 F15
*/
int32
FtoB(int f)
@@ -1188,7 +1190,7 @@ int
BtoF(int32 b)
{
- b &= 0xfc0000L;
+ b &= 0xfffc0000L;
if(b == 0)
return 0;
return bitno(b) - 16;