[llvm-commits] [llvm] r146183 - /llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
Akira Hatanaka
ahatanaka at mips.com
Thu Dec 8 13:05:38 PST 2011
Author: ahatanak
Date: Thu Dec 8 15:05:38 2011
New Revision: 146183
URL: http://llvm.org/viewvc/llvm-project?rev=146183&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=146183&r1=146182&r2=146183&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Thu Dec 8 15:05:38 2011
@@ -1550,19 +1550,26 @@
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;
}
More information about the llvm-commits
mailing list