diff options
| author | Roland Paterson-Jones <[email protected]> | 2024-10-23 14:51:53 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2026-01-13 18:11:30 +0100 |
| commit | 5c1eb24e2c312021c7af4316e5adde53e270311a (patch) | |
| tree | e661a5d0c58d58c0f7fb8fc84dba575a800cc646 /all.h | |
| parent | 72010791374d3be2ab21ee5ca1146fce2382d88b (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 'all.h')
| -rw-r--r-- | all.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -62,6 +62,7 @@ struct Target { void (*emitfin)(FILE *); char asloc[4]; char assym[4]; + uint cansel:1; }; #define BIT(n) ((bits)1 << (n)) @@ -183,6 +184,8 @@ enum { Oalloc1 = Oalloc16, Oflag = Oflagieq, Oflag1 = Oflagfuo, + Oxsel = Oxselieq, + Oxsel1 = Oxselfuo, NPubOp = Onop, Jjf = Jjfieq, Jjf1 = Jjffuo, @@ -199,6 +202,7 @@ enum { #define isparbh(o) INRANGE(o, Oparsb, Oparuh) #define isargbh(o) INRANGE(o, Oargsb, Oarguh) #define isretbh(j) INRANGE(j, Jretsb, Jretuh) +#define isxsel(o) INRANGE(o, Oxsel, Oxsel1) enum { Kx = -1, /* "top" class (see usecheck() and clsmerge()) */ @@ -482,7 +486,7 @@ void *vnew(ulong, size_t, Pool); void vfree(void *); void vgrow(void *, ulong); void addins(Ins **, uint *, Ins *); -void addbins(Blk *, Ins **, uint *); +void addbins(Ins **, uint *, Blk *); void strf(char[NString], char *, ...); uint32_t intern(char *); char *str(uint32_t); @@ -555,6 +559,7 @@ void fillloop(Fn *); void simpljmp(Fn *); int reaches(Fn *, Blk *, Blk *); int reachesnotvia(Fn *, Blk *, Blk *, Blk *); +int ifgraph(Blk *, Blk **, Blk **, Blk **); /* mem.c */ void promote(Fn *); @@ -595,6 +600,9 @@ void gvn(Fn *); int pinned(Ins *); void gcm(Fn *); +/* ifopt.c */ +void ifconvert(Fn *fn); + /* simpl.c */ void simpl(Fn *); |
