aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
diff options
context:
space:
mode:
authorFelix (Ting Wang) <Ting.Wang.SH@ibm.com>2024-04-12 08:18:01 +0800
committerGitHub <noreply@github.com>2024-04-12 08:18:01 +0800
commit09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0 (patch)
tree8fd744c659f86c435238aba0e6047a085687426d /llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
parentbf1d7b8df287d69ee265b91be40dec37267b2d5c (diff)
downloadllvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.zip
llvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.tar.gz
llvm-09d51a841dcfbc41c3d7f3274b109b5f9fb09bb0.tar.bz2
[PowerPC][AIX] Enable aix-small-local-dynamic-tls target attribute (#86641)
Following the aix-small-local-exec-tls target attribute, this patch adds a target attribute for an AIX-specific option in llc that informs the compiler that it can use a faster access sequence for the local-dynamic TLS model (formally named aix-small-local-dynamic-tls) when TLS variables are less than ~32KB in size. The patch either produces an addi/la with a displacement off of module handle (return value from .__tls_get_mod) when the address is calculated, or it produces an addi/la followed by a load/store when the address is calculated and used for further accesses. --------- Co-authored-by: Amy Kwan <amy.kwan1@ibm.com>
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCMCInstLower.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCMCInstLower.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
index 9a3ca5a..c05bb37 100644
--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
@@ -96,15 +96,18 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol,
RefKind = MCSymbolRefExpr::VK_PPC_GOT_TLSLD_PCREL;
else if (MO.getTargetFlags() == PPCII::MO_GOT_TPREL_PCREL_FLAG)
RefKind = MCSymbolRefExpr::VK_PPC_GOT_TPREL_PCREL;
- else if (MO.getTargetFlags() == PPCII::MO_TPREL_FLAG) {
+ else if (MO.getTargetFlags() == PPCII::MO_TPREL_FLAG ||
+ MO.getTargetFlags() == PPCII::MO_TLSLD_FLAG) {
assert(MO.isGlobal() && "Only expecting a global MachineOperand here!");
TLSModel::Model Model = TM.getTLSModel(MO.getGlobal());
- // For the local-exec TLS model, we may generate the offset from the TLS
- // base as an immediate operand (instead of using a TOC entry).
- // Set the relocation type in case the result is used for purposes other
- // than a TOC reference. In TOC reference cases, this result is discarded.
+ // For the local-[exec|dynamic] TLS model, we may generate the offset from
+ // the TLS base as an immediate operand (instead of using a TOC entry). Set
+ // the relocation type in case the result is used for purposes other than a
+ // TOC reference. In TOC reference cases, this result is discarded.
if (Model == TLSModel::LocalExec)
RefKind = MCSymbolRefExpr::VK_PPC_AIX_TLSLE;
+ else if (Model == TLSModel::LocalDynamic)
+ RefKind = MCSymbolRefExpr::VK_PPC_AIX_TLSLD;
}
const MachineInstr *MI = MO.getParent();