diff options
| author | 2025-11-21 16:49:53 +0100 | |
|---|---|---|
| committer | 2025-11-21 16:49:53 +0100 | |
| commit | ec4cfe9db9afc1d1c633a922174f5bb0685b0c32 (patch) | |
| tree | 2717b985346d2112f69539577df3a332acb8bd7a /ir | |
| parent | 285063eba442e2a8ac29fd42e0d17d996bcc5d00 (diff) | |
change op names to match 285063eba44
Diffstat (limited to 'ir')
| -rw-r--r-- | ir/abi0.c | 26 | ||||
| -rw-r--r-- | ir/builder.c | 10 | ||||
| -rw-r--r-- | ir/fold.c | 32 | ||||
| -rw-r--r-- | ir/intrin.c | 4 | ||||
| -rw-r--r-- | ir/ir.h | 4 | ||||
| -rw-r--r-- | ir/op.def | 144 | ||||
| -rw-r--r-- | ir/optmem.c | 42 | ||||
| -rw-r--r-- | ir/regalloc.c | 22 |
8 files changed, 142 insertions, 142 deletions
@@ -69,10 +69,10 @@ copyparam(struct function *fn, int *curi, int param, struct abiarg abi) if (abi.ty.cls == KPTR) abi.ty.cls = siz2intcls[cls2siz[abi.ty.cls]]; switch (abi.ty.cls) { default: assert(0); - case KI32: ld = Oloadu4; break; - case KI64: ld = Oloadi8; break; - case KF32: ld = Oloadf4; break; - case KF64: ld = Oloadf8; break; + case KI32: ld = Oloadu32; break; + case KI64: ld = Oloadi64; break; + case KF32: ld = Oloadf32; break; + case KF64: ld = Oloadf64; break; } return mkinstr(ld, abi.ty.cls, insertinstr(fn->entry, (*curi)++, par)); } else { /* aggregate in stack */ @@ -120,11 +120,11 @@ patchparam(struct function *fn, int *curi, int *param, int tydat, int nabi, stru * store* %x, %a * store* %x + N, %b */ - st = mkinstr(Ostore1 + ilog2(cls2siz[abi[0].ty.cls]), 0, alloc, r[0]); + st = mkinstr(Ostore8 + ilog2(cls2siz[abi[0].ty.cls]), 0, alloc, r[0]); insertinstr(blk, ++*curi, st); if (nabi > 1) { struct instr tmp = mkinstr(Oadd, KPTR, alloc, mkref(RICON, cls2siz[abi[0].ty.cls])); - st = mkinstr(Ostore1 + ilog2(cls2siz[abi[1].ty.cls]), 0, insertinstr(blk, ++*curi, tmp), r[1]); + st = mkinstr(Ostore8 + ilog2(cls2siz[abi[1].ty.cls]), 0, insertinstr(blk, ++*curi, tmp), r[1]); insertinstr(blk, ++*curi, st); } } @@ -156,10 +156,10 @@ load2regs(union ref out[2], union irtype typ, union ref src, int nabi, struct ab union ref temp; switch (ins.cls = abi[i].ty.cls) { default: assert(0); - case KI32: ins.op = Oloadu4; break; - case KI64: ins.op = Oloadi8; break; - case KF32: ins.op = Oloadf4; break; - case KF64: ins.op = Oloadf8; break; + case KI32: ins.op = Oloadu32; break; + case KI64: ins.op = Oloadi64; break; + case KF32: ins.op = Oloadf32; break; + case KF64: ins.op = Oloadf64; break; } if (i == 0) ins.l = src; @@ -177,7 +177,7 @@ load2regs(union ref out[2], union irtype typ, union ref src, int nabi, struct ab union ref reg, temp; uint n = cls2siz[abi[i].ty.cls] / align; assert(n > 0); - ld.op = Oloadu1 + ilog2(align)*2; + ld.op = Oloadu8 + ilog2(align)*2; ld.cls = abi[i].ty.cls; for (int o = 0; o < n && (i*cls2siz[ld.cls])+o*align < siz; ++o) { if (i+o == 0) @@ -304,8 +304,8 @@ abi0_call(struct function *fn, struct instr *ins, struct block *blk, int *curi) int iref, iuser; switch (call->abiret[i].ty.cls) { default: assert(0); - case KF32: case KI32: store.op = Ostore4; break; - case KI64: case KF64: store.op = Ostore8; break; + case KF32: case KI32: store.op = Ostore32; break; + case KI64: case KF64: store.op = Ostore64; break; } if (i == 0) { store.l = retmem; diff --git a/ir/builder.c b/ir/builder.c index 02664c3..9c6a0ef 100644 --- a/ir/builder.c +++ b/ir/builder.c @@ -112,11 +112,11 @@ irunop(struct function *fn, enum op op, enum irclass k, union ref a) if (ins && ins->op == Onot) /* ~(~x) ==> x */ return ins->l; break; - case Ocvtf4s: case Ocvtf4u: case Ocvtf4f8: case Ocvtf8s: - case Ocvtf8u: case Ocvtf8f4: case Ocvts4f: case Ocvtu4f: - case Ocvts8f: case Ocvtu8f: - case Oexts1: case Oextu1: case Oexts2: case Oextu2: - case Oexts4: case Oextu4: + case Ocvtf32s: case Ocvtf32u: case Ocvtf32f64: case Ocvtf64s: + case Ocvtf64u: case Ocvtf64f32: case Ocvts32f: case Ocvtu32f: + case Ocvts64f: case Ocvtu64f: + case Oexts8: case Oextu8: case Oexts16: case Oextu16: + case Oexts32: case Oextu32: case Ocopy: break; default: assert(!"unop?"); @@ -14,16 +14,16 @@ foldint(enum op op, enum irclass k, union ref lr, union ref rr) case Ocopy: x = l.s; break; case Oneg: x = -l.s; break; case Onot: x = ~l.s; break; - case Ocvtf4s: x = (int)(float)fltconval(lr); break; - case Ocvtf4u: x = (uint)(float)fltconval(lr); break; - case Ocvtf8s: x = (vlong)fltconval(lr); break; - case Ocvtf8u: x = (uvlong)fltconval(lr); break; - case Oexts1: x = (schar)l.s; break; - case Oextu1: x = (uchar)l.s; break; - case Oexts2: x = (short)l.s; break; - case Oextu2: x = (ushort)l.s; break; - case Oexts4: x = (int)l.s; break; - case Oextu4: x = (uint)l.s; break; + case Ocvtf32s: x = (int)(float)fltconval(lr); break; + case Ocvtf32u: x = (uint)(float)fltconval(lr); break; + case Ocvtf64s: x = (vlong)fltconval(lr); break; + case Ocvtf64u: x = (uvlong)fltconval(lr); break; + case Oexts8: x = (schar)l.s; break; + case Oextu8: x = (uchar)l.s; break; + case Oexts16: x = (short)l.s; break; + case Oextu16: x = (ushort)l.s; break; + case Oexts32: x = (int)l.s; break; + case Oextu32: x = (uint)l.s; break; case Oadd: x = l.u + r.u; break; case Osub: x = l.u - r.u; break; case Omul: x = l.u * r.u; break; @@ -63,12 +63,12 @@ foldflt(enum op op, enum irclass k, union ref lr, union ref rr) switch (op) { case Ocopy: x = l; break; case Oneg: x = -l; break; - case Ocvtf4f8: x = (float)l; break; - case Ocvtf8f4: x = (float)l; break; - case Ocvts4f: x = (int)intconval(lr); break; - case Ocvtu4f: x = (int)intconval(lr); break; - case Ocvts8f: x = (vlong)intconval(lr); break; - case Ocvtu8f: x = (uvlong)intconval(lr); break; + case Ocvtf32f64: x = (float)l; break; + case Ocvtf64f32: x = (float)l; break; + case Ocvts32f: x = (int)intconval(lr); break; + case Ocvtu32f: x = (int)intconval(lr); break; + case Ocvts64f: x = (vlong)intconval(lr); break; + case Ocvtu64f: x = (uvlong)intconval(lr); break; case Oadd: x = l + r; break; case Osub: x = l - r; break; case Omul: x = l * r; break; diff --git a/ir/intrin.c b/ir/intrin.c index 3edf931..8c1a128 100644 --- a/ir/intrin.c +++ b/ir/intrin.c @@ -36,8 +36,8 @@ intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg, pdst = insertinstr(blk, ++*curi, mkinstr(Oadd, KPTR, *args[0].arg, mkref(RICON, off))); psrc = insertinstr(blk, ++*curi, mkinstr(Oadd, KPTR, *args[1].arg, mkref(RICON, off))); } - src = insertinstr(blk, ++*curi, mkinstr(Oloads1 + 2*ilog2(step), step < 8 ? KI32 : KI64, psrc)); - insertinstr(blk, ++*curi, mkinstr(Ostore1 + ilog2(step), 0, pdst, src)); + src = insertinstr(blk, ++*curi, mkinstr(Oloads8 + 2*ilog2(step), step < 8 ? KI32 : KI64, psrc)); + insertinstr(blk, ++*curi, mkinstr(Ostore8 + ilog2(step), 0, pdst, src)); } return 1; } @@ -93,8 +93,8 @@ enum op { #define oiscmp(o) in_range(o, Oequ, Ougte) #define oisarith(o) in_range(o, Oneg, Ougte) #define oisalloca(o) in_range(o, Oalloca1, Oalloca16) -#define oisstore(o) in_range(o, Ostore1, Ostore8) -#define oisload(o) in_range(o, Oloads1, Oloadf8) +#define oisstore(o) in_range(o, Ostore8, Ostore64) +#define oisload(o) in_range(o, Oloads8, Oloadf64) extern const char *opnames[]; extern const uchar opnarg[]; @@ -1,76 +1,76 @@ /* OP NARG */ -_(nop, 0) -_(copy, 1) -_(move, 2) -_(neg, 1) -_(not, 1) -_(cvtf4s, 1) -_(cvtf4u, 1) -_(cvtf4f8, 1) -_(cvtf8s, 1) -_(cvtf8u, 1) -_(cvtf8f4, 1) -_(cvts4f, 1) -_(cvtu4f, 1) -_(cvts8f, 1) -_(cvtu8f, 1) -_(exts1, 1) -_(extu1, 1) -_(exts2, 1) -_(extu2, 1) -_(exts4, 1) -_(extu4, 1) -_(add, 2) -_(sub, 2) -_(mul, 2) -_(umul, 2) -_(div, 2) -_(udiv, 2) -_(rem, 2) -_(urem, 2) -_(and, 2) -_(ior, 2) -_(xor, 2) -_(shl, 2) -_(sar, 2) -_(slr, 2) -_(equ, 2) -_(neq, 2) -_(lth, 2) -_(gth, 2) -_(lte, 2) -_(gte, 2) -_(ulth, 2) -_(ugth, 2) -_(ulte, 2) -_(ugte, 2) -_(alloca1, 1) -_(alloca2, 1) -_(alloca4, 1) -_(alloca8, 1) -_(alloca16, 1) -_(loads1, 1) -_(loadu1, 1) -_(loads2, 1) -_(loadu2, 1) -_(loads4, 1) -_(loadu4, 1) -_(loadi8, 1) -_(loadf4, 1) -_(loadf8, 1) -_(store1, 2) -_(store2, 2) -_(store4, 2) -_(store8, 2) -_(param, 2) -_(arg, 2) -_(call, 2) -_(call2r, 1) -_(intrin, 2) -_(phi, 1) -_(swap, 2) -_(vastart, 1) -_(vaarg, 2) +_(nop, 0) +_(copy, 1) +_(move, 2) +_(neg, 1) +_(not, 1) +_(cvtf32s, 1) +_(cvtf32u, 1) +_(cvtf32f64, 1) +_(cvtf64s, 1) +_(cvtf64u, 1) +_(cvtf64f32, 1) +_(cvts32f, 1) +_(cvtu32f, 1) +_(cvts64f, 1) +_(cvtu64f, 1) +_(exts8, 1) +_(extu8, 1) +_(exts16, 1) +_(extu16, 1) +_(exts32, 1) +_(extu32, 1) +_(add, 2) +_(sub, 2) +_(mul, 2) +_(umul, 2) +_(div, 2) +_(udiv, 2) +_(rem, 2) +_(urem, 2) +_(and, 2) +_(ior, 2) +_(xor, 2) +_(shl, 2) +_(sar, 2) +_(slr, 2) +_(equ, 2) +_(neq, 2) +_(lth, 2) +_(gth, 2) +_(lte, 2) +_(gte, 2) +_(ulth, 2) +_(ugth, 2) +_(ulte, 2) +_(ugte, 2) +_(alloca1, 1) +_(alloca2, 1) +_(alloca4, 1) +_(alloca8, 1) +_(alloca16, 1) +_(loads8, 1) +_(loadu8, 1) +_(loads16, 1) +_(loadu16, 1) +_(loads32, 1) +_(loadu32, 1) +_(loadi64, 1) +_(loadf32, 1) +_(loadf64, 1) +_(store8, 2) +_(store16, 2) +_(store32, 2) +_(store64, 2) +_(param, 2) +_(arg, 2) +_(call, 2) +_(call2r, 1) +_(intrin, 2) +_(phi, 1) +_(swap, 2) +_(vastart, 1) +_(vaarg, 2) /* machine-specific instructions */ _(xvaprologue, 1) _(xsave, 1) diff --git a/ir/optmem.c b/ir/optmem.c index 41d123a..d28ea53 100644 --- a/ir/optmem.c +++ b/ir/optmem.c @@ -2,23 +2,23 @@ #include <stdlib.h> /* qsort */ static const uchar loadszcls[] = { - [Oloads1 - Oloads1] = 1|KI32<<4, [Oloadu1 - Oloads1] = 1|KI32<<4, - [Oloads2 - Oloads1] = 2|KI32<<4, [Oloadu2 - Oloads1] = 2|KI32<<4, - [Oloads4 - Oloads1] = 4|KI32<<4, [Oloadu4 - Oloads1] = 4|KI32<<4, - [Oloadi8 - Oloads1] = 8|KI64<<4, - [Oloadf4 - Oloads1] = 4|KF32<<4, - [Oloadf8 - Oloads1] = 8|KF64<<4, + [Oloads8 - Oloads8] = 1|KI32<<4, [Oloadu8 - Oloads8] = 1|KI32<<4, + [Oloads16 - Oloads8] = 2|KI32<<4, [Oloadu16 - Oloads8] = 2|KI32<<4, + [Oloads32 - Oloads8] = 4|KI32<<4, [Oloadu32 - Oloads8] = 4|KI32<<4, + [Oloadi64 - Oloads8] = 8|KI64<<4, + [Oloadf32 - Oloads8] = 4|KF32<<4, + [Oloadf64 - Oloads8] = 8|KF64<<4, }; static const uchar load2ext[] = { - [Oloads1 - Oloads1] = Oexts1, [Oloadu1 - Oloads1] = Oextu1, - [Oloads2 - Oloads1] = Oexts2, [Oloadu2 - Oloads1] = Oextu2, - [Oloads4 - Oloads1] = Oexts4, [Oloadu4 - Oloads1] = Oextu4, - [Oloadi8 - Oloads1] = Ocopy, + [Oloads8 - Oloads8] = Oexts8, [Oloadu8 - Oloads8] = Oextu8, + [Oloads16 - Oloads8] = Oexts16, [Oloadu16 - Oloads8] = Oextu16, + [Oloads32 - Oloads8] = Oexts32, [Oloadu32 - Oloads8] = Oextu32, + [Oloadi64 - Oloads8] = Ocopy, }; -#define loadsz(o) (loadszcls[(o) - Oloads1] & 0xF) -#define loadcls(o) (loadszcls[(o) - Oloads1] >> 4) -#define load2ext(o) (load2ext[(o) - Oloads1]) -#define storesz(o) (1 << ((o) - Ostore1)) +#define loadsz(o) (loadszcls[(o) - Oloads8] & 0xF) +#define loadcls(o) (loadszcls[(o) - Oloads8] >> 4) +#define load2ext(o) (load2ext[(o) - Oloads8]) +#define storesz(o) (1 << ((o) - Ostore8)) /* Implements algorithm in 'Simple and Efficient Construction of Static Single Assignment' (Braun et al) */ @@ -291,19 +291,19 @@ mem2reg(struct function *fn) if (!val.bits) { /* var is used uninitialized */ /* TODO emit diagnostic */ /* load some garbage */ - *m = mkinstr(kisflt(k) ? Oloadf4 + (k==KF64) : Oloads1+ilog2(sz)*2, + *m = mkinstr(kisflt(k) ? Oloadf32 + (k==KF64) : Oloads8+ilog2(sz)*2, k, mkref(RREG, mctarg->bpr)); } else { adduse(use->blk, use->u, val); if (isintcon(val) && ext != Ocopy) { vlong x = intconval(val); switch (ext) { - case Oexts1: x = (schar)x; break; - case Oextu1: x = (uchar)x; break; - case Oexts2: x = (short)x; break; - case Oextu2: x = (ushort)x; break; - case Oexts4: x = (int)x; break; - case Oextu4: x = (uint)x; break; + case Oexts8: x = (schar)x; break; + case Oextu8: x = (uchar)x; break; + case Oexts16: x = (short)x; break; + case Oextu16: x = (ushort)x; break; + case Oexts32: x = (int)x; break; + case Oextu32: x = (uint)x; break; default: assert(0); } val = mkintcon(k, x); diff --git a/ir/regalloc.c b/ir/regalloc.c index df40ad4..8c8b39c 100644 --- a/ir/regalloc.c +++ b/ir/regalloc.c @@ -251,11 +251,11 @@ emitmove(enum irclass k, struct alloc dst, struct alloc src, struct block *blk, if (src.t == ASTACK) { switch (mv.cls = k) { default: assert(0); - case KI32: mv.op = Oloads4; break; - case KI64: mv.op = Oloadi8; break; - case KPTR: mv.op = targ_64bit ? Oloadi8 : Oloads4; break; - case KF32: mv.op = Oloadf4; break; - case KF64: mv.op = Oloadf8; break; + case KI32: mv.op = Oloads32; break; + case KI64: mv.op = Oloadi64; break; + case KPTR: mv.op = targ_64bit ? Oloadi64 : Oloads32; break; + case KF32: mv.op = Oloadf32; break; + case KF64: mv.op = Oloadf64; break; } if (dst.t == AREG) reg = dst.a; @@ -265,7 +265,7 @@ emitmove(enum irclass k, struct alloc dst, struct alloc src, struct block *blk, addstkslotref(insertinstr(blk, curi, mv).i, src.a*8); } else reg = src.a; if (dst.t == ASTACK) { - mv = mkinstr(Ostore1+ilog2(cls2siz[k]), 0, .r = mkref(RREG, reg)); + mv = mkinstr(Ostore8+ilog2(cls2siz[k]), 0, .r = mkref(RREG, reg)); addstkslotref(insertinstr(blk, curi, mv).i, dst.a*8); } } @@ -976,9 +976,9 @@ devirt(struct rega *ra, struct block *blk) for (int i = 0; i < nargref; ++i) { static uchar cls2load[] = { - [KI32] = Oloads4, [KI64] = Oloadi8, [KF32] = Oloadf4, [KF64] = Oloadf8, [KPTR] = 0 + [KI32] = Oloads32, [KI64] = Oloadi64, [KF32] = Oloadf32, [KF64] = Oloadf64, [KPTR] = 0 }; - cls2load[KPTR] = targ_64bit ? Oloadi8 : Oloads4; + cls2load[KPTR] = targ_64bit ? Oloadi64 : Oloads32; union ref *r = argref[i]; int tr; if (r->t == RTMP) { @@ -1044,7 +1044,7 @@ devirt(struct rega *ra, struct block *blk) alloc = temp < ra->intervals.ntemps && (it = &ra->intervals.temps[temp]) && it->nrange ? &it->alloc : NULL; if (alloc && alloc->t == ASTACK) { enum irclass cls = insrescls(*ins); - int store = Ostore1 + ilog2(cls2siz[cls]); + int store = Ostore8 + ilog2(cls2siz[cls]); /* t was spilled, gen store */ if (ins->op == Ocopy && ins->l.t != RADDR) { ins->op = store; @@ -1075,7 +1075,7 @@ devirt(struct rega *ra, struct block *blk) } } } - if (!ins->reg && insrescls(*ins) && ins->op != Omove && !ins->keep && !in_range(ins->op, Ostore1, Ostore8)) { + if (!ins->reg && insrescls(*ins) && ins->op != Omove && !ins->keep && !in_range(ins->op, Ostore8, Ostore64)) { /* dead */ Nop: ins->op = Onop; @@ -1095,7 +1095,7 @@ devirt(struct rega *ra, struct block *blk) ++curi; ins->l.i = ins->reg-1; } - if (!ins->reg && in_range(ins->op, Oloads1, Oloadf8)) { + if (!ins->reg && in_range(ins->op, Oloads8, Oloadf64)) { assert(ins->keep); ins->reg = kisint(ins->cls) ? mctarg->gprscratch+1 : mctarg->fprscratch+1; } |