ref: d448d850e84b0c173b343ac7d09ae8b9037f2c84
parent: 7c9fe270231e6061ea98c63c6de9756b6d03e1ba
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri May 31 17:04:41 EDT 2024
2c: fix indirect calls The peeophole optimizer was removing MOVL R0, A0 instructions before BSR (A0) because copyu() decided all registers are being written (because function calls clobber the registers). For indirect calls, the register operand must be correctly reported as being used (and then clobbered).
--- a/sys/src/cmd/2c/peep.c
+++ b/sys/src/cmd/2c/peep.c
@@ -147,7 +147,6 @@
void
excise(Reg *r)
{
-
p = r->prog;
p->as = ANOP;
p->from = zprog.from;
@@ -930,6 +929,8 @@
return 3;
case ABSR: /* funny */
+ if(copyau(&p->to, v))
+ return 4;
t = v->type;
if(t >= D_R0 && t < D_R0+NREG)
if(t-D_R0 > exregoffset)
--
⑨