diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-21 19:53:12 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-09-21 19:53:12 -0400 |
commit | 95d9a335df2deb197ae9a74abc755694a7158462 (patch) | |
tree | 089b02c9b59bb3a78fc3c3858c861355eeeefd3d | |
parent | ff607f1a1e4d8f15adb075e427b4b9ea0ad34c03 (diff) | |
download | roux-95d9a335df2deb197ae9a74abc755694a7158462.tar.gz |
fix rega bug for indirect calls
-rw-r--r-- | lisc/rega.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lisc/rega.c b/lisc/rega.c index 66836be..e1f0a6d 100644 --- 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> |