diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-03-25 14:02:43 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-03-25 14:02:43 -0400 |
commit | 62e238a6ef151d56b79e1f076a57463f2e1fb020 (patch) | |
tree | 29c858054c62230eb73330f165cf30ff20e14d86 /lisc/mem.c | |
parent | 97b58def96d47d937d86849380d8316ddb16bed8 (diff) | |
download | roux-62e238a6ef151d56b79e1f076a57463f2e1fb020.tar.gz |
great renaming campain!
Diffstat (limited to 'lisc/mem.c')
-rw-r--r-- | lisc/mem.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/lisc/mem.c b/lisc/mem.c deleted file mode 100644 index 914f181..0000000 --- a/lisc/mem.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "lisc.h" - -/* Memory optimization: - * - * - 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 */ -void -memopt(Fn *fn) -{ - Blk *b; - Ins *i, *l; - Tmp *t; - Use *u, *ue; - int a; - - b = fn->start; - for (i=b->ins; i-b->ins < b->nins; i++) { - if (OAlloc > i->op || i->op > OAlloc1) - continue; - assert(NAlign == 3); - assert(rtype(i->to) == RTmp); - t = &fn->tmp[i->to.val]; - for (u=t->use; u != &t->use[t->nuse]; u++) { - if (u->type != UIns) - goto NextIns; - l = u->u.ins; - if (!isload(l->op) - && (!isstore(l->op) || req(i->to, l->arg[0]))) - 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++) { - l = u->u.ins; - if (isstore(l->op)) { - if (l->op == OStores) - l->cls = Kd; - else if (l->op == OStored) - l->cls = Kd; - else if (l->op == OStorel) - l->cls = Kl; - else - l->cls = 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: - l->op = OCopy; - break; - case OLoadsw: - case OLoaduw: - l->cls = Kw; - l->op = OCopy; - break; - default: - /* keep l->cls */ - a = l->op - OLoadsw; - l->op = OExtsw + a; - break; - } - } - NextIns:; - } - if (debug['M']) { - fprintf(stderr, "\n> After memory optimization:\n"); - printfn(fn, stderr); - } -} |