diff options
| author | Quentin Carbonneaux <[email protected]> | 2022-11-22 21:44:44 +0100 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2022-11-22 21:56:21 +0100 |
| commit | cbee74bdb4f85d6d8d4f192f0018ea023418e216 (patch) | |
| tree | 4ea3eb41265e44336d81fecf719193c67540f3d3 /alias.c | |
| parent | 04e26409011389f7b5759114905195a4fb0b0286 (diff) | |
use a new struct for symbols
Symbols are a useful abstraction
that occurs in both Con and Alias.
In this patch they get their own
struct. This new struct packages
a symbol name and a type; the type
tells us where the symbol name
must be interpreted (currently, in
gobal memory or in thread-local
storage).
The refactor fixed a bug in
addcon(), proving the value of
packaging symbol names with their
type.
Diffstat (limited to 'alias.c')
| -rw-r--r-- | alias.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -18,8 +18,7 @@ getalias(Alias *a, Ref r, Fn *fn) c = &fn->con[r.val]; if (c->type == CAddr) { a->type = ASym; - a->u.sym.label = c->label; - a->u.sym.con = r.val; + a->u.sym = c->sym; } else a->type = ACon; a->offset = c->bits.i; @@ -52,7 +51,7 @@ alias(Ref p, int sp, Ref q, int sq, int *delta, Fn *fn) /* they conservatively alias if the * symbols are different, or they * alias for sure if they overlap */ - if (ap.u.sym.label != aq.u.sym.label) + if (!symeq(ap.u.sym, aq.u.sym)) return MayAlias; if (ovlap) return MustAlias; |
