aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/Mips
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2012-05-04 09:40:39 +0000
committerHans Wennborg <hans@hanshq.net>2012-05-04 09:40:39 +0000
commitfd5abd546e8e035755005a654d60d6f5f74cfe2c (patch)
tree16e718f75d032b46c3ce2492ec3e1c1768ccbdb6 /lib/Target/Mips
parent31a207a3b748261e3556328bd8a80a75ffbb698d (diff)
downloadexternal_llvm-fd5abd546e8e035755005a654d60d6f5f74cfe2c.zip
external_llvm-fd5abd546e8e035755005a654d60d6f5f74cfe2c.tar.gz
external_llvm-fd5abd546e8e035755005a654d60d6f5f74cfe2c.tar.bz2
Make ARM and Mips use TargetMachine::getTLSModel()
This moves the logic for selecting a TLS model to a single place, instead of the previous three (ARM, Mips, and X86 which already uses this function). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156162 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips')
-rw-r--r--lib/Target/Mips/MipsISelLowering.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp
index dca7680..fc03ac5 100644
--- a/lib/Target/Mips/MipsISelLowering.cpp
+++ b/lib/Target/Mips/MipsISelLowering.cpp
@@ -1614,7 +1614,9 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
const GlobalValue *GV = GA->getGlobal();
EVT PtrVT = getPointerTy();
- if (getTargetMachine().getRelocationModel() == Reloc::PIC_) {
+ TLSModel::Model model = getTargetMachine().getTLSModel(GV);
+
+ if (model == TLSModel::GeneralDynamic || model == TLSModel::LocalDynamic) {
// General Dynamic TLS Model
bool LocalDynamic = GV->hasInternalLinkage();
unsigned Flag = LocalDynamic ? MipsII::MO_TLSLDM :MipsII::MO_TLSGD;
@@ -1641,7 +1643,7 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
SDValue Ret = CallResult.first;
- if (!LocalDynamic)
+ if (model != TLSModel::LocalDynamic)
return Ret;
SDValue TGAHi = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
@@ -1655,7 +1657,7 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
}
SDValue Offset;
- if (GV->isDeclaration()) {
+ if (model == TLSModel::InitialExec) {
// Initial Exec TLS Model
SDValue TGA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
MipsII::MO_GOTTPREL);
@@ -1666,6 +1668,7 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
false, false, false, 0);
} else {
// Local Exec TLS Model
+ assert(model == TLSModel::LocalExec);
SDValue TGAHi = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
MipsII::MO_TPREL_HI);
SDValue TGALo = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,