aboutsummaryrefslogtreecommitdiffhomepage
path: root/x86_64/emit.c
Commit message (Collapse)AuthorAgeFilesLines
* backend: unify pass memory allocation strategies lemon2025-12-201-5/+1
| | | | | | It was all over the place for temporary data structures used by individual passes. Now there is an arena specifically for that, which is nicer.
* emit: fix errata in flagslivep() lemon2025-12-201-1/+1
| | | | This little typo inhibited a small optimization. Oops
* x86-64: peephole optimization for 3-address shift -> lea lemon2025-12-201-1/+14
|
* x86-64/emit: remove some superfluous rex.W prefixes lemon2025-12-181-2/+2
|
* regalloc+emit: get rid of xsave/xrestore hack lemon2025-12-181-6/+0
| | | | | | | Was used for situation where we needed to spill more than 1 temporary and have to use a register that is already used. Instead of push/pop, we can just allocate and set aside specific stack slots for this purpose. Also, reworked linearscan() interval sets to separate FPR/GPR intervals.
* x86_64: for vararg calls, write to EAX in isel lemon2025-12-181-10/+0
| | | | Also, in regalloc ensure fixed intervals are sorted
* emit: don't put the exit block always at the end of the function lemon2025-12-171-1/+6
|
* x86-64/emit: implement single-exit-point ret with jump threading lemon2025-12-161-25/+37
|
* create distinct interned string type lemon2025-12-151-3/+3
| | | | | | | | | | | | | | Interned strings are used pervasively, so it's a good idea to add a layer of type safety to differentiate them from general cstrs and avoid potential bugs from comparing non-interned and interned strings. Not that that's happened so far that I can remember, but it could. I'm 90% sure it's legal to alias `struct {char c;}` pointers with `char` pointers. This specific typedef gives type safety but with a simple one-way `internstr -> const char *` typecast (with `&istr->c`). Converting the other way around is more intentional: a straight up cast `(internstr)cstr` which sticks out as unchecked and probably wrong, or calling the intern(cstr) function, which is the right way.
* x86_64/emit: handle pseudo subtraction used for cmp lemon2025-12-141-0/+2
| | | | Isel had this forever, but the matching code for it in emit wasn't there
* various relocation related optimization lemon2025-12-141-16/+29
| | | | | | | | | | With 59ca5a8db, querying if a symbol is defined is cheap. If we're compiling code that calls foo() and we defined foo() in this compilation unit, we already know its offset within the .text section, so use it instead of emitting a relocation for the linker to handle. Also, put small literal data in the .text section instead of .rodata. This seems to improve performance (cache locality?), and as a bonus, it will be good for aarch64's instr encoding with smallish PC-relative offsets.
* fix position independent loads of function symbols. lemon2025-12-131-6/+8
| | | | | | | | For `extern int x[1];`, can use PCREL32 for &x. But for `extern int x(int)`, must use GOTREL, when not being called directly (that's PLT). Therefore the type of an external symbol (actually just whether it denotes a function) matters when deciding what kind of relocation to emit, so keep that information.
* x86-64/emit errata lemon2025-12-121-7/+4
|
* x86_64: fix erroneous encoding of index reg in no-pie situations lemon2025-12-121-11/+1
|
* s/amd64/x86_64/ lemon2025-12-121-0/+1388