[llvm] [PowerPC] Support local-dynamic TLS relocation on AIX (PR #66316)
Ting Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 23:55:09 PDT 2023
================
@@ -660,15 +671,17 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI,
"GETtls[ld]ADDR[32] must read GPR3");
if (Subtarget->isAIXABI()) {
- // On AIX, the variable offset should already be in R4 and the region handle
- // should already be in R3.
- // For TLSGD, which currently is the only supported access model, we only
- // need to generate an absolute branch to .__tls_get_addr.
+ // On AIX, for TLSGD the variable offset should already be in R4 and the
+ // region handle should already be in R3, need to generate an absolute
+ // branch to .__tls_get_addr. For TLSLD the module handle should already be
+ // in R3, need to generate branch to .__tls_get_mod.
Register VarOffsetReg = Subtarget->isPPC64() ? PPC::X4 : PPC::R4;
(void)VarOffsetReg;
- assert(MI->getOperand(2).isReg() &&
- MI->getOperand(2).getReg() == VarOffsetReg &&
- "GETtls[ld]ADDR[32] must read GPR4");
+ assert(MI->getOpcode() == PPC::GETtlsMOD32AIX ||
+ MI->getOpcode() == PPC::GETtlsMOD64AIX ||
+ (MI->getOperand(2).isReg() &&
+ MI->getOperand(2).getReg() == VarOffsetReg) &&
+ "GETtls[ld]ADDR[32] must read GPR4");
----------------
orcguru wrote:
To be honest, I looked up the C operator precedence. My intention here is to skip the assert check for those two opcodes. On the other hand, I think to be a good programmer for LLVM, maybe I should follow your suggestion since I didn't find similar usage like this...
https://github.com/llvm/llvm-project/pull/66316
More information about the llvm-commits
mailing list