summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-04 14:00:50 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-04 14:00:50 -0500
commitc2ce1375eb0d9b03861bb345fb10c393197174c5 (patch)
tree82cf8ce360f49d6525d6faf1aed012407b1826d9
parentb4f80258a122a82d302784ea98756d901591011d (diff)
downloadroux-c2ce1375eb0d9b03861bb345fb10c393197174c5.tar.gz
cheaply integrate fp in mem.c
-rw-r--r--lisc/mem.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisc/mem.c b/lisc/mem.c
index bfc8218..ea4bd82 100644
--- a/lisc/mem.c
+++ b/lisc/mem.c
@@ -4,6 +4,8 @@
*
* - replace alloced slots used only in
* load/store operations
+ * Assumption: all the accesses have the
+ * same size (this could be wrong...)
*/
/* require use, maintains use counts */
@@ -28,35 +30,37 @@ memopt(Fn *fn)
goto NextIns;
l = u->u.ins;
if (l->op < OStorel || l->op > OStoreb)
- if (l->op < OLoad || l->op > OLoad1)
+ if (l->op < OLoadl || l->op > OLoadub)
goto NextIns;
}
/* get rid of the alloc and replace uses */
*i = (Ins){.op = ONop};
t->ndef--;
ue = &t->use[t->nuse];
- for (u=t->use; u != ue; u++) {
+ for (u=t->use; u!=ue; u++) {
l = u->u.ins;
if (OStorel <= l->op && l->op <= OStoreb) {
- l->wide = (l->op == OStorel);
+ l->cls = l->op == OStorel ? Kl : Kw;
l->op = OCopy;
l->to = l->arg[1];
l->arg[1] = R;
t->nuse--;
t->ndef++;
} else
+ /* try to turn loads into copies so we
+ * can eliminate them later */
switch(l->op) {
- case OLoad+Tl:
- l->wide = 1;
+ case OLoadl:
+ l->cls = Kl;
l->op = OCopy;
break;
- case OLoad+Tsw:
- case OLoad+Tuw:
- l->wide = 0;
+ case OLoadsw:
+ case OLoaduw:
+ l->cls = Kw;
l->op = OCopy;
break;
default:
- /* keep l->wide */
+ /* keep l->cls */
a = l->op - OLoad;
l->op = OExt + a;
break;