DAG: Avoid querying libcall info from TargetLowering (#176268)

Libcall lowering decisions should come from the LibcallLoweringInfo
analysis. Query this through the DAG, so eventually the source
can be the analysis. For the moment this is just a wrapper around
the TargetLowering information.
This commit is contained in:
Matt Arsenault 2026-01-16 10:02:49 +01:00 committed by GitHub
parent 70633659c5
commit 01e6245af4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 184 additions and 140 deletions

View File

@ -231,6 +231,9 @@ class SelectionDAG {
const SelectionDAGTargetInfo *TSI = nullptr;
const TargetLowering *TLI = nullptr;
const TargetLibraryInfo *LibInfo = nullptr;
const RTLIB::RuntimeLibcallsInfo *RuntimeLibcallInfo = nullptr;
const LibcallLoweringInfo *Libcalls = nullptr;
const FunctionVarLocs *FnVarLocs = nullptr;
MachineFunction *MF;
MachineFunctionAnalysisManager *MFAM = nullptr;
@ -469,16 +472,19 @@ public:
/// Prepare this SelectionDAG to process code in the given MachineFunction.
LLVM_ABI void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
Pass *PassPtr, const TargetLibraryInfo *LibraryInfo,
const LibcallLoweringInfo *LibcallsInfo,
UniformityInfo *UA, ProfileSummaryInfo *PSIin,
BlockFrequencyInfo *BFIin, MachineModuleInfo &MMI,
FunctionVarLocs const *FnVarLocs);
void init(MachineFunction &NewMF, OptimizationRemarkEmitter &NewORE,
MachineFunctionAnalysisManager &AM,
const TargetLibraryInfo *LibraryInfo, UniformityInfo *UA,
const TargetLibraryInfo *LibraryInfo,
const LibcallLoweringInfo *LibcallsInfo, UniformityInfo *UA,
ProfileSummaryInfo *PSIin, BlockFrequencyInfo *BFIin,
MachineModuleInfo &MMI, FunctionVarLocs const *FnVarLocs) {
init(NewMF, NewORE, nullptr, LibraryInfo, UA, PSIin, BFIin, MMI, FnVarLocs);
init(NewMF, NewORE, nullptr, LibraryInfo, LibcallsInfo, UA, PSIin, BFIin,
MMI, FnVarLocs);
MFAM = &AM;
}
@ -503,6 +509,13 @@ public:
}
const TargetLowering &getTargetLoweringInfo() const { return *TLI; }
const TargetLibraryInfo &getLibInfo() const { return *LibInfo; }
const LibcallLoweringInfo &getLibcalls() const { return *Libcalls; }
const RTLIB::RuntimeLibcallsInfo &getRuntimeLibcallInfo() const {
return *RuntimeLibcallInfo;
}
const SelectionDAGTargetInfo &getSelectionDAGInfo() const { return *TSI; }
const UniformityInfo *getUniformityInfo() const { return UA; }
/// Returns the result of the AssignmentTrackingAnalysis pass if it's

View File

@ -46,7 +46,7 @@ class SelectionDAGISel {
public:
TargetMachine &TM;
const TargetLibraryInfo *LibInfo;
const RTLIB::RuntimeLibcallsInfo *RuntimeLibCallInfo;
std::unique_ptr<FunctionLoweringInfo> FuncInfo;
std::unique_ptr<SwiftErrorValueTracking> SwiftError;
MachineFunction *MF;

View File

@ -3627,6 +3627,8 @@ public:
return RuntimeLibcallInfo;
}
const LibcallLoweringInfo &getLibcallLoweringInfo() const { return Libcalls; }
void setLibcallImpl(RTLIB::Libcall Call, RTLIB::LibcallImpl Impl) {
Libcalls.setLibcallImpl(Call, Impl);
}
@ -3860,6 +3862,7 @@ private:
const RTLIB::RuntimeLibcallsInfo RuntimeLibcallInfo;
/// The list of libcalls that the target will use.
/// FIXME: This should not live here; it should come from an analysis.
LibcallLoweringInfo Libcalls;
/// The bits of IndexedModeActions used to store the legalisation actions

View File

@ -4996,7 +4996,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitMUL(SDNode *N) {
/// Return true if divmod libcall is available.
static bool isDivRemLibcallAvailable(SDNode *Node, bool isSigned,
const TargetLowering &TLI) {
const SelectionDAG &DAG) {
RTLIB::Libcall LC;
EVT NodeType = Node->getValueType(0);
if (!NodeType.isSimple())
@ -5010,7 +5010,7 @@ static bool isDivRemLibcallAvailable(SDNode *Node, bool isSigned,
case MVT::i128: LC= isSigned ? RTLIB::SDIVREM_I128:RTLIB::UDIVREM_I128; break;
}
return TLI.getLibcallImpl(LC) != RTLIB::Unsupported;
return DAG.getLibcalls().getLibcallImpl(LC) != RTLIB::Unsupported;
}
/// Issue divrem if both quotient and remainder are needed.
@ -5033,7 +5033,7 @@ SDValue DAGCombiner::useDivRem(SDNode *Node) {
// If DIVREM is going to get expanded into a libcall,
// but there is no libcall available, then don't combine.
if (!TLI.isOperationLegalOrCustom(DivRemOpc, VT) &&
!isDivRemLibcallAvailable(Node, isSigned, TLI))
!isDivRemLibcallAvailable(Node, isSigned, DAG))
return SDValue();
// If div is legal, it's better to do the normal expansion

View File

@ -2132,7 +2132,7 @@ SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
bool IsSigned, EVT RetVT) {
EVT CodePtrTy = TLI.getPointerTy(DAG.getDataLayout());
SDValue Callee;
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl != RTLIB::Unsupported)
Callee = DAG.getExternalSymbol(LCImpl, CodePtrTy);
else {
@ -2163,8 +2163,8 @@ SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
bool signExtend = TLI.shouldSignExtendTypeInLibCall(RetTy, IsSigned);
CLI.setDebugLoc(SDLoc(Node))
.setChain(InChain)
.setLibCallee(TLI.getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args))
.setLibCallee(DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy,
Callee, std::move(Args))
.setTailCall(isTailCall)
.setSExtResult(signExtend)
.setZExtResult(!signExtend)
@ -2258,7 +2258,7 @@ void SelectionDAGLegalize::ExpandFastFPLibCall(
Call_F128.first, Call_PPCF128.first);
}
if (!IsFast || TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
if (!IsFast || DAG.getLibcalls().getLibcallImpl(LC) == RTLIB::Unsupported) {
// Fall back if we don't have a fast implementation.
LC = RTLIB::getFPLibCall(VT, Call_F32.second, Call_F64.second,
Call_F80.second, Call_F128.second,
@ -2387,7 +2387,7 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
Entry.IsZExt = !isSigned;
Args.push_back(Entry);
RTLIB::LibcallImpl LibcallImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LibcallImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LibcallImpl == RTLIB::Unsupported) {
DAG.getContext()->emitError(Twine("no libcall available for ") +
Node->getOperationName(&DAG));
@ -2404,8 +2404,8 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(InChain)
.setLibCallee(TLI.getLibcallImplCallingConv(LibcallImpl), RetTy, Callee,
std::move(Args))
.setLibCallee(DAG.getLibcalls().getLibcallImplCallingConv(LibcallImpl),
RetTy, Callee, std::move(Args))
.setSExtResult(isSigned)
.setZExtResult(!isSigned);
@ -2422,10 +2422,12 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
}
/// Return true if sincos or __sincos_stret libcall is available.
static bool isSinCosLibcallAvailable(SDNode *Node, const TargetLowering &TLI) {
static bool isSinCosLibcallAvailable(SDNode *Node,
const LibcallLoweringInfo &Libcalls) {
MVT::SimpleValueType VT = Node->getSimpleValueType(0).SimpleTy;
return TLI.getLibcallImpl(RTLIB::getSINCOS(VT)) != RTLIB::Unsupported ||
TLI.getLibcallImpl(RTLIB::getSINCOS_STRET(VT)) != RTLIB::Unsupported;
return Libcalls.getLibcallImpl(RTLIB::getSINCOS(VT)) != RTLIB::Unsupported ||
Libcalls.getLibcallImpl(RTLIB::getSINCOS_STRET(VT)) !=
RTLIB::Unsupported;
}
/// Only issue sincos libcall if both sin and cos are needed.
@ -2451,7 +2453,7 @@ SDValue SelectionDAGLegalize::ExpandSincosStretLibCall(SDNode *Node) const {
SDValue Arg = Node->getOperand(0);
EVT ArgVT = Arg.getValueType();
RTLIB::Libcall LC = RTLIB::getSINCOS_STRET(ArgVT);
RTLIB::LibcallImpl SincosStret = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl SincosStret = DAG.getLibcalls().getLibcallImpl(LC);
if (SincosStret == RTLIB::Unsupported)
return SDValue();
@ -3878,7 +3880,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
// Turn fsin / fcos into ISD::FSINCOS node if there are a pair of fsin /
// fcos which share the same operand and both are used.
if ((TLI.isOperationLegal(ISD::FSINCOS, VT) ||
isSinCosLibcallAvailable(Node, TLI)) &&
isSinCosLibcallAvailable(Node, DAG.getLibcalls())) &&
useSinCos(Node)) {
SDVTList VTs = DAG.getVTList(VT, VT);
Tmp1 = DAG.getNode(ISD::FSINCOS, dl, VTs, Node->getOperand(0));
@ -3894,7 +3896,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
RTLIB::Libcall LC = RTLIB::getLDEXP(VT);
// Use the LibCall instead, it is very likely faster
// FIXME: Use separate LibCall action.
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported)
if (DAG.getLibcalls().getLibcallImpl(LC) != RTLIB::Unsupported)
break;
if (SDValue Expanded = expandLdexp(Node)) {
@ -3909,7 +3911,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
RTLIB::Libcall LC = RTLIB::getFREXP(Node->getValueType(0));
// Use the LibCall instead, it is very likely faster
// FIXME: Use separate LibCall action.
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported)
if (DAG.getLibcalls().getLibcallImpl(LC) != RTLIB::Unsupported)
break;
if (SDValue Expanded = expandFrexp(Node)) {
@ -3919,7 +3921,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
break;
}
case ISD::FSINCOS: {
if (isSinCosLibcallAvailable(Node, TLI))
if (isSinCosLibcallAvailable(Node, DAG.getLibcalls()))
break;
EVT VT = Node->getValueType(0);
SDValue Op = Node->getOperand(0);
@ -4717,7 +4719,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
RTLIB::Libcall LC = RTLIB::getOUTLINE_ATOMIC(Opc, Order, VT);
EVT RetVT = Node->getValueType(0);
SmallVector<SDValue, 4> Ops;
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported) {
if (DAG.getLibcalls().getLibcallImpl(LC) != RTLIB::Unsupported) {
// If outline atomic available, prepare its arguments and expand.
Ops.append(Node->op_begin() + 2, Node->op_end());
Ops.push_back(Node->getOperand(1));
@ -4983,7 +4985,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
case ISD::STRICT_FPOWI: {
RTLIB::Libcall LC = RTLIB::getPOWI(Node->getSimpleValueType(0));
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi.");
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
if (DAG.getLibcalls().getLibcallImpl(LC) == RTLIB::Unsupported) {
// Some targets don't have a powi libcall; use pow instead.
if (Node->isStrictFPOpcode()) {
SDValue Exponent =

View File

@ -744,7 +744,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_ExpOp(SDNode *N) {
RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0))
: RTLIB::getLDEXP(N->getValueType(0));
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi.");
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
if (DAG.getLibcalls().getLibcallImpl(LC) == RTLIB::Unsupported) {
// Some targets don't have a powi libcall; use pow instead.
// FIXME: Implement this if some target needs it.
DAG.getContext()->emitError("do not know how to soften fpowi to fpow");
@ -829,7 +829,7 @@ bool DAGTypeLegalizer::SoftenFloatRes_UnaryWithTwoFPResults(
assert(VT == N->getValueType(1) &&
"expected both return values to have the same type");
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl == RTLIB::Unsupported)
return false;
@ -891,8 +891,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSINCOS(SDNode *N) {
RTLIB::Libcall CosLC = RTLIB::getCOS(VT);
SDValue SoftSin, SoftCos;
if (TLI.getLibcallImpl(SinLC) == RTLIB::Unsupported ||
TLI.getLibcallImpl(CosLC) == RTLIB::Unsupported) {
if (DAG.getLibcalls().getLibcallImpl(SinLC) == RTLIB::Unsupported ||
DAG.getLibcalls().getLibcallImpl(CosLC) == RTLIB::Unsupported) {
DAG.getContext()->emitError("do not know how to soften fsincos");
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);

View File

@ -2752,7 +2752,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0))
: RTLIB::getLDEXP(N->getValueType(0));
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl == RTLIB::Unsupported) {
// Scalarize vector FPOWI instead of promoting the type. This allows the
// scalar FPOWIs to be visited and converted to libcalls before promoting
@ -3255,7 +3255,7 @@ std::pair <SDValue, SDValue> DAGTypeLegalizer::ExpandAtomic(SDNode *Node) {
TargetLowering::MakeLibCallOptions CallOptions;
SmallVector<SDValue, 4> Ops;
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl != RTLIB::Unsupported) {
Ops.append(Node->op_begin() + 2, Node->op_end());
Ops.push_back(Node->getOperand(1));
@ -3264,7 +3264,7 @@ std::pair <SDValue, SDValue> DAGTypeLegalizer::ExpandAtomic(SDNode *Node) {
assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"Unexpected atomic op or value type!");
Ops.append(Node->op_begin() + 1, Node->op_end());
LCImpl = TLI.getLibcallImpl(LC);
LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
}
return TLI.makeLibCall(DAG, LCImpl, RetVT, Ops, CallOptions, SDLoc(Node),
Node->getOperand(0));
@ -4171,7 +4171,7 @@ void DAGTypeLegalizer::ExpandIntRes_CTPOP(SDNode *N, SDValue &Lo, SDValue &Hi) {
assert(LC != RTLIB::UNKNOWN_LIBCALL &&
"LibCall explicitly requested, but not available");
if (RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC)) {
if (RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC)) {
TargetLowering::MakeLibCallOptions CallOptions;
EVT IntVT =
EVT::getIntegerVT(*DAG.getContext(), DAG.getLibInfo().getIntSize());
@ -4479,7 +4479,7 @@ void DAGTypeLegalizer::ExpandIntRes_MUL(SDNode *N,
// If nothing else, we can make a libcall.
RTLIB::Libcall LC = RTLIB::getMUL(VT);
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl == RTLIB::Unsupported) {
// Perform a wide multiplication where the wide type is the original VT and
// the 4 parts are the split arguments.
@ -5067,7 +5067,7 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
LC = RTLIB::getSRA(VT);
}
if (RTLIB::LibcallImpl LibcallImpl = TLI.getLibcallImpl(LC)) {
if (RTLIB::LibcallImpl LibcallImpl = DAG.getLibcalls().getLibcallImpl(LC)) {
EVT ShAmtTy =
EVT::getIntegerVT(*DAG.getContext(), DAG.getLibInfo().getIntSize());
SDValue ShAmt = DAG.getZExtOrTrunc(N->getOperand(1), dl, ShAmtTy);
@ -5236,12 +5236,13 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
// Replace this with a libcall that will check overflow.
RTLIB::Libcall LC = RTLIB::getMULO(VT);
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
// If we don't have the libcall or if the function we are compiling is the
// implementation of the expected libcall (avoid inf-loop), expand inline.
if (LCImpl == RTLIB::Unsupported ||
TLI.getLibcallImplName(LCImpl) == DAG.getMachineFunction().getName()) {
RTLIB::RuntimeLibcallsInfo::getLibcallImplName(LCImpl) ==
DAG.getMachineFunction().getName()) {
// FIXME: This is not an optimal expansion, but better than crashing.
SDValue MulLo, MulHi;
TLI.forceExpandWideMUL(DAG, dl, /*Signed=*/true, N->getOperand(0),
@ -5284,8 +5285,8 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(TLI.getLibcallImplCallingConv(LCImpl), RetTy, Func,
std::move(Args))
.setLibCallee(DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy,
Func, std::move(Args))
.setSExtResult();
std::pair<SDValue, SDValue> CallInfo = TLI.LowerCallTo(CLI);

View File

@ -2264,7 +2264,7 @@ bool VectorLegalizer::tryExpandVecMathCall(SDNode *Node, RTLIB::Libcall LC,
// converted to their none strict counterpart.
assert(!Node->isStrictFPOpcode() && "Unexpected strict fp operation!");
RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
if (LCImpl == RTLIB::Unsupported)
return false;

View File

@ -1368,6 +1368,7 @@ SelectionDAG::SelectionDAG(const TargetMachine &tm, CodeGenOptLevel OL)
void SelectionDAG::init(MachineFunction &NewMF,
OptimizationRemarkEmitter &NewORE, Pass *PassPtr,
const TargetLibraryInfo *LibraryInfo,
const LibcallLoweringInfo *LibcallsInfo,
UniformityInfo *NewUA, ProfileSummaryInfo *PSIin,
BlockFrequencyInfo *BFIin, MachineModuleInfo &MMIin,
FunctionVarLocs const *VarLocs) {
@ -1377,6 +1378,7 @@ void SelectionDAG::init(MachineFunction &NewMF,
TLI = getSubtarget().getTargetLowering();
TSI = getSubtarget().getSelectionDAGInfo();
LibInfo = LibraryInfo;
Libcalls = LibcallsInfo;
Context = &MF->getFunction().getContext();
UA = NewUA;
PSI = PSIin;
@ -2073,7 +2075,7 @@ SDValue SelectionDAG::getExternalSymbol(const char *Sym, EVT VT) {
}
SDValue SelectionDAG::getExternalSymbol(RTLIB::LibcallImpl Libcall, EVT VT) {
StringRef SymName = TLI->getLibcallImplName(Libcall);
StringRef SymName = RTLIB::RuntimeLibcallsInfo::getLibcallImplName(Libcall);
return getExternalSymbol(SymName.data(), VT);
}
@ -2098,7 +2100,7 @@ SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, EVT VT,
SDValue SelectionDAG::getTargetExternalSymbol(RTLIB::LibcallImpl Libcall,
EVT VT, unsigned TargetFlags) {
StringRef SymName = TLI->getLibcallImplName(Libcall);
StringRef SymName = RTLIB::RuntimeLibcallsInfo::getLibcallImplName(Libcall);
return getTargetExternalSymbol(SymName.data(), VT, TargetFlags);
}
@ -9189,7 +9191,7 @@ std::pair<SDValue, SDValue> SelectionDAG::getStrstr(SDValue Chain,
std::pair<SDValue, SDValue>
SelectionDAG::getMemcmp(SDValue Chain, const SDLoc &dl, SDValue Mem0,
SDValue Mem1, SDValue Size, const CallInst *CI) {
RTLIB::LibcallImpl MemcmpImpl = TLI->getLibcallImpl(RTLIB::MEMCMP);
RTLIB::LibcallImpl MemcmpImpl = getLibcalls().getLibcallImpl(RTLIB::MEMCMP);
if (MemcmpImpl == RTLIB::Unsupported)
return {};
@ -9206,7 +9208,7 @@ SelectionDAG::getMemcmp(SDValue Chain, const SDLoc &dl, SDValue Mem0,
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallImplCallingConv(MemcmpImpl),
getLibcalls().getLibcallImplCallingConv(MemcmpImpl),
Type::getInt32Ty(*getContext()),
getExternalSymbol(MemcmpImpl, TLI->getPointerTy(getDataLayout())),
std::move(Args))
@ -9245,7 +9247,7 @@ std::pair<SDValue, SDValue> SelectionDAG::getStrlen(SDValue Chain,
const SDLoc &dl,
SDValue Src,
const CallInst *CI) {
RTLIB::LibcallImpl StrlenImpl = TLI->getLibcallImpl(RTLIB::STRLEN);
RTLIB::LibcallImpl StrlenImpl = getLibcalls().getLibcallImpl(RTLIB::STRLEN);
if (StrlenImpl == RTLIB::Unsupported)
return {};
@ -9338,7 +9340,7 @@ SDValue SelectionDAG::getMemcpy(
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallImplCallingConv(MemCpyImpl),
getLibcalls().getLibcallImplCallingConv(MemCpyImpl),
Dst.getValueType().getTypeForEVT(*getContext()),
getExternalSymbol(MemCpyImpl, TLI->getPointerTy(getDataLayout())),
std::move(Args))
@ -9364,7 +9366,7 @@ SDValue SelectionDAG::getAtomicMemcpy(SDValue Chain, const SDLoc &dl,
RTLIB::Libcall LibraryCall =
RTLIB::getMEMCPY_ELEMENT_UNORDERED_ATOMIC(ElemSz);
RTLIB::LibcallImpl LibcallImpl = TLI->getLibcallImpl(LibraryCall);
RTLIB::LibcallImpl LibcallImpl = getLibcalls().getLibcallImpl(LibraryCall);
if (LibcallImpl == RTLIB::Unsupported)
report_fatal_error("Unsupported element size");
@ -9372,7 +9374,7 @@ SDValue SelectionDAG::getAtomicMemcpy(SDValue Chain, const SDLoc &dl,
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallImplCallingConv(LibcallImpl),
getLibcalls().getLibcallImplCallingConv(LibcallImpl),
Type::getVoidTy(*getContext()),
getExternalSymbol(LibcallImpl, TLI->getPointerTy(getDataLayout())),
std::move(Args))
@ -9431,7 +9433,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
// FIXME: pass in SDLoc
TargetLowering::CallLoweringInfo CLI(*this);
RTLIB::LibcallImpl MemmoveImpl = TLI->getLibcallImpl(RTLIB::MEMMOVE);
RTLIB::LibcallImpl MemmoveImpl = getLibcalls().getLibcallImpl(RTLIB::MEMMOVE);
bool IsTailCall = false;
if (OverrideTailCall.has_value()) {
@ -9444,7 +9446,7 @@ SDValue SelectionDAG::getMemmove(SDValue Chain, const SDLoc &dl, SDValue Dst,
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallImplCallingConv(MemmoveImpl),
getLibcalls().getLibcallImplCallingConv(MemmoveImpl),
Dst.getValueType().getTypeForEVT(*getContext()),
getExternalSymbol(MemmoveImpl, TLI->getPointerTy(getDataLayout())),
std::move(Args))
@ -9470,7 +9472,7 @@ SDValue SelectionDAG::getAtomicMemmove(SDValue Chain, const SDLoc &dl,
RTLIB::Libcall LibraryCall =
RTLIB::getMEMMOVE_ELEMENT_UNORDERED_ATOMIC(ElemSz);
RTLIB::LibcallImpl LibcallImpl = TLI->getLibcallImpl(LibraryCall);
RTLIB::LibcallImpl LibcallImpl = getLibcalls().getLibcallImpl(LibraryCall);
if (LibcallImpl == RTLIB::Unsupported)
report_fatal_error("Unsupported element size");
@ -9478,7 +9480,7 @@ SDValue SelectionDAG::getAtomicMemmove(SDValue Chain, const SDLoc &dl,
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallImplCallingConv(LibcallImpl),
getLibcalls().getLibcallImplCallingConv(LibcallImpl),
Type::getVoidTy(*getContext()),
getExternalSymbol(LibcallImpl, TLI->getPointerTy(getDataLayout())),
std::move(Args))

View File

@ -494,6 +494,7 @@ void SelectionDAGISel::initializeAnalysisResults(
TLI = MF->getSubtarget().getTargetLowering();
RegInfo = &MF->getRegInfo();
LibInfo = &FAM.getResult<TargetLibraryAnalysis>(Fn);
GFI = Fn.hasGC() ? &FAM.getResult<GCFunctionAnalysis>(Fn) : nullptr;
ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn);
AC = &FAM.getResult<AssumptionAnalysis>(Fn);
@ -511,7 +512,9 @@ void SelectionDAGISel::initializeAnalysisResults(
MachineModuleInfo &MMI =
MAMP.getCachedResult<MachineModuleAnalysis>(*Fn.getParent())->getMMI();
CurDAG->init(*MF, *ORE, MFAM, LibInfo, UA, PSI, BFI, MMI, FnVarLocs);
CurDAG->init(*MF, *ORE, MFAM, LibInfo,
&TLI->getLibcallLoweringInfo(), // FIXME: Take from analysis
UA, PSI, BFI, MMI, FnVarLocs);
// Now get the optional analyzes if we want to.
// This is based on the possibly changed OptLevel (after optnone is taken
@ -549,6 +552,7 @@ void SelectionDAGISel::initializeAnalysisResults(MachineFunctionPass &MFP) {
TLI = MF->getSubtarget().getTargetLowering();
RegInfo = &MF->getRegInfo();
LibInfo = &MFP.getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(Fn);
GFI = Fn.hasGC() ? &MFP.getAnalysis<GCModuleInfo>().getFunctionInfo(Fn)
: nullptr;
ORE = std::make_unique<OptimizationRemarkEmitter>(&Fn);
@ -569,7 +573,9 @@ void SelectionDAGISel::initializeAnalysisResults(MachineFunctionPass &MFP) {
MachineModuleInfo &MMI =
MFP.getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
CurDAG->init(*MF, *ORE, &MFP, LibInfo, UA, PSI, BFI, MMI, FnVarLocs);
CurDAG->init(*MF, *ORE, &MFP, LibInfo,
&TLI->getLibcallLoweringInfo(), // FIXME: Take from analysis
UA, PSI, BFI, MMI, FnVarLocs);
// Now get the optional analyzes if we want to.
// This is based on the possibly changed OptLevel (after optnone is taken

View File

@ -6067,14 +6067,16 @@ SDValue AArch64TargetLowering::getRuntimePStateSM(SelectionDAG &DAG,
SDValue Chain, SDLoc DL,
EVT VT) const {
RTLIB::Libcall LC = RTLIB::SMEABI_SME_STATE;
SDValue Callee = DAG.getExternalSymbol(getLibcallImpl(LC),
getPointerTy(DAG.getDataLayout()));
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue Callee =
DAG.getExternalSymbol(LCImpl, getPointerTy(DAG.getDataLayout()));
Type *Int64Ty = Type::getInt64Ty(*DAG.getContext());
Type *RetTy = StructType::get(Int64Ty, Int64Ty);
TargetLowering::CallLoweringInfo CLI(DAG);
ArgListTy Args;
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
getLibcallCallingConv(LC), RetTy, Callee, std::move(Args));
DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args));
std::pair<SDValue, SDValue> CallResult = LowerCallTo(CLI);
SDValue Mask = DAG.getConstant(/*PSTATE.SM*/ 1, DL, MVT::i64);
return DAG.getNode(ISD::AND, DL, MVT::i64, CallResult.first.getOperand(0),
@ -8449,12 +8451,14 @@ static SDValue emitSMEStateSaveRestore(const AArch64TargetLowering &TLI,
RTLIB::Libcall LC =
IsSave ? RTLIB::SMEABI_SME_SAVE : RTLIB::SMEABI_SME_RESTORE;
SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallImpl(LC),
TLI.getPointerTy(DAG.getDataLayout()));
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue Callee =
DAG.getExternalSymbol(LCImpl, TLI.getPointerTy(DAG.getDataLayout()));
auto *RetTy = Type::getVoidTy(*DAG.getContext());
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args));
DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args));
return TLI.LowerCallTo(CLI).second;
}
@ -8466,10 +8470,13 @@ static SDValue emitRestoreZALazySave(SDValue Chain, SDLoc DL,
// Conditionally restore the lazy save using a pseudo node.
RTLIB::Libcall LC = RTLIB::SMEABI_TPIDR2_RESTORE;
TPIDR2Object &TPIDR2 = FuncInfo.getTPIDR2Obj();
RTLIB::LibcallImpl LibcallImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue RegMask = DAG.getRegisterMask(TRI.getCallPreservedMask(
DAG.getMachineFunction(), TLI.getLibcallCallingConv(LC)));
DAG.getMachineFunction(),
DAG.getLibcalls().getLibcallImplCallingConv(LibcallImpl)));
SDValue RestoreRoutine = DAG.getTargetExternalSymbol(
TLI.getLibcallImpl(LC), TLI.getPointerTy(DAG.getDataLayout()));
LibcallImpl, TLI.getPointerTy(DAG.getDataLayout()));
SDValue TPIDR2_EL0 = DAG.getNode(
ISD::INTRINSIC_W_CHAIN, DL, MVT::i64, Chain,
DAG.getTargetConstant(Intrinsic::aarch64_sme_get_tpidr2, DL, MVT::i32));
@ -8979,12 +8986,14 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
Size = DAG.getNode(ISD::MUL, DL, MVT::i64, SVL, SVL);
} else if (Attrs.hasAgnosticZAInterface()) {
RTLIB::Libcall LC = RTLIB::SMEABI_SME_STATE_SIZE;
SDValue Callee = DAG.getExternalSymbol(
getLibcallImpl(LC), getPointerTy(DAG.getDataLayout()));
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue Callee =
DAG.getExternalSymbol(LCImpl, getPointerTy(DAG.getDataLayout()));
auto *RetTy = EVT(MVT::i64).getTypeForEVT(*DAG.getContext());
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
getLibcallCallingConv(LC), RetTy, Callee, {});
DAG.getLibcalls().getLibcallCallingConv(LC), RetTy, Callee, {});
std::tie(Size, Chain) = LowerCallTo(CLI);
}
if (Size) {

View File

@ -200,13 +200,15 @@ SDValue AArch64SelectionDAGInfo::EmitStreamingCompatibleMemLibCall(
}
EVT PointerVT = TLI->getPointerTy(DAG.getDataLayout());
SDValue Symbol = DAG.getExternalSymbol(TLI->getLibcallName(NewLC), PointerVT);
SDValue Symbol =
DAG.getExternalSymbol(DAG.getLibcalls().getLibcallName(NewLC), PointerVT);
Args.emplace_back(Size, DAG.getDataLayout().getIntPtrType(*DAG.getContext()));
TargetLowering::CallLoweringInfo CLI(DAG);
PointerType *RetTy = PointerType::getUnqual(*DAG.getContext());
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
TLI->getLibcallCallingConv(NewLC), RetTy, Symbol, std::move(Args));
DAG.getLibcalls().getLibcallCallingConv(NewLC), RetTy, Symbol,
std::move(Args));
auto [Result, ChainOut] = TLI->LowerCallTo(CLI);
return UsesResult ? DAG.getMergeValues({Result, ChainOut}, DL) : ChainOut;

View File

@ -1262,7 +1262,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
setOperationAction(ISD::FSINCOS, MVT::f32, Expand);
// FP-ARMv8 implements a lot of rounding-like FP operations.
if (Subtarget->hasFPARMv8Base()) {
if (Subtarget->hasFPARMv8Base()) {
for (auto Op :
{ISD::FFLOOR, ISD::FCEIL, ISD::FROUND,
ISD::FTRUNC, ISD::FNEARBYINT, ISD::FRINT,
@ -1290,7 +1290,7 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
setOperationAction(ISD::LRINT, MVT::f16, Expand);
setOperationAction(ISD::LROUND, MVT::f16, Expand);
setOperationAction(ISD::FCOPYSIGN, MVT::f16, Expand);
for (auto Op : {ISD::FREM, ISD::FPOW, ISD::FPOWI,
ISD::FCOS, ISD::FSIN, ISD::FSINCOS,
ISD::FSINCOSPI, ISD::FMODF, ISD::FACOS,
@ -1312,11 +1312,11 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM_,
// because the result type is integer.
for (auto Op : {ISD::STRICT_LROUND, ISD::STRICT_LLROUND, ISD::STRICT_LRINT, ISD::STRICT_LLRINT})
setOperationAction(Op, MVT::f16, Custom);
for (auto Op : {ISD::FROUND, ISD::FROUNDEVEN, ISD::FTRUNC,
ISD::FNEARBYINT, ISD::FRINT, ISD::FFLOOR,
ISD::FNEARBYINT, ISD::FRINT, ISD::FFLOOR,
ISD::FCEIL, ISD::STRICT_FROUND, ISD::STRICT_FROUNDEVEN,
ISD::STRICT_FTRUNC, ISD::STRICT_FNEARBYINT, ISD::STRICT_FRINT,
ISD::STRICT_FTRUNC, ISD::STRICT_FNEARBYINT, ISD::STRICT_FRINT,
ISD::STRICT_FFLOOR, ISD::STRICT_FCEIL}) {
setOperationAction(Op, MVT::f16, Legal);
}
@ -9631,7 +9631,7 @@ SDValue ARMTargetLowering::LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG,
else
LC = VT == MVT::i32 ? RTLIB::UDIVREM_I32 : RTLIB::UDIVREM_I64;
RTLIB::LibcallImpl LCImpl = getLibcallImpl(LC);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue ES = DAG.getExternalSymbol(LCImpl, getPointerTy(DL));
ARMTargetLowering::ArgListTy Args;
@ -9644,8 +9644,8 @@ SDValue ARMTargetLowering::LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG,
CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl).setChain(Chain).setCallee(
getLibcallImplCallingConv(LCImpl), VT.getTypeForEVT(*DAG.getContext()),
ES, std::move(Args));
DAG.getLibcalls().getLibcallImplCallingConv(LCImpl),
VT.getTypeForEVT(*DAG.getContext()), ES, std::move(Args));
return LowerCallTo(CLI).first;
}
@ -20423,13 +20423,14 @@ SDValue ARMTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
RTLIB::Libcall LC = getDivRemLibcall(Op.getNode(),
VT.getSimpleVT().SimpleTy);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue InChain = DAG.getEntryNode();
TargetLowering::ArgListTy Args = getDivRemArgList(Op.getNode(),
DAG.getContext(),
Subtarget);
RTLIB::LibcallImpl LCImpl = getLibcallImpl(LC);
SDValue Callee =
DAG.getExternalSymbol(LCImpl, getPointerTy(DAG.getDataLayout()));
@ -20441,8 +20442,8 @@ SDValue ARMTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(InChain)
.setCallee(getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args))
.setCallee(DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy,
Callee, std::move(Args))
.setInRegister()
.setSExtResult(isSigned)
.setZExtResult(!isSigned);
@ -20482,12 +20483,12 @@ SDValue ARMTargetLowering::LowerREM(SDNode *N, SelectionDAG &DAG) const {
RTLIB::Libcall LC = getDivRemLibcall(N, N->getValueType(0).getSimpleVT().
SimpleTy);
RTLIB::LibcallImpl LCImpl = DAG.getLibcalls().getLibcallImpl(LC);
SDValue InChain = DAG.getEntryNode();
TargetLowering::ArgListTy Args = getDivRemArgList(N, DAG.getContext(),
Subtarget);
bool isSigned = N->getOpcode() == ISD::SREM;
RTLIB::LibcallImpl LCImpl = getLibcallImpl(LC);
SDValue Callee =
DAG.getExternalSymbol(LCImpl, getPointerTy(DAG.getDataLayout()));
@ -20497,8 +20498,8 @@ SDValue ARMTargetLowering::LowerREM(SDNode *N, SelectionDAG &DAG) const {
// Lower call
CallLoweringInfo CLI(DAG);
CLI.setChain(InChain)
.setCallee(getLibcallImplCallingConv(LCImpl), RetTy, Callee,
std::move(Args))
.setCallee(DAG.getLibcalls().getLibcallImplCallingConv(LCImpl), RetTy,
Callee, std::move(Args))
.setSExtResult(isSigned)
.setZExtResult(!isSigned)
.setDebugLoc(SDLoc(N));

View File

@ -212,8 +212,9 @@ SDValue ARMSelectionDAGInfo::EmitSpecializedLibcall(
CLI.setDebugLoc(dl)
.setChain(Chain)
.setLibCallee(
TLI->getLibcallCallingConv(NewLC), Type::getVoidTy(*DAG.getContext()),
DAG.getExternalSymbol(TLI->getLibcallName(NewLC),
DAG.getLibcalls().getLibcallCallingConv(NewLC),
Type::getVoidTy(*DAG.getContext()),
DAG.getExternalSymbol(DAG.getLibcalls().getLibcallName(NewLC),
TLI->getPointerTy(DAG.getDataLayout())),
std::move(Args))
.setDiscardResult();

View File

@ -513,7 +513,7 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
Args.push_back(Entry);
}
SDValue Callee = DAG.getExternalSymbol(getLibcallName(LC),
SDValue Callee = DAG.getExternalSymbol(DAG.getLibcalls().getLibcallName(LC),
getPointerTy(DAG.getDataLayout()));
Type *RetTy = (Type *)StructType::get(Ty, Ty);
@ -522,7 +522,8 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const {
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(InChain)
.setLibCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args))
.setLibCallee(DAG.getLibcalls().getLibcallCallingConv(LC), RetTy, Callee,
std::move(Args))
.setInRegister()
.setSExtResult(IsSigned)
.setZExtResult(!IsSigned);

View File

@ -83,13 +83,13 @@ SDValue HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy(
Args.emplace_back(Src, ArgTy);
Args.emplace_back(Size, ArgTy);
const char *SpecialMemcpyName = TLI.getLibcallName(
const char *SpecialMemcpyName = DAG.getLibcalls().getLibcallName(
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
const MachineFunction &MF = DAG.getMachineFunction();
bool LongCalls = MF.getSubtarget<HexagonSubtarget>().useLongCalls();
unsigned Flags = LongCalls ? HexagonII::HMOTF_ConstExtended : 0;
CallingConv::ID CC = TLI.getLibcallCallingConv(
CallingConv::ID CC = DAG.getLibcalls().getLibcallCallingConv(
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
TargetLowering::CallLoweringInfo CLI(DAG);

View File

@ -2483,12 +2483,12 @@ LowerF128_FPEXTEND(SDValue Op, SelectionDAG &DAG,
const SparcTargetLowering &TLI) {
if (Op.getOperand(0).getValueType() == MVT::f64)
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(RTLIB::FPEXT_F64_F128), 1);
return TLI.LowerF128Op(
Op, DAG, DAG.getLibcalls().getLibcallName(RTLIB::FPEXT_F64_F128), 1);
if (Op.getOperand(0).getValueType() == MVT::f32)
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(RTLIB::FPEXT_F32_F128), 1);
return TLI.LowerF128Op(
Op, DAG, DAG.getLibcalls().getLibcallName(RTLIB::FPEXT_F32_F128), 1);
llvm_unreachable("fpextend with non-float operand!");
return SDValue();
@ -2502,11 +2502,11 @@ LowerF128_FPROUND(SDValue Op, SelectionDAG &DAG,
return Op;
if (Op.getValueType() == MVT::f64)
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(RTLIB::FPROUND_F128_F64), 1);
return TLI.LowerF128Op(
Op, DAG, DAG.getLibcalls().getLibcallName(RTLIB::FPROUND_F128_F64), 1);
if (Op.getValueType() == MVT::f32)
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(RTLIB::FPROUND_F128_F32), 1);
return TLI.LowerF128Op(
Op, DAG, DAG.getLibcalls().getLibcallName(RTLIB::FPROUND_F128_F32), 1);
llvm_unreachable("fpround to non-float!");
return SDValue();
@ -2522,9 +2522,8 @@ static SDValue LowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG,
// Expand f128 operations to fp128 abi calls.
if (Op.getOperand(0).getValueType() == MVT::f128
&& (!hasHardQuad || !TLI.isTypeLegal(VT))) {
const char *libName = TLI.getLibcallName(VT == MVT::i32
? RTLIB::FPTOSINT_F128_I32
: RTLIB::FPTOSINT_F128_I64);
const char *libName = DAG.getLibcalls().getLibcallName(
VT == MVT::i32 ? RTLIB::FPTOSINT_F128_I32 : RTLIB::FPTOSINT_F128_I64);
return TLI.LowerF128Op(Op, DAG, libName, 1);
}
@ -2553,9 +2552,8 @@ static SDValue LowerSINT_TO_FP(SDValue Op, SelectionDAG &DAG,
// Expand f128 operations to fp128 ABI calls.
if (Op.getValueType() == MVT::f128
&& (!hasHardQuad || !TLI.isTypeLegal(OpVT))) {
const char *libName = TLI.getLibcallName(OpVT == MVT::i32
? RTLIB::SINTTOFP_I32_F128
: RTLIB::SINTTOFP_I64_F128);
const char *libName = DAG.getLibcalls().getLibcallName(
OpVT == MVT::i32 ? RTLIB::SINTTOFP_I32_F128 : RTLIB::SINTTOFP_I64_F128);
return TLI.LowerF128Op(Op, DAG, libName, 1);
}
@ -2582,11 +2580,11 @@ static SDValue LowerFP_TO_UINT(SDValue Op, SelectionDAG &DAG,
assert(VT == MVT::i32 || VT == MVT::i64);
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(VT == MVT::i32
? RTLIB::FPTOUINT_F128_I32
: RTLIB::FPTOUINT_F128_I64),
1);
return TLI.LowerF128Op(
Op, DAG,
DAG.getLibcalls().getLibcallName(
VT == MVT::i32 ? RTLIB::FPTOUINT_F128_I32 : RTLIB::FPTOUINT_F128_I64),
1);
}
static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG,
@ -2601,9 +2599,9 @@ static SDValue LowerUINT_TO_FP(SDValue Op, SelectionDAG &DAG,
return SDValue();
return TLI.LowerF128Op(Op, DAG,
TLI.getLibcallName(OpVT == MVT::i32
? RTLIB::UINTTOFP_I32_F128
: RTLIB::UINTTOFP_I64_F128),
DAG.getLibcalls().getLibcallName(
OpVT == MVT::i32 ? RTLIB::UINTTOFP_I32_F128
: RTLIB::UINTTOFP_I64_F128),
1);
}
@ -3180,16 +3178,21 @@ LowerOperation(SDValue Op, SelectionDAG &DAG) const {
case ISD::LOAD: return LowerLOAD(Op, DAG);
case ISD::STORE: return LowerSTORE(Op, DAG);
case ISD::FADD: return LowerF128Op(Op, DAG,
getLibcallName(RTLIB::ADD_F128), 2);
case ISD::FSUB: return LowerF128Op(Op, DAG,
getLibcallName(RTLIB::SUB_F128), 2);
case ISD::FMUL: return LowerF128Op(Op, DAG,
getLibcallName(RTLIB::MUL_F128), 2);
case ISD::FDIV: return LowerF128Op(Op, DAG,
getLibcallName(RTLIB::DIV_F128), 2);
case ISD::FSQRT: return LowerF128Op(Op, DAG,
getLibcallName(RTLIB::SQRT_F128),1);
case ISD::FADD:
return LowerF128Op(Op, DAG,
DAG.getLibcalls().getLibcallName(RTLIB::ADD_F128), 2);
case ISD::FSUB:
return LowerF128Op(Op, DAG,
DAG.getLibcalls().getLibcallName(RTLIB::SUB_F128), 2);
case ISD::FMUL:
return LowerF128Op(Op, DAG,
DAG.getLibcalls().getLibcallName(RTLIB::MUL_F128), 2);
case ISD::FDIV:
return LowerF128Op(Op, DAG,
DAG.getLibcalls().getLibcallName(RTLIB::DIV_F128), 2);
case ISD::FSQRT:
return LowerF128Op(Op, DAG,
DAG.getLibcalls().getLibcallName(RTLIB::SQRT_F128), 1);
case ISD::FABS:
case ISD::FNEG: return LowerFNEGorFABS(Op, DAG, isV9);
case ISD::FP_EXTEND: return LowerF128_FPEXTEND(Op, DAG, *this);
@ -3516,10 +3519,8 @@ void SparcTargetLowering::ReplaceNodeResults(SDNode *N,
? RTLIB::FPTOSINT_F128_I64
: RTLIB::FPTOUINT_F128_I64);
Results.push_back(LowerF128Op(SDValue(N, 0),
DAG,
getLibcallName(libCall),
1));
Results.push_back(LowerF128Op(
SDValue(N, 0), DAG, DAG.getLibcalls().getLibcallName(libCall), 1));
return;
case ISD::READCYCLECOUNTER: {
assert(Subtarget->hasLeonCycleCounter());
@ -3542,10 +3543,8 @@ void SparcTargetLowering::ReplaceNodeResults(SDNode *N,
? RTLIB::SINTTOFP_I64_F128
: RTLIB::UINTTOFP_I64_F128);
Results.push_back(LowerF128Op(SDValue(N, 0),
DAG,
getLibcallName(libCall),
1));
Results.push_back(LowerF128Op(
SDValue(N, 0), DAG, DAG.getLibcalls().getLibcallName(libCall), 1));
return;
case ISD::LOAD: {
LoadSDNode *Ld = cast<LoadSDNode>(N);

View File

@ -22543,7 +22543,7 @@ SDValue X86TargetLowering::LowerFP_EXTEND(SDValue Op, SelectionDAG &DAG) const {
Args.push_back(Entry);
SDValue Callee = DAG.getExternalSymbol(
getLibcallName(RTLIB::FPEXT_F16_F32),
DAG.getLibcalls().getLibcallName(RTLIB::FPEXT_F16_F32),
getPointerTy(DAG.getDataLayout()));
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
CallingConv::C, EVT(VT).getTypeForEVT(*DAG.getContext()), Callee,
@ -22641,8 +22641,8 @@ SDValue X86TargetLowering::LowerFP_ROUND(SDValue Op, SelectionDAG &DAG) const {
Args.push_back(Entry);
SDValue Callee = DAG.getExternalSymbol(
getLibcallName(SVT == MVT::f64 ? RTLIB::FPROUND_F64_F16
: RTLIB::FPROUND_F32_F16),
DAG.getLibcalls().getLibcallName(
SVT == MVT::f64 ? RTLIB::FPROUND_F64_F16 : RTLIB::FPROUND_F32_F16),
getPointerTy(DAG.getDataLayout()));
CLI.setDebugLoc(DL).setChain(Chain).setLibCallee(
CallingConv::C, EVT(MVT::i16).getTypeForEVT(*DAG.getContext()), Callee,
@ -30371,14 +30371,14 @@ SDValue X86TargetLowering::LowerWin64_i128OP(SDValue Op, SelectionDAG &DAG) cons
Args.emplace_back(StackPtr, PointerType::get(*DAG.getContext(), 0));
}
SDValue Callee = DAG.getExternalSymbol(getLibcallName(LC),
SDValue Callee = DAG.getExternalSymbol(DAG.getLibcalls().getLibcallName(LC),
getPointerTy(DAG.getDataLayout()));
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)
.setChain(InChain)
.setLibCallee(
getLibcallCallingConv(LC),
DAG.getLibcalls().getLibcallCallingConv(LC),
static_cast<EVT>(MVT::v2i64).getTypeForEVT(*DAG.getContext()), Callee,
std::move(Args))
.setInRegister()

View File

@ -38,8 +38,10 @@ SDValue XCoreSelectionDAGInfo::EmitTargetCodeForMemcpy(
Args.emplace_back(Src, ArgTy);
Args.emplace_back(Size, ArgTy);
const char *MemcpyAlign4Name = TLI.getLibcallName(RTLIB::MEMCPY_ALIGN_4);
CallingConv::ID CC = TLI.getLibcallCallingConv(RTLIB::MEMCPY_ALIGN_4);
const char *MemcpyAlign4Name =
DAG.getLibcalls().getLibcallName(RTLIB::MEMCPY_ALIGN_4);
CallingConv::ID CC =
DAG.getLibcalls().getLibcallCallingConv(RTLIB::MEMCPY_ALIGN_4);
TargetLowering::CallLoweringInfo CLI(DAG);
CLI.setDebugLoc(dl)

View File

@ -71,8 +71,8 @@ protected:
if (!DAG)
reportFatalUsageError("Failed to create SelectionDAG?");
OptimizationRemarkEmitter ORE(F);
DAG->init(*MF, ORE, nullptr, nullptr, nullptr, nullptr, nullptr, MMI,
nullptr);
DAG->init(*MF, ORE, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
MMI, nullptr);
}
TargetLoweringBase::LegalizeTypeAction getTypeAction(EVT VT) {

View File

@ -64,8 +64,8 @@ protected:
if (!DAG)
report_fatal_error("DAG?");
OptimizationRemarkEmitter ORE(F);
DAG->init(*MF, ORE, nullptr, nullptr, nullptr, nullptr, nullptr, MMI,
nullptr);
DAG->init(*MF, ORE, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
MMI, nullptr);
}
TargetLoweringBase::LegalizeTypeAction getTypeAction(EVT VT) {

View File

@ -66,8 +66,9 @@ protected:
report_fatal_error("SelectionDAG allocation failed");
OptimizationRemarkEmitter ORE(F);
DAG->init(*MF, ORE, /*LibInfo*/ nullptr, /*AA*/ nullptr,
/*AC*/ nullptr, /*MDT*/ nullptr, /*MSDT*/ nullptr, MMI, nullptr);
DAG->init(*MF, ORE, /*LibInfo=*/nullptr, /*LibcallsInfo=*/nullptr,
/*AA=*/nullptr,
/*AC=*/nullptr, /*MDT=*/nullptr, /*MSDT=*/nullptr, MMI, nullptr);
}
TargetLoweringBase::LegalizeTypeAction getTypeAction(EVT VT) {

View File

@ -66,8 +66,9 @@ protected:
report_fatal_error("SelectionDAG allocation failed");
OptimizationRemarkEmitter ORE(F);
DAG->init(*MF, ORE, /*LibInfo*/ nullptr, /*AA*/ nullptr,
/*AC*/ nullptr, /*MDT*/ nullptr, /*MSDT*/ nullptr, MMI, nullptr);
DAG->init(*MF, ORE, /*LibInfo=*/nullptr, /*LibcallsInfo=*/nullptr,
/*AA=*/nullptr,
/*AC=*/nullptr, /*MDT=*/nullptr, /*MSDT=*/nullptr, MMI, nullptr);
}
LLVMContext Context;