From d1f048bc9c8eacc5fb34ce39346de8f5388a201b Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sat, 24 Oct 2015 20:53:29 -0400 Subject: don't share mems containing temporaries This can cause trouble in register allocation when these temporaries get replaced by registers. On the other hand, offsetted slots and constants can safely be shared. --- lisc/isel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisc/isel.c b/lisc/isel.c index 1560d6d..6dc28ea 100644 --- a/lisc/isel.c +++ b/lisc/isel.c @@ -141,7 +141,9 @@ sel(Ins i, ANum *an, Fn *fn) vgrow(&fn->mem, ++fn->nmem); fn->mem[fn->nmem-1] = a; i.arg[0] = MEM(fn->nmem-1); - an[r0.val].mem = i.arg[0]; + if (rtype(a.base) != RTmp) + if (req(a.index, R)) + an[r0.val].mem = i.arg[0]; } else i.arg[0] = r1; } -- cgit 1.4.1