aboutsummaryrefslogtreecommitdiff
path: root/amd64
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2025-03-14 13:09:21 +0100
committerQuentin Carbonneaux <[email protected]>2025-03-14 13:09:21 +0100
commitf3ca2577372eaae7056db24982abfc54be8f4cc1 (patch)
treebdc83176ce62fa780981605f85e58c91c19f9edd /amd64
parent1cb255cb045d1e531d5e7e6961ac90bb6f7a0474 (diff)
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.
Diffstat (limited to 'amd64')
-rw-r--r--amd64/emit.c9
1 files changed, 8 insertions, 1 deletions
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; p<b->npred; 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;