summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsISelLowering.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2011-12-08 21:05:38 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2011-12-08 21:05:38 +0000
commitf10ee84956d867e420c0f2e3c8b0d924e7b13746 (patch)
tree6e5932a6d4519a57fb07497ace3479496a164871 /llvm/lib/Target/Mips/MipsISelLowering.cpp
parentab9c8bb45b7c53e7333028c9bb7df1de38899ffb (diff)
downloadbcm5719-llvm-f10ee84956d867e420c0f2e3c8b0d924e7b13746.tar.gz
bcm5719-llvm-f10ee84956d867e420c0f2e3c8b0d924e7b13746.zip
Pass a GlobalAddress instead of an ExternalSymbol to LowerCallTo in
MipsTargetLowering::LowerGlobalTLSAddress. This is necessary to have call16(__tls_get_addr) emitted instead of got_disp(__tls_get_addr) when the target is Mips64. llvm-svn: 146183
Diffstat (limited to 'llvm/lib/Target/Mips/MipsISelLowering.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsISelLowering.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 20feb71316f..c888cfc4cab 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -1550,19 +1550,26 @@ LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const
SDValue TGA = DAG.getTargetGlobalAddress(GV, dl, PtrVT,
0, MipsII::MO_TLSGD);
SDValue Argument = DAG.getNode(MipsISD::WrapperPIC, dl, PtrVT, TGA);
+ unsigned PtrSize = PtrVT.getSizeInBits();
+ IntegerType *PtrTy = Type::getIntNTy(*DAG.getContext(), PtrSize);
+
+ SmallVector<Type*, 1> Params;
+ Params.push_back(PtrTy);
+ FunctionType *FuncTy = FunctionType::get(PtrTy, Params, false);
+ Function *Func = Function::Create(FuncTy, GlobalValue::ExternalLinkage,
+ "__tls_get_addr");
+ SDValue TlsGetAddr = DAG.getGlobalAddress(Func, dl, PtrVT);
ArgListTy Args;
ArgListEntry Entry;
Entry.Node = Argument;
- unsigned PtrSize = PtrVT.getSizeInBits();
- IntegerType *PtrTy = Type::getIntNTy(*DAG.getContext(), PtrSize);
Entry.Ty = PtrTy;
Args.push_back(Entry);
+
std::pair<SDValue, SDValue> CallResult =
LowerCallTo(DAG.getEntryNode(), PtrTy,
false, false, false, false, 0, CallingConv::C, false, true,
- DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG,
- dl);
+ TlsGetAddr, Args, DAG, dl);
return CallResult.first;
}
OpenPOWER on IntegriCloud