aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRoland Paterson-Jones <[email protected]>2024-10-23 14:51:53 +0200
committerQuentin Carbonneaux <[email protected]>2026-01-13 18:11:30 +0100
commit5c1eb24e2c312021c7af4316e5adde53e270311a (patch)
treee661a5d0c58d58c0f7fb8fc84dba575a800cc646 /main.c
parent72010791374d3be2ab21ee5ca1146fce2382d88b (diff)
If-conversion RFC 4 - x86 only (for now), use cmovXX
Replacement of tiny conditional jump graphlets with conditional move instructions. Currently enabled only for x86. Arm64 support using cselXX will be essentially identical. Adds (internal) frontend sel0/sel1 ops with flag-specific backend xselXX following jnz implementation pattern. Testing: standard QBE, cproc, harec, hare, roland
Diffstat (limited to 'main.c')
-rw-r--r--main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main.c b/main.c
index 7a97f8a..f7180ce 100644
--- a/main.c
+++ b/main.c
@@ -11,6 +11,7 @@ char debug['Z'+1] = {
['N'] = 0, /* ssa construction */
['C'] = 0, /* copy elimination */
['F'] = 0, /* constant folding */
+ ['K'] = 0, /* if-conversion */
['A'] = 0, /* abi lowering */
['I'] = 0, /* instruction selection */
['L'] = 0, /* liveness */
@@ -81,6 +82,13 @@ func(Fn *fn)
gcm(fn);
filluse(fn);
ssacheck(fn);
+ if (T.cansel) {
+ ifconvert(fn);
+ fillcfg(fn);
+ filluse(fn);
+ filldom(fn);
+ ssacheck(fn);
+ }
T.abi1(fn);
simpl(fn);
fillcfg(fn);