regalloc(&n2, nr->type, N);
cgen(nr, &n2);
} else {
- regalloc(&n2, nr->type, N);
+ regalloc(&n2, nr->type, res);
cgen(nr, &n2);
- regalloc(&n1, nl->type, res);
+ regalloc(&n1, nl->type, N);
cgen(nl, &n1);
}
gins(a, &n2, &n1);
D_CX, // for shift
D_DX, // for divide
D_SP, // for stack
- D_R14, // reserved for m
- D_R15, // reserved for u
};
void
return 0;
}
+static uintptr regpc[D_R15+1 - D_AX];
+
/*
* allocate register of type t, leave in n.
* if o != N, o is desired fixed register.
goto out;
}
for(i=D_AX; i<=D_R15; i++)
- if(reg[i] == 0)
+ if(reg[i] == 0) {
+ regpc[i-D_AX] = (uintptr)getcallerpc(&n);
goto out;
+ }
- yyerror("out of fixed registers");
- goto err;
+ flusherrors();
+ for(i=0; i+D_AX<=D_R15; i++)
+ print("%d %p\n", i, regpc[i]);
+ fatal("out of fixed registers");
case TFLOAT32:
case TFLOAT64:
for(i=D_X0; i<=D_X7; i++)
if(reg[i] == 0)
goto out;
- yyerror("out of floating registers");
- goto err;
+ fatal("out of floating registers");
case TCOMPLEX64:
case TCOMPLEX128:
tempname(n, t);
return;
}
- yyerror("regalloc: unknown type %T", t);
-
-err:
- nodreg(n, t, 0);
+ fatal("regalloc: unknown type %T", t);
return;
out:
if(reg[i] <= 0)
fatal("regfree: reg not allocated");
reg[i]--;
+ if(reg[i] == 0 && D_AX <= i && i <= D_R15)
+ regpc[i - D_AX] = 0;
}
/*
--- /dev/null
+// $G $D/$F.go
+
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Used to run 6g out of registers. Issue 2669.
+
+package p
+
+type y struct {
+ num int
+}
+
+func zzz () {
+ k := make([]byte, 10)
+ arr := make ([]*y, 0)
+ for s := range arr {
+ x := make([]byte, 10)
+ for i := 0; i < 100 ; i++ {
+ x[i] ^= k[i-arr[s].num%0]
+ }
+ }
+}