diff options
| author | 2026-03-21 22:20:34 +0100 | |
|---|---|---|
| committer | 2026-03-22 10:49:26 +0100 | |
| commit | 79874c83bf76a5b3efd3d558933b90d9b53b829e (patch) | |
| tree | 566930a17f1e090f86c2051ffec33106012908eb /src/c_builtin.c | |
| parent | 83342d3b60438ef2421160a0673fb45d48b2f39f (diff) | |
IR: add 3rd operand to Instr
The motivation is for aarch64 msub/madd instrs, for isel to produce. But
it should be useful for other things too.
Diffstat (limited to 'src/c_builtin.c')
| -rw-r--r-- | src/c_builtin.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/c_builtin.c b/src/c_builtin.c index a8d4f4f..522c4dc 100644 --- a/src/c_builtin.c +++ b/src/c_builtin.c @@ -46,7 +46,7 @@ va_start_comp(Function *fn, Expr *ex, bool discard) assert(typedecay(ex->sub[1].ty).bits == typedecay(cvalistty).bits); if (!typedata[fn->fnty.dat].variadic) error(&ex->span, "va_start used in non-variadic function"); - addinstr(fn, mkinstr(Ovastart, 0, compileexpr(fn, &ex->sub[1], 0))); + addinstr(fn, mkinstr1(Ovastart, 0, compileexpr(fn, &ex->sub[1], 0))); return NOREF; } @@ -89,20 +89,6 @@ trap_comp(Function *fn, Expr *ex, bool discard) return NOREF; } -static inline Ref -cvtintref(Function *fn, enum irclass dst, Ref src) -{ - if (src.t == RTMP) { - if (insrescls(instrtab[src.i]) != dst) - return addinstr(fn, mkinstr(Ocopy, dst, src)); - return src; - } else if (isintcon(src)) { - vlong x = intconval(src); - return mkintcon(dst, cls2siz[dst] == 4 ? (int)x : x); - } - assert(!"int ref?"); -} - /* __builtin_bswap16 */ DEF_FNLIKE_SEMA(bswap16, mktype(TYUSHORT), mktype(TYUSHORT)) static Ref @@ -162,7 +148,7 @@ builtin_va_arg_comp(Function *fn, const Expr *ex, bool discard) { assert(ex->t == EVAARG && ex->ty.t); enum irclass k = isagg(ex->ty) ? KPTR : type2cls[scalartypet(ex->ty)]; - return addinstr(fn, mkinstr(Ovaarg, k, compileexpr(fn, ex->sub, 0), mktyperef(mkirtype(ex->ty)))); + return addinstr(fn, mkinstr2(Ovaarg, k, compileexpr(fn, ex->sub, 0), mktyperef(mkirtype(ex->ty)))); } bool |