Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/include/llvm/CodeGen/SelectionDAG.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ class SelectionDAG {
// to provide debug info for the BB at that time, so keep this one around.
LLVM_ABI SDValue getBasicBlock(MachineBasicBlock *MBB);
LLVM_ABI SDValue getExternalSymbol(const char *Sym, EVT VT);
LLVM_ABI SDValue getExternalSymbol(RTLIB::LibcallImpl LCImpl, EVT VT);
LLVM_ABI SDValue getTargetExternalSymbol(const char *Sym, EVT VT,
unsigned TargetFlags = 0);
LLVM_ABI SDValue getMCSymbol(MCSymbol *Sym, EVT VT);
Expand Down
15 changes: 7 additions & 8 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2127,8 +2127,9 @@ SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
bool IsSigned, EVT RetVT) {
EVT CodePtrTy = TLI.getPointerTy(DAG.getDataLayout());
SDValue Callee;
if (const char *LibcallName = TLI.getLibcallName(LC))
Callee = DAG.getExternalSymbol(LibcallName, CodePtrTy);
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
if (LCImpl != RTLIB::Unsupported)
Callee = DAG.getExternalSymbol(LCImpl, CodePtrTy);
else {
Callee = DAG.getPOISON(CodePtrTy);
DAG.getContext()->emitError(Twine("no libcall available for ") +
Expand Down Expand Up @@ -2157,7 +2158,7 @@ SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
bool signExtend = TLI.shouldSignExtendTypeInLibCall(RetTy, IsSigned);
CLI.setDebugLoc(SDLoc(Node))
.setChain(InChain)
.setLibCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee,
.setLibCallee(TLI.getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args))
.setTailCall(isTailCall)
.setSExtResult(signExtend)
Expand Down Expand Up @@ -2392,8 +2393,7 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
}

SDValue Callee =
DAG.getExternalSymbol(TLI.getLibcallImplName(LibcallImpl).data(),
TLI.getPointerTy(DAG.getDataLayout()));
DAG.getExternalSymbol(LibcallImpl, TLI.getPointerTy(DAG.getDataLayout()));

SDLoc dl(Node);
TargetLowering::CallLoweringInfo CLI(DAG);
Expand Down Expand Up @@ -2461,10 +2461,9 @@ SDValue SelectionDAGLegalize::ExpandSincosStretLibCall(SDNode *Node) const {

Type *SincosStretRetTy = FuncTy->getReturnType();
CallingConv::ID CallConv = CallsInfo.getLibcallImplCallingConv(SincosStret);
StringRef LibcallImplName = CallsInfo.getLibcallImplName(SincosStret);

SDValue Callee = DAG.getExternalSymbol(LibcallImplName.data(),
TLI.getProgramPointerTy(DL));
SDValue Callee =
DAG.getExternalSymbol(SincosStret, TLI.getProgramPointerTy(DL));

TargetLowering::ArgListTy Args;
SDValue SRet;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5213,8 +5213,7 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
Entry.IsZExt = false;
Args.push_back(Entry);

SDValue Func =
DAG.getExternalSymbol(TLI.getLibcallImplName(LCImpl).data(), PtrVT);
SDValue Func = DAG.getExternalSymbol(LCImpl, PtrVT);

TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,11 @@ SDValue SelectionDAG::getExternalSymbol(const char *Sym, EVT VT) {
return SDValue(N, 0);
}

SDValue SelectionDAG::getExternalSymbol(RTLIB::LibcallImpl Libcall, EVT VT) {
StringRef SymName = TLI->getLibcallImplName(Libcall);
return getExternalSymbol(SymName.data(), VT);
}

SDValue SelectionDAG::getMCSymbol(MCSymbol *Sym, EVT VT) {
SDNode *&N = MCSymbols[Sym];
if (N)
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ TargetLowering::makeLibCall(SelectionDAG &DAG, RTLIB::LibcallImpl LibcallImpl,
Args.push_back(Entry);
}

SDValue Callee = DAG.getExternalSymbol(getLibcallImplName(LibcallImpl).data(),
getPointerTy(DAG.getDataLayout()));
SDValue Callee =
DAG.getExternalSymbol(LibcallImpl, getPointerTy(DAG.getDataLayout()));

Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
Type *OrigRetTy = RetTy;
Expand Down Expand Up @@ -12261,8 +12261,8 @@ bool TargetLowering::expandMultipleResultFPLibCall(
? Node->getValueType(*CallRetResNo).getTypeForEVT(Ctx)
: Type::getVoidTy(Ctx);
SDValue InChain = StoresInChain ? StoresInChain : DAG.getEntryNode();
SDValue Callee = DAG.getExternalSymbol(getLibcallImplName(LibcallImpl).data(),
getPointerTy(DAG.getDataLayout()));
SDValue Callee =
DAG.getExternalSymbol(LibcallImpl, getPointerTy(DAG.getDataLayout()));
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(DL).setChain(InChain).setLibCallee(
getLibcallImplCallingConv(LibcallImpl), RetType, Callee, std::move(Args));
Expand Down
Loading