diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-11-11 21:21:54 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-11-11 21:21:54 -0500 |
commit | a3a1fc0c8025117139d5e8e6ba4c88ecbe978981 (patch) | |
tree | 80cc3c54799644cb8587aa41f94fec4904000b1e /lisc/parse.c | |
parent | d3f1cd94833b33c2817312dfd67100693987083f (diff) | |
download | roux-a3a1fc0c8025117139d5e8e6ba4c88ecbe978981.tar.gz |
move usage computation in filluse()
Diffstat (limited to 'lisc/parse.c')
-rw-r--r-- | lisc/parse.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lisc/parse.c b/lisc/parse.c index fa3194f..231f90c 100644 --- a/lisc/parse.c +++ b/lisc/parse.c @@ -299,18 +299,15 @@ expect(int t) } static Ref -tmpref(char *v, int use) +tmpref(char *v) { int t; for (t=Tmp0; t<ntmp; t++) if (strcmp(v, tmp[t].name) == 0) - goto Found; + return TMP(t); vgrow(&tmp, ++ntmp); strcpy(tmp[t].name, v); -Found: - tmp[t].ndef += !use; - tmp[t].nuse += use; return TMP(t); } @@ -322,7 +319,7 @@ parseref() switch (next()) { case TTmp: - return tmpref(tokval.str, 1); + return tmpref(tokval.str); case TNum: c = (Con){.type = CNum, .val = tokval.num}; strcpy(c.label, ""); @@ -509,7 +506,7 @@ parseline(PState ps) closeblk(); return PLbl; } - r = tmpref(tokval.str, 0); + r = tmpref(tokval.str); expect(TEq); w = parsecls(&ty); op = next(); @@ -547,10 +544,6 @@ DoOp: arg[i] = parseref(); if (req(arg[i], R)) err("invalid instruction argument"); - if (op == -1) - if (rtype(arg[i]) == RTmp) - if (!tmp[arg[i].val].phi) - tmp[arg[i].val].phi = r.val; i++; t = peek(); if (t == TNL) @@ -572,7 +565,6 @@ DoOp: curi++; return PIns; } else { - tmp[r.val].phi = r.val; phi = alloc(sizeof *phi); phi->to = r; phi->wide = w; |