qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 1f696fed0dd9f9019209f3f8178f599d1e25c782
parent 0d50ebaed94f595961d88544a028bf7f523d3eac
Author: Quentin Carbonneaux <quentin@c9x.me>
Date:   Sun, 20 Nov 2022 21:36:51 +0100

make Alias.base an int

We had the invariant that it'd
always be a temporary.

Diffstat:
Malias.c | 8++++----
Mall.h | 2+-
Mload.c | 4++--
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/alias.c b/alias.c @@ -43,7 +43,7 @@ alias(Ref p, int sp, Ref q, int sq, int *delta, Fn *fn) /* if both are offsets of the same * stack slot, they alias iif they * overlap */ - if (req(ap.base, aq.base) && ovlap) + if (ap.base == aq.base && ovlap) return MustAlias; return NoAlias; } @@ -60,7 +60,7 @@ alias(Ref p, int sp, Ref q, int sq, int *delta, Fn *fn) } if ((ap.type == ACon && aq.type == ACon) - || (ap.type == aq.type && req(ap.base, aq.base))) { + || (ap.type == aq.type && ap.base == aq.base)) { assert(ap.type == ACon || ap.type == AUnk); /* if they have the same base, we * can rely on the offsets only */ @@ -122,7 +122,7 @@ fillalias(Fn *fn) a = &fn->tmp[p->to.val].alias; assert(a->type == ABot); a->type = AUnk; - a->base = p->to; + a->base = p->to.val; a->offset = 0; a->slot = 0; } @@ -139,7 +139,7 @@ fillalias(Fn *fn) a->type = AUnk; a->slot = 0; } - a->base = i->to; + a->base = i->to.val; a->offset = 0; } if (i->op == Ocopy) { diff --git a/all.h b/all.h @@ -280,7 +280,7 @@ struct Alias { AUnk = 6, #define astack(t) ((t) & 1) } type; - Ref base; + int base; uint32_t label; int64_t offset; int reloc; diff --git a/load.c b/load.c @@ -144,7 +144,7 @@ load(Slice sl, bits msk, Loc *l) case ALoc: case AEsc: case AUnk: - r = a->base; + r = TMP(a->base); if (!a->offset) break; r1 = getcon(a->offset, curf); @@ -178,7 +178,7 @@ killsl(Ref r, Slice sl) default: die("unreachable"); case ALoc: case AEsc: - case AUnk: return req(a->base, r); + case AUnk: return req(TMP(a->base), r); case ACon: case ASym: return 0; }