From f3ca2577372eaae7056db24982abfc54be8f4cc1 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 14 Mar 2025 13:09:21 +0100 Subject: gvn/gcm review - Many stylistic nits. - Removed blkmerge(). - Some minor bug fixes. - GCM reassoc is now "sink"; a pass that moves trivial ops in their target block with the same goal of reducing register pressure, but starting from instructions that benefit from having their inputs close. --- amd64/emit.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'amd64') diff --git a/amd64/emit.c b/amd64/emit.c index 8f36188..a8cd0de 100644 --- a/amd64/emit.c +++ b/amd64/emit.c @@ -612,6 +612,7 @@ amd64_emitfn(Fn *fn, FILE *f) Blk *b, *s; Ins *i, itmp; int *r, c, o, n, lbl; + uint p; E *e; e = &(E){.f = f, .fn = fn}; @@ -640,8 +641,14 @@ amd64_emitfn(Fn *fn, FILE *f) } for (lbl=0, b=fn->start; b; b=b->link) { - if (lbl || b->npred > 1) + if (lbl || b->npred > 1) { + for (p=0; pnpred; p++) + if (b->pred[p]->id >= b->id) + break; + if (p != b->npred) + fprintf(f, ".p2align 4\n"); fprintf(f, "%sbb%d:\n", T.asloc, id0+b->id); + } for (i=b->ins; i!=&b->ins[b->nins]; i++) emitins(*i, e); lbl = 1; -- cgit v1.2.3