From 1d9e19fb3bb941cdc28e9d4c3063d3e213fd8312 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 18 Mar 2026 11:33:41 +0100 Subject: Refactor: use typedefs and CamelCase for aggregate types Looks nicer --- src/ir_intrin.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/ir_intrin.c') diff --git a/src/ir_intrin.c b/src/ir_intrin.c index ca49341..6c73784 100644 --- a/src/ir_intrin.c +++ b/src/ir_intrin.c @@ -1,13 +1,13 @@ #include "ir.h" -struct arg { union ref *arg, *ty; }; +typedef struct { Ref *arg, *ty; } Arg; static int -intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg, union irtype ret) +intrin(Block *blk, int *curi, enum intrin in, Arg *args, int narg, IRType ret) { - struct instr *this = &instrtab[blk->ins.p[*curi]]; - const struct typedata *td; - union irtype ty; + Instr *this = &instrtab[blk->ins.p[*curi]]; + const TypeData *td; + IRType ty; uint ncopy, step; switch (in) { @@ -31,7 +31,7 @@ intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg, } else { delinstr(blk, (*curi)--); for (int off = 0; off < td->siz; off += step) { - union ref psrc = *args[1].arg, pdst = *args[0].arg, src; + Ref psrc = *args[1].arg, pdst = *args[0].arg, src; if (off) { 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))); @@ -46,17 +46,17 @@ intrin(struct block *blk, int *curi, enum intrin in, struct arg *args, int narg, } void -lowerintrin(struct function *fn) +lowerintrin(Function *fn) { - struct block *blk = fn->entry; - struct arg argsbuf[32]; - vec_of(struct arg) args = VINIT(argsbuf, countof(argsbuf)); + Block *blk = fn->entry; + Arg argsbuf[32]; + vec_of(Arg) args = VINIT(argsbuf, countof(argsbuf)); do { for (int i = 0; i < blk->ins.n; ++i) { - struct instr *ins = &instrtab[blk->ins.p[i]]; + Instr *ins = &instrtab[blk->ins.p[i]]; if (ins->op == Oarg) - vpush(&args, ((struct arg){ &ins->r, &ins->l })); + vpush(&args, ((Arg){&ins->r, &ins->l})); else if (ins->op == Ocall) vinit(&args, argsbuf, countof(argsbuf)); else if (ins->op == Ointrin) { -- cgit v1.2.3