[AIX][TLS] Generate 32-bit general-dynamic access code sequence
authorNemanja Ivanovic <nemanja.i.ibm@gmail.com>
Thu, 4 Mar 2021 14:07:22 +0000 (08:07 -0600)
committerLei Huang <lei@ca.ibm.com>
Mon, 8 Mar 2021 15:30:19 +0000 (09:30 -0600)
commitb0f0115308e4e8692b254c3b0e20f3743616b2d5
tree22c4057ed7fee6bd20087fe2431ccd9e6d173e72
parent60d4c73b30a0e324c6ae314722eb036f70f4b03a
[AIX][TLS] Generate 32-bit general-dynamic access code sequence

Adds support for the TLS general dynamic access model to
assembly files on AIX 32-bit.

To generate the correct code sequence when accessing a TLS variable
`v`, we first create two TOC entry nodes, one for the variable offset, one
for the region handle. These nodes are followed by a `PPCISD::TLSGD_AIX`
node (new node introduced by this patch).
The `PPCISD::TLSGD_AIX` node (`TLSGDAIX` pseudo instruction) is
expanded to 2 copies (to put the variable offset and region handle in
the right registers) and a call to `__tls_get_addr`.

This patch also changes the way TC entries are generated in asm files.
If the generated TC entry is for the region handle of a TLS variable,
we add the `@m` relocation and the `.` prefix to the entry name.
For example:

```
L..C0:
  .tc .v[TC],v[TL]@m -> region handle
L..C1:
  .tc v[TC],v[TL] -> variable offset
```

Reviewed By: nemanjai, sfertile

Differential Revision: https://reviews.llvm.org/D97948
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Target/PowerPC/PPCInstrInfo.td
llvm/lib/Target/PowerPC/PPCTLSDynamicCall.cpp
llvm/lib/Target/PowerPC/PPCTargetStreamer.h
llvm/test/CodeGen/PowerPC/aix-tls-checks.ll
llvm/test/CodeGen/PowerPC/aix-tls-gd-double.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/aix-tls-gd-int.ll [new file with mode: 0644]
llvm/test/CodeGen/PowerPC/aix-tls-gd-longlong.ll [new file with mode: 0644]