aboutsummaryrefslogtreecommitdiff
path: root/amd64
AgeCommit message (Collapse)Author
13 daysModify amd64 fixarg to fix calling constant addressesHEADmasterRichard McCormack
On x86_64, direct calls are always PC-relative. This means that in order to call an absolute address, the call must be indirect. To accomplish this, update fixarg to introduce a temporary before emitting.
13 daysifopt simplificationsQuentin Carbonneaux
13 daysIf-conversion RFC 4 - x86 only (for now), use cmovXXRoland Paterson-Jones
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
2025-04-16fix fp constants on big endian hostsQuentin Carbonneaux
2025-03-14gvn/gcm reviewQuentin Carbonneaux
- 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.
2025-03-14Re-use (vgrow) b->ins vector in backend xxx_abi() fn's.Roland Paterson-Jones
Removes last re-allocation of b->ins.
2025-03-14idup(Ins **, Ins *, ulong) -> idup(Blk *, Ins *, ulong)Roland Paterson-Jones
Always used this way and factors setting b->nins. Makes b->ins vector contract more obvious.
2025-03-14Blk::ins is a vectorRoland Paterson-Jones
Scratching an itch - avoid unnecesary re-allocation in idup() which is called often in the optimisation chain. Blk::ins is reallocated in xxx_abi() - needs further fiddling.
2024-08-23skip preludes for some leaf fnsQuentin Carbonneaux
When rbp is not necessary to compile a leaf function, we skip saving and restoring it.
2024-06-19drop imul rewritingQuentin Carbonneaux
This was cute to do, but it is largely inconsequential, as shown by the rough timings below: benchmarking mul8_lea 3.9 ticks ± 0.88 (min: 3) benchmarking mul8_imul 3.3 ticks ± 0.27 (min: 3) benchmarking div8_udiv 6.5 ticks ± 0.52 (min: 6) benchmarking div8_shr 3.3 ticks ± 0.34 (min: 3)
2024-06-18cheaper mul by small constants on amd64Quentin Carbonneaux
2024-06-16fix unintended assignmentQuentin Carbonneaux
2024-06-16revert 4bc4c958Quentin Carbonneaux
Hopefully the right time now!
2024-05-28replace asm keywordErica Z
when applying a custom set of CFLAGS under clang that does not include -std=c99, asm is treated as a keyword and as such can not be used as an identifier. this prevents the issue by renaming the offending variables.
2024-04-22revert 1b7770e271Quentin Carbonneaux
Quotes are used on Apple target variants to flag that we must not add the _ symbol prefix.
2024-04-11fold scaled offsets in addressesQuentin Carbonneaux
2024-04-11drop over-zealous offset accumulationQuentin Carbonneaux
2024-04-09use mgen in amd64/isel.cQuentin Carbonneaux
2024-03-26Drop quotes around floating point constant labelsMichael Forney
This is incompatible with binutils gas older than 2.26.
2024-01-02dbgloc: add column argumentDrew DeVault
dbgloc line [col] This is implemented in a backwards-compatible manner.
2024-01-02revert 5af33410Quentin Carbonneaux
Causes errors with stock toolchain on OpenBSD.
2023-12-30Fix IBT/BTI by instrumenting function callsTobias Heider
2023-08-28comments in amd64 iselQuentin Carbonneaux
2023-08-26Fix conversion from float/double to unsigned intMichael Forney
signed int can't represent all the values of unsigned int, so we need to do the conversion to signed long, and use the lower 32 bits as the result.
2023-08-18file,loc become dbgfile,dbglocQuentin Carbonneaux
2023-06-06implement line number info trackingThomas Bracht Laumann Jespersen
Support "file" and "loc" directives. "file" takes a string (a file name) assigns it a number, sets the current file to that number and records the string for later. "loc" takes a single number and outputs location information with a reference to the current file.
2023-04-02amd64_apple: one more thread-local symbols fixQuentin Carbonneaux
We now treat thread-local symbols in Mems properly.
2023-04-02amd64_apple: support thread-local addressesQuentin Carbonneaux
Non-store/load instructions were not lowered correctly for thread- local symbols. This is an attempt at a fix (cannot test for now).
2023-04-02amd64_sysv: fix offsets in thread-local OaddrQuentin Carbonneaux
2023-04-02amd64_sysv: thread-local support in OaddrQuentin Carbonneaux
Thanks to Lassi Pulkkinen for flagging the issue and pointing me to Ulrich Drepper's extensive doc [1]. [1] https://people.redhat.com/drepper/tls.pdf
2023-03-22rename blknew() to newblk()Quentin Carbonneaux
This is consistent with newtmp() and newcon().
2023-03-19naming nitQuentin Carbonneaux
2023-03-16silence format warning more reliablyQuentin Carbonneaux
2023-03-15silence some warningsQuentin Carbonneaux
2022-12-25new UNDEF RefQuentin Carbonneaux
Crashing loads of uninitialized memory proved to be a problem when implementing unions using qbe. This patch introduces a new UNDEF Ref to represent data that is known to be uninitialized. Optimization passes can make use of it to eliminate some code. In the last compilation stages, UNDEF is treated as the constant 0xdeaddead.
2022-12-14new blit instructionQuentin Carbonneaux
2022-12-12new rsval() helper for signed RefsQuentin Carbonneaux
The .val field is signed in RSlot. Add a new dedicated function to fetch it as a signed int.
2022-11-27new hlt block terminatorQuentin Carbonneaux
It is handy to express when the end of a block cannot be reached. If a hlt terminator is executed, it traps the program. We don't go the llvm way and specify execution semantics as undefined behavior.
2022-11-22use a new struct for symbolsQuentin Carbonneaux
Symbols are a useful abstraction that occurs in both Con and Alias. In this patch they get their own struct. This new struct packages a symbol name and a type; the type tells us where the symbol name must be interpreted (currently, in gobal memory or in thread-local storage). The refactor fixed a bug in addcon(), proving the value of packaging symbol names with their type.
2022-10-12thread-local storage for amd64_appleQuentin Carbonneaux
It is quite similar to arm64_apple. Probably, the call that needs to be generated also provides extra invariants on top of the regular abi, but I have not checked that. Clang generates code that is a bit neater than qbe's because, on x86, a load can be fused in a call instruction! We do not bother with supporting these since we expect only sporadic use of the feature. For reference, here is what clang might output for a store to the second entry of a thread-local array of ints: movq _x@TLVP(%rip), %rdi callq *(%rdi) movl %ecx, 4(%rax)
2022-10-08mark apple targets with a booleanQuentin Carbonneaux
It is more natural to branch on a flag than have different function pointers for high-level passes.
2022-10-08"rel" fields become "reloc"Quentin Carbonneaux
2022-10-08add support for thread-local storageQuentin Carbonneaux
The apple targets are not done yet.
2022-10-03fix case of Pool constantsQuentin Carbonneaux
2022-10-03add new target-specific abi0 passQuentin Carbonneaux
The general idea is to give abis a chance to talk before we've done all the optimizations. Currently, all targets eliminate {par,arg,ret}{sb,ub,...} during this pass. The forthcoming arm64_apple will, however, insert proper extensions during abi0. Moving forward abis can, for example, lower small-aggregates passing there so that memory optimizations can interact better with function calls.
2022-08-31drop -G flag and add target amd64_appleQuentin Carbonneaux
apple support is more than assembly syntax in case of arm64 machines, and apple syntax is currently useless in all cases but amd64; rather than having a -G option that only makes sense with amd64, we add a new target amd64_apple
2022-06-14do not fold cnst+cnst in amd64's iselQuentin Carbonneaux
This may cause invalid assembly to be generated and is not all that useful anyway after constant folding has run.
2022-03-17amd64: restore previous name of amd64_sysv targetMichael Forney
2022-03-15new -t? flag to print default targetQuentin Carbonneaux
2022-03-14dynamic stack allocs for arm64Quentin Carbonneaux
I also moved some isel logic that would have been repeated a third time in util.c.