diff options
| author | 2026-02-19 20:29:16 +0100 | |
|---|---|---|
| committer | 2026-02-19 20:29:16 +0100 | |
| commit | ad8067a1ab1871cf57936828fb1b40c15cd3349d (patch) | |
| tree | ad86757ae0f84f1fd7dd58373cdb4f50d7f036d6 /x86_64 | |
| parent | 1430f62ebed808458baccbdf0e41b806334ff704 (diff) | |
IR: just use an array for extended constants
The extra work of using a hashtable to intern them is probably
unnecessary.
Diffstat (limited to 'x86_64')
| -rw-r--r-- | x86_64/emit.c | 22 | ||||
| -rw-r--r-- | x86_64/isel.c | 8 |
2 files changed, 15 insertions, 15 deletions
diff --git a/x86_64/emit.c b/x86_64/emit.c index 17ea1f3..0d7b77a 100644 --- a/x86_64/emit.c +++ b/x86_64/emit.c @@ -46,13 +46,13 @@ ref2oper(union ref r) case RREG: return reg2oper(r.i); case RICON: return mkoper(OIMM, .imm = r.i); case RXCON: - if (conht[r.i].cls == KI32) - return mkoper(OIMM, .imm = conht[r.i].i); - else if (conht[r.i].cls == KI64) { - vlong i = conht[r.i].i; + if (contab.p[r.i].cls == KI32) + return mkoper(OIMM, .imm = contab.p[r.i].i); + else if (contab.p[r.i].cls == KI64) { + vlong i = contab.p[r.i].i; assert(i == (int)i); return mkoper(OIMM, .imm = i); - } else if (!conht[r.i].cls) { + } else if (!contab.p[r.i].cls) { return mkoper(OSYM, .con = r.i, .cindex = NOINDEX); } assert(0); @@ -107,14 +107,14 @@ mkimmregoper(union ref r) static inline struct oper mkdatregoper(union ref r) { - assert(isregref(r) || (r.t == RXCON && conht[r.i].deref)); + assert(isregref(r) || (r.t == RXCON && contab.p[r.i].deref)); return ref2oper(r); } static inline struct oper mkimmdatregoper(union ref r) { - assert(isregref(r) || r.t == RICON || (r.t == RXCON && (conht[r.i].cls == KI32 || conht[r.i].deref))); + assert(isregref(r) || r.t == RICON || (r.t == RXCON && (contab.p[r.i].cls == KI32 || contab.p[r.i].deref))); return ref2oper(r); } @@ -151,7 +151,7 @@ mkmemoper(union ref r) .disp = addr->disp, .shift = addr->shift); } else if (r.t == RXCON) { - assert(!conht[r.i].cls); + assert(!contab.p[r.i].cls); return mkoper(OSYM, .con = r.i, .cindex = NOINDEX); } else { return mkoper(OMEM, .base = isregref(r) ? ref2oper(r).reg : NOBASE, @@ -869,8 +869,8 @@ gencopy(uchar **pcode, enum irclass cls, struct block *blk, int curi, struct ope } /* normal (not 2-address) case */ Lea: - if (isaddrcon(addr->base,0) && (ccopt.pic || (conht[addr->base.i].flag & SFUNC)) - && !(conht[addr->base.i].flag & SLOCAL)) { + if (isaddrcon(addr->base,0) && (ccopt.pic || (contab.p[addr->base.i].flag & SFUNC)) + && !(contab.p[addr->base.i].flag & SLOCAL)) { assert(!addr->disp && !addr->index.bits); val = addr->base; goto GOTLoad; @@ -880,7 +880,7 @@ gencopy(uchar **pcode, enum irclass cls, struct block *blk, int curi, struct ope /* dst = 0 -> xor dst, dst; but only if it is ok to clobber flags */ Xxor(pcode, kisint(cls) ? KI32 : cls, dst, dst); } else if (isaddrcon(val,0)) { - if ((ccopt.pic || (conht[val.i].flag & SFUNC)) && !(conht[val.i].flag & SLOCAL)) { + if ((ccopt.pic || (contab.p[val.i].flag & SFUNC)) && !(contab.p[val.i].flag & SLOCAL)) { GOTLoad: /* for mov reg, [rip(sym@GOTPCREL)] */ Xmov(pcode, cls, dst, mkoper(OSYMGOT, .con = val.i, .cindex = NOINDEX)); diff --git a/x86_64/isel.c b/x86_64/isel.c index 3faa7fc..7f82984 100644 --- a/x86_64/isel.c +++ b/x86_64/isel.c @@ -54,7 +54,7 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi) enum op op = ins ? ins->op : 0; if (r->t == RXCON) { - struct xcon *con = &conht[r->i]; + struct xcon *con = &contab.p[r->i]; if (in_range(op, Oshl, Oslr) && r == &ins->r) { sh = con->i; goto ShiftImm; @@ -293,7 +293,7 @@ fuseaddr(union ref *r, struct block *blk, int *curi) if (r->t != RSTACK && r->t != RTMP) return 0; if (!aadd(&addr, blk, curi, *r)) return 0; - if (isaddrcon(addr.base,0) && (ccopt.pic || (ccopt.pie && addr.index.bits) || (conht[addr.base.i].flag & SFUNC))) { + if (isaddrcon(addr.base,0) && (ccopt.pic || (ccopt.pie && addr.index.bits) || (contab.p[addr.base.i].flag & SFUNC))) { /* pic needs to load from GOT */ /* pie cannot encode RIP-relative address with index register */ /* first load symbol address into a temp register */ @@ -318,7 +318,7 @@ static bool addarg4addrp(union ref r) { struct instr *ins; - if (r.t == RXCON && !conht[r.i].cls && !conht[r.i].deref) return 1; /* sym or dat ref */ + if (r.t == RXCON && !contab.p[r.i].cls && !contab.p[r.i].deref) return 1; /* sym or dat ref */ if (r.t == RSTACK) return 1; if (r.t != RTMP) return 0; ins = &instrtab[r.i]; @@ -574,7 +574,7 @@ seljmp(struct function *fn, struct block *blk) fixarg(&blk->jmp.arg[0], NULL, blk, &curi); union ref c = blk->jmp.arg[0]; if (c.t != RTMP) { - enum irclass cls = c.t == RICON ? KI32 : c.t == RXCON && conht[c.i].cls ? conht[c.i].cls : KPTR; + enum irclass cls = c.t == RICON ? KI32 : c.t == RXCON && contab.p[c.i].cls ? contab.p[c.i].cls : KPTR; int curi = blk->ins.n; c = insertinstr(blk, blk->ins.n, mkinstr(Ocopy, cls, c)); |