aboutsummaryrefslogtreecommitdiff
path: root/ssa.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2017-02-25 14:48:15 -0500
committerQuentin Carbonneaux <[email protected]>2017-02-25 15:14:12 -0500
commit2c2db15995ce6c0f362d65e174d5a1b933057b80 (patch)
treec6faa1a0bbe472420be1372c9762f11be4403d8f /ssa.c
parente46b4e31e83f2f9d638ddffc5575795565f15e88 (diff)
do sign/zero extensions removal in copy.c
Diffstat (limited to 'ssa.c')
-rw-r--r--ssa.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ssa.c b/ssa.c
index 8a28eeb..632ebbe 100644
--- a/ssa.c
+++ b/ssa.c
@@ -31,7 +31,7 @@ adduse(Tmp *tmp, int ty, Blk *b, ...)
va_end(ap);
}
-/* fill usage, phi, and class information
+/* fill usage, width, phi, and class information
* must not change .visit fields
*/
void
@@ -40,7 +40,7 @@ filluse(Fn *fn)
Blk *b;
Phi *p;
Ins *i;
- int m, t;
+ int m, t, w;
uint a;
Tmp *tmp;
@@ -51,6 +51,7 @@ filluse(Fn *fn)
tmp[t].nuse = 0;
tmp[t].phi = 0;
tmp[t].cls = 0;
+ tmp[t].width = WFull;
if (tmp[t].use == 0)
tmp[t].use = vnew(0, sizeof(Use), Pfn);
}
@@ -72,7 +73,16 @@ filluse(Fn *fn)
for (i=b->ins; i-b->ins < b->nins; i++) {
if (!req(i->to, R)) {
assert(rtype(i->to) == RTmp);
+ w = WFull;
+ if (isload(i->op) && i->op != Oload)
+ w = Wsb + (i->op - Oloadsb);
+ if (isext(i->op))
+ w = Wsb + (i->op - Oextsb);
+ if (w == Wsw || w == Wuw)
+ if (i->cls == Kw)
+ w = WFull;
t = i->to.val;
+ tmp[t].width = w;
tmp[t].ndef++;
tmp[t].cls = i->cls;
}