thread-local storage for amd64_apple
commit8ecae922997c55f70cd9e19cbf947a520f7ecca3
authorQuentin Carbonneaux <quentin@c9x.me>
Wed, 12 Oct 2022 18:59:20 +0000 (12 20:59 +0200)
committerQuentin Carbonneaux <quentin@c9x.me>
Wed, 12 Oct 2022 19:12:08 +0000 (12 21:12 +0200)
treef75685ee79cc015883b2a60d7a5cbf6c52c751d5
parent577e93fe6d729b63447faad471fd0f5f2296f667
thread-local storage for amd64_apple

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)
amd64/emit.c
amd64/isel.c
arm64/isel.c
test/tls.ssa [new file with mode: 0644]