@@ -2692,7 +2692,8 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
26922692 RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI (N->getValueType (0 ))
26932693 : RTLIB::getLDEXP (N->getValueType (0 ));
26942694
2695- if (TLI.getLibcallImpl (LC) == RTLIB::Unsupported) {
2695+ RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl (LC);
2696+ if (LCImpl == RTLIB::Unsupported) {
26962697 // Scalarize vector FPOWI instead of promoting the type. This allows the
26972698 // scalar FPOWIs to be visited and converted to libcalls before promoting
26982699 // the type.
@@ -2719,7 +2720,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
27192720 CallOptions.setIsSigned (true );
27202721 SDValue Ops[2 ] = {N->getOperand (0 + OpOffset), N->getOperand (1 + OpOffset)};
27212722 std::pair<SDValue, SDValue> Tmp = TLI.makeLibCall (
2722- DAG, LC , N->getValueType (0 ), Ops, CallOptions, SDLoc (N), Chain);
2723+ DAG, LCImpl , N->getValueType (0 ), Ops, CallOptions, SDLoc (N), Chain);
27232724 ReplaceValueWith (SDValue (N, 0 ), Tmp.first );
27242725 if (IsStrict)
27252726 ReplaceValueWith (SDValue (N, 1 ), Tmp.second );
@@ -3187,16 +3188,19 @@ std::pair <SDValue, SDValue> DAGTypeLegalizer::ExpandAtomic(SDNode *Node) {
31873188 EVT RetVT = Node->getValueType (0 );
31883189 TargetLowering::MakeLibCallOptions CallOptions;
31893190 SmallVector<SDValue, 4 > Ops;
3190- if (TLI.getLibcallName (LC)) {
3191+
3192+ RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl (LC);
3193+ if (LCImpl != RTLIB::Unsupported) {
31913194 Ops.append (Node->op_begin () + 2 , Node->op_end ());
31923195 Ops.push_back (Node->getOperand (1 ));
31933196 } else {
31943197 LC = RTLIB::getSYNC (Opc, VT);
31953198 assert (LC != RTLIB::UNKNOWN_LIBCALL &&
31963199 " Unexpected atomic op or value type!" );
31973200 Ops.append (Node->op_begin () + 1 , Node->op_end ());
3201+ LCImpl = TLI.getLibcallImpl (LC);
31983202 }
3199- return TLI.makeLibCall (DAG, LC , RetVT, Ops, CallOptions, SDLoc (Node),
3203+ return TLI.makeLibCall (DAG, LCImpl , RetVT, Ops, CallOptions, SDLoc (Node),
32003204 Node->getOperand (0 ));
32013205}
32023206
@@ -4403,8 +4407,8 @@ void DAGTypeLegalizer::ExpandIntRes_MUL(SDNode *N,
44034407
44044408 // If nothing else, we can make a libcall.
44054409 RTLIB::Libcall LC = RTLIB::getMUL (VT);
4406-
4407- if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI. getLibcallName (LC) ) {
4410+ RTLIB::LibcallImpl LCImpl = TLI. getLibcallImpl (LC);
4411+ if (LCImpl == RTLIB::Unsupported ) {
44084412 // Perform a wide multiplication where the wide type is the original VT and
44094413 // the 4 parts are the split arguments.
44104414 TLI.forceExpandMultiply (DAG, dl, /* Signed=*/ false , Lo, Hi, LL, RL, LH, RH);
@@ -4416,8 +4420,8 @@ void DAGTypeLegalizer::ExpandIntRes_MUL(SDNode *N,
44164420 SDValue Ops[2 ] = { N->getOperand (0 ), N->getOperand (1 ) };
44174421 TargetLowering::MakeLibCallOptions CallOptions;
44184422 CallOptions.setIsSigned (true );
4419- SplitInteger (TLI.makeLibCall (DAG, LC , VT, Ops, CallOptions, dl).first ,
4420- Lo, Hi);
4423+ SplitInteger (TLI.makeLibCall (DAG, LCImpl , VT, Ops, CallOptions, dl).first , Lo ,
4424+ Hi);
44214425}
44224426
44234427void DAGTypeLegalizer::ExpandIntRes_READCOUNTER (SDNode *N, SDValue &Lo,
@@ -4991,14 +4995,16 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
49914995 LC = RTLIB::getSRA (VT);
49924996 }
49934997
4994- if (LC != RTLIB::UNKNOWN_LIBCALL && TLI.getLibcallName (LC)) {
4998+ if (RTLIB::LibcallImpl LibcallImpl = TLI.getLibcallImpl (LC)) {
49954999 EVT ShAmtTy =
49965000 EVT::getIntegerVT (*DAG.getContext (), DAG.getLibInfo ().getIntSize ());
49975001 SDValue ShAmt = DAG.getZExtOrTrunc (N->getOperand (1 ), dl, ShAmtTy);
49985002 SDValue Ops[2 ] = {N->getOperand (0 ), ShAmt};
49995003 TargetLowering::MakeLibCallOptions CallOptions;
50005004 CallOptions.setIsSigned (isSigned);
5001- SplitInteger (TLI.makeLibCall (DAG, LC, VT, Ops, CallOptions, dl).first , Lo, Hi);
5005+ SplitInteger (
5006+ TLI.makeLibCall (DAG, LibcallImpl, VT, Ops, CallOptions, dl).first , Lo,
5007+ Hi);
50025008 return ;
50035009 }
50045010
@@ -5158,11 +5164,12 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
51585164
51595165 // Replace this with a libcall that will check overflow.
51605166 RTLIB::Libcall LC = RTLIB::getMULO (VT);
5167+ RTLIB::LibcallImpl LCImpl = TLI.getLibcallImpl (LC);
51615168
51625169 // If we don't have the libcall or if the function we are compiling is the
51635170 // implementation of the expected libcall (avoid inf-loop), expand inline.
5164- if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI. getLibcallName (LC) ||
5165- TLI.getLibcallName (LC ) == DAG.getMachineFunction ().getName ()) {
5171+ if (LCImpl == RTLIB::Unsupported ||
5172+ TLI.getLibcallImplName (LCImpl ) == DAG.getMachineFunction ().getName ()) {
51665173 // FIXME: This is not an optimal expansion, but better than crashing.
51675174 SDValue MulLo, MulHi;
51685175 TLI.forceExpandWideMUL (DAG, dl, /* Signed=*/ true , N->getOperand (0 ),
@@ -5200,12 +5207,14 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N,
52005207 Entry.IsZExt = false ;
52015208 Args.push_back (Entry);
52025209
5203- SDValue Func = DAG.getExternalSymbol (TLI.getLibcallName (LC), PtrVT);
5210+ SDValue Func =
5211+ DAG.getExternalSymbol (TLI.getLibcallImplName (LCImpl).data (), PtrVT);
52045212
52055213 TargetLowering::CallLoweringInfo CLI (DAG);
52065214 CLI.setDebugLoc (dl)
52075215 .setChain (Chain)
5208- .setLibCallee (TLI.getLibcallCallingConv (LC), RetTy, Func, std::move (Args))
5216+ .setLibCallee (TLI.getLibcallImplCallingConv (LCImpl), RetTy, Func,
5217+ std::move (Args))
52095218 .setSExtResult ();
52105219
52115220 std::pair<SDValue, SDValue> CallInfo = TLI.LowerCallTo (CLI);
0 commit comments