qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 95d9a335df2deb197ae9a74abc755694a7158462
parent ff607f1a1e4d8f15adb075e427b4b9ea0ad34c03
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Mon, 21 Sep 2015 19:53:12 -0400

fix rega bug for indirect calls

Diffstat:
Mlisc/rega.c | 34+++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/lisc/rega.c b/lisc/rega.c @@ -327,24 +327,28 @@ rega(Fn *fn) for (r=0; r<NRSave; r++) if (!(BIT(rsave[r]) & rs)) rfree(&cur, rsave[r]); - continue; + r = 0; + break; case OCopy: - if (!isreg(i->arg[0])) - break; - i = dopm(b, i, &cur); - continue; - } - if (!req(i->to, R)) { - assert(rtype(i->to) == RTmp); - r = rfree(&cur, i->to.val); - if (r == -1) { - *i = (Ins){.op = ONop}; + if (isreg(i->arg[0])) { + i = dopm(b, i, &cur); continue; } - if (i->to.val >= Tmp0) - i->to = TMP(r); - } else - r = 0; + /* fall through */ + default: + if (!req(i->to, R)) { + assert(rtype(i->to) == RTmp); + r = rfree(&cur, i->to.val); + if (r == -1) { + *i = (Ins){.op = ONop}; + continue; + } + if (i->to.val >= Tmp0) + i->to = TMP(r); + } else + r = 0; + break; + } for (x=0; x<2; x++) if (rtype(i->arg[x]) == RTmp) { /* <arch>