From 61367525aea8f3f11c29e628fe49768dda959cef Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 19 Jun 2023 22:33:35 +0200 Subject: backend: compile comparison instrs and branches --- ir.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ir.c') diff --git a/ir.c b/ir.c index 216ed6e..2a7de47 100644 --- a/ir.c +++ b/ir.c @@ -5,6 +5,13 @@ uchar type2cls[NTYPETAG]; uchar cls2siz[KF8+1]; const uchar siz2intcls[] = { [1] = KI4, [2] = KI4, [4] = KI4, [8] = KI8 }; +const char *opnames[] = { + "?\??", +#define _(o,...) #o, +#include "op.def" +#undef _ +}; + struct instr instrtab[MAXINSTR]; int ninstr; static int instrfreelist; @@ -46,6 +53,7 @@ irinit(struct function *fn) cls2siz[KPTR] = targ_primsizes[TYPTR]; } fn->entry = fn->curblk = alloc(&fn->arena, sizeof(struct block), 0); + fn->nblk = 1; memset(fn->entry, 0, sizeof *fn->entry); fn->entry->lprev = fn->entry->lnext = fn->entry; } @@ -325,6 +333,7 @@ useblk(struct function *fn, struct block *blk) blk->lprev = fn->entry->lprev; blk->lprev->lnext = blk; blk->id = blk->lprev->id + 1; + ++fn->nblk; fn->entry->lprev = blk; } fn->curblk = blk; -- cgit v1.2.3