llvm.org GIT mirror llvm / 7590926
[DAG] Pass the argument list to the CallLoweringInfo via move semantics. NFCI. The argument list vector is never used after it has been passed to the CallLoweringInfo and moving it to the CallLoweringInfo is cleaner and pretty much as cheap as keeping a pointer to it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212135 91177308-0d34-0410-b5e6-96231b3b80d8 Juergen Ributzka 5 years ago
18 changed file(s) with 45 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
21102110 unsigned NumFixedArgs;
21112111 CallingConv::ID CallConv;
21122112 SDValue Callee;
2113 ArgListTy *Args;
2113 ArgListTy Args;
21142114 SelectionDAG &DAG;
21152115 SDLoc DL;
21162116 ImmutableCallSite *CS;
21222122 : RetTy(nullptr), RetSExt(false), RetZExt(false), IsVarArg(false),
21232123 IsInReg(false), DoesNotReturn(false), IsReturnValueUsed(true),
21242124 IsTailCall(false), NumFixedArgs(-1), CallConv(CallingConv::C),
2125 Args(nullptr), DAG(DAG), CS(nullptr) {}
2125 DAG(DAG), CS(nullptr) {}
21262126
21272127 CallLoweringInfo &setDebugLoc(SDLoc dl) {
21282128 DL = dl;
21352135 }
21362136
21372137 CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultType,
2138 SDValue Target, ArgListTy *ArgsList,
2138 SDValue Target, ArgListTy &&ArgsList,
21392139 unsigned FixedArgs = -1) {
21402140 RetTy = ResultType;
21412141 Callee = Target;
21422142 CallConv = CC;
21432143 NumFixedArgs =
2144 (FixedArgs == static_cast(-1) ? Args->size() : FixedArgs);
2145 Args = ArgsList;
2144 (FixedArgs == static_cast(-1) ? Args.size() : FixedArgs);
2145 Args = std::move(ArgsList);
21462146 return *this;
21472147 }
21482148
21492149 CallLoweringInfo &setCallee(Type *ResultType, FunctionType *FTy,
2150 SDValue Target, ArgListTy *ArgsList,
2150 SDValue Target, ArgListTy &&ArgsList,
21512151 ImmutableCallSite &Call) {
21522152 RetTy = ResultType;
21532153
21622162
21632163 CallConv = Call.getCallingConv();
21642164 NumFixedArgs = FTy->getNumParams();
2165 Args = ArgsList;
2165 Args = std::move(ArgsList);
21662166
21672167 CS = &Call;
21682168
22052205 }
22062206
22072207 ArgListTy &getArgs() {
2208 assert(Args && "Arguments must be set before accessing them");
2209 return *Args;
2208 return Args;
22102209 }
22112210 };
22122211
20592059
20602060 TargetLowering::CallLoweringInfo CLI(DAG);
20612061 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
2062 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
2062 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
20632063 .setTailCall(isTailCall).setSExtResult(isSigned).setZExtResult(!isSigned);
20642064
20652065 std::pair CallInfo = TLI.LowerCallTo(CLI);
20942094
20952095 TargetLowering::CallLoweringInfo CLI(DAG);
20962096 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
2097 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
2097 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
20982098 .setSExtResult(isSigned).setZExtResult(!isSigned);
20992099
21002100 std::pair CallInfo = TLI.LowerCallTo(CLI);
21282128
21292129 TargetLowering::CallLoweringInfo CLI(DAG);
21302130 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
2131 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
2131 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
21322132 .setSExtResult(isSigned).setZExtResult(!isSigned);
21332133
21342134 std::pair CallInfo = TLI.LowerCallTo(CLI);
22652265 SDLoc dl(Node);
22662266 TargetLowering::CallLoweringInfo CLI(DAG);
22672267 CLI.setDebugLoc(dl).setChain(InChain)
2268 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
2268 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
22692269 .setSExtResult(isSigned).setZExtResult(!isSigned);
22702270
22712271 std::pair CallInfo = TLI.LowerCallTo(CLI);
23802380 TargetLowering::CallLoweringInfo CLI(DAG);
23812381 CLI.setDebugLoc(dl).setChain(InChain)
23822382 .setCallee(TLI.getLibcallCallingConv(LC),
2383 Type::getVoidTy(*DAG.getContext()), Callee, &Args, 0);
2383 Type::getVoidTy(*DAG.getContext()), Callee, std::move(Args), 0);
23842384
23852385 std::pair CallInfo = TLI.LowerCallTo(CLI);
23862386
29982998 TargetLowering::CallLoweringInfo CLI(DAG);
29992999 CLI.setDebugLoc(dl).setChain(Node->getOperand(0))
30003000 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3001 DAG.getExternalSymbol("__sync_synchronize", TLI.getPointerTy()),
3002 &Args, 0);
3001 DAG.getExternalSymbol("__sync_synchronize",
3002 TLI.getPointerTy()), std::move(Args), 0);
30033003
30043004 std::pair CallResult = TLI.LowerCallTo(CLI);
30053005
30973097 TargetLowering::CallLoweringInfo CLI(DAG);
30983098 CLI.setDebugLoc(dl).setChain(Node->getOperand(0))
30993099 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
3100 DAG.getExternalSymbol("abort", TLI.getPointerTy()), &Args, 0);
3100 DAG.getExternalSymbol("abort", TLI.getPointerTy()),
3101 std::move(Args), 0);
31013102 std::pair CallResult = TLI.LowerCallTo(CLI);
31023103
31033104 Results.push_back(CallResult.second);
23472347
23482348 TargetLowering::CallLoweringInfo CLI(DAG);
23492349 CLI.setDebugLoc(dl).setChain(Chain)
2350 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Func, &Args, 0)
2350 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Func, std::move(Args), 0)
23512351 .setSExtResult();
23522352
23532353 std::pair CallInfo = TLI.LowerCallTo(CLI);
10531053
10541054 TargetLowering::CallLoweringInfo CLI(DAG);
10551055 CLI.setDebugLoc(SDLoc(Node)).setChain(InChain)
1056 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
1056 .setCallee(TLI.getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
10571057 .setSExtResult(isSigned).setZExtResult(!isSigned);
10581058
10591059 std::pair CallInfo = TLI.LowerCallTo(CLI);
41574157 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMCPY),
41584158 Type::getVoidTy(*getContext()),
41594159 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMCPY),
4160 TLI->getPointerTy()), &Args, 0)
4160 TLI->getPointerTy()), std::move(Args), 0)
41614161 .setDiscardResult();
41624162 std::pair CallResult = TLI->LowerCallTo(CLI);
41634163
42134213 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMMOVE),
42144214 Type::getVoidTy(*getContext()),
42154215 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMMOVE),
4216 TLI->getPointerTy()), &Args, 0)
4216 TLI->getPointerTy()), std::move(Args), 0)
42174217 .setDiscardResult();
42184218 std::pair CallResult = TLI->LowerCallTo(CLI);
42194219
42774277 .setCallee(TLI->getLibcallCallingConv(RTLIB::MEMSET),
42784278 Type::getVoidTy(*getContext()),
42794279 getExternalSymbol(TLI->getLibcallName(RTLIB::MEMSET),
4280 TLI->getPointerTy()), &Args, 0)
4280 TLI->getPointerTy()), std::move(Args), 0)
42814281 .setDiscardResult();
42824282
42834283 std::pair CallResult = TLI->LowerCallTo(CLI);
53215321 CLI.setDebugLoc(sdl).setChain(getRoot())
53225322 .setCallee(CallingConv::C, I.getType(),
53235323 DAG.getExternalSymbol(TrapFuncName.data(), TLI->getPointerTy()),
5324 &Args, 0);
5324 std::move(Args), 0);
53255325
53265326 std::pair Result = TLI->LowerCallTo(CLI);
53275327 DAG.setRoot(Result.second);
54945494
54955495 TargetLowering::CallLoweringInfo CLI(DAG);
54965496 CLI.setDebugLoc(getCurSDLoc()).setChain(getRoot())
5497 .setCallee(RetTy, FTy, Callee, &Args, CS).setTailCall(isTailCall);
5497 .setCallee(RetTy, FTy, Callee, std::move(Args), CS).setTailCall(isTailCall);
54985498
54995499 std::pair Result = TLI->LowerCallTo(CLI);
55005500 assert((isTailCall || Result.second.getNode()) &&
67976797 Type *retTy = useVoidTy ? Type::getVoidTy(*DAG.getContext()) : CI.getType();
67986798 TargetLowering::CallLoweringInfo CLI(DAG);
67996799 CLI.setDebugLoc(getCurSDLoc()).setChain(getRoot())
6800 .setCallee(CI.getCallingConv(), retTy, Callee, &Args, NumArgs)
6800 .setCallee(CI.getCallingConv(), retTy, Callee, std::move(Args), NumArgs)
68016801 .setDiscardResult(!CI.use_empty());
68026802
68036803 const TargetLowering *TLI = TM.getTargetLowering();
104104 Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
105105 TargetLowering::CallLoweringInfo CLI(DAG);
106106 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
107 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
107 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
108108 .setNoReturn(doesNotReturn).setDiscardResult(!isReturnValueUsed)
109109 .setSExtResult(isSigned).setZExtResult(!isSigned);
110110 return LowerCallTo(CLI);
15021502 StructType *RetTy = StructType::get(ArgTy, ArgTy, NULL);
15031503 TargetLowering::CallLoweringInfo CLI(DAG);
15041504 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
1505 .setCallee(CallingConv::Fast, RetTy, Callee, &Args, 0);
1505 .setCallee(CallingConv::Fast, RetTy, Callee, std::move(Args), 0);
15061506
15071507 std::pair CallResult = LowerCallTo(CLI);
15081508 return CallResult.first;
5050 TargetLowering::CallLoweringInfo CLI(DAG);
5151 CLI.setDebugLoc(dl).setChain(Chain)
5252 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
53 DAG.getExternalSymbol(bzeroEntry, IntPtr), &Args, 0)
53 DAG.getExternalSymbol(bzeroEntry, IntPtr), std::move(Args), 0)
5454 .setDiscardResult();
5555 std::pair CallResult = TLI.LowerCallTo(CLI);
5656 return CallResult.second;
23322332 TargetLowering::CallLoweringInfo CLI(DAG);
23332333 CLI.setDebugLoc(dl).setChain(Chain)
23342334 .setCallee(CallingConv::C, Type::getInt32Ty(*DAG.getContext()),
2335 DAG.getExternalSymbol("__tls_get_addr", PtrVT), &Args, 0);
2335 DAG.getExternalSymbol("__tls_get_addr", PtrVT), std::move(Args),
2336 0);
23362337
23372338 std::pair CallResult = LowerCallTo(CLI);
23382339 return CallResult.first;
60946095 TargetLowering::CallLoweringInfo CLI(DAG);
60956096 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
60966097 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()), Callee,
6097 &Args, 0)
6098 std::move(Args), 0)
60986099 .setDiscardResult();
60996100
61006101 std::pair CallResult = LowerCallTo(CLI);
1056310564 SDLoc dl(Op);
1056410565 TargetLowering::CallLoweringInfo CLI(DAG);
1056510566 CLI.setDebugLoc(dl).setChain(InChain)
10566 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, &Args, 0)
10567 .setCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args), 0)
1056710568 .setInRegister().setSExtResult(isSigned).setZExtResult(!isSigned);
1056810569
1056910570 std::pair CallInfo = LowerCallTo(CLI);
190190 .setCallee(TLI.getLibcallCallingConv(RTLIB::MEMSET),
191191 Type::getVoidTy(*DAG.getContext()),
192192 DAG.getExternalSymbol(TLI.getLibcallName(RTLIB::MEMSET),
193 TLI.getPointerTy()), &Args, 0)
193 TLI.getPointerTy()), std::move(Args), 0)
194194 .setDiscardResult();
195195
196196 std::pair CallResult = TLI.LowerCallTo(CLI);
16441644
16451645 TargetLowering::CallLoweringInfo CLI(DAG);
16461646 CLI.setDebugLoc(DL).setChain(DAG.getEntryNode())
1647 .setCallee(CallingConv::C, PtrTy, TlsGetAddr, &Args, 0);
1647 .setCallee(CallingConv::C, PtrTy, TlsGetAddr, std::move(Args), 0);
16481648 std::pair CallResult = LowerCallTo(CLI);
16491649
16501650 SDValue Ret = CallResult.first;
19351935 TargetLowering::CallLoweringInfo CLI(DAG);
19361936 CLI.setDebugLoc(dl).setChain(Chain)
19371937 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
1938 DAG.getExternalSymbol("__trampoline_setup", PtrVT), &Args, 0);
1938 DAG.getExternalSymbol("__trampoline_setup", PtrVT),
1939 std::move(Args), 0);
19391940
19401941 std::pair CallResult = LowerCallTo(CLI);
19411942 return CallResult.second;
20292029 }
20302030 TargetLowering::CallLoweringInfo CLI(DAG);
20312031 CLI.setDebugLoc(SDLoc(Op)).setChain(Chain)
2032 .setCallee(CallingConv::C, RetTyABI, Callee, &Args, 0);
2032 .setCallee(CallingConv::C, RetTyABI, Callee, std::move(Args), 0);
20332033
20342034 std::pair CallInfo = LowerCallTo(CLI);
20352035
20852085
20862086 TargetLowering::CallLoweringInfo CLI(DAG);
20872087 CLI.setDebugLoc(DL).setChain(Chain)
2088 .setCallee(CallingConv::C, RetTy, Callee, &Args, 0);
2088 .setCallee(CallingConv::C, RetTy, Callee, std::move(Args), 0);
20892089
20902090 std::pair CallInfo = LowerCallTo(CLI);
20912091
1508315083 CLI.setDebugLoc(dl).setChain(InChain)
1508415084 .setCallee(getLibcallCallingConv(LC),
1508515085 static_cast(MVT::v2i64).getTypeForEVT(*DAG.getContext()),
15086 Callee, &Args, 0)
15086 Callee, std::move(Args), 0)
1508715087 .setInRegister().setSExtResult(isSigned).setZExtResult(!isSigned);
1508815088
1508915089 std::pair CallInfo = LowerCallTo(CLI);
1608316083
1608416084 TargetLowering::CallLoweringInfo CLI(DAG);
1608516085 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
16086 .setCallee(CallingConv::C, RetTy, Callee, &Args, 0);
16086 .setCallee(CallingConv::C, RetTy, Callee, std::move(Args), 0);
1608716087
1608816088 std::pair CallResult = TLI.LowerCallTo(CLI);
1608916089
6565 TargetLowering::CallLoweringInfo CLI(DAG);
6666 CLI.setDebugLoc(dl).setChain(Chain)
6767 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
68 DAG.getExternalSymbol(bzeroEntry, IntPtr), &Args, 0)
68 DAG.getExternalSymbol(bzeroEntry, IntPtr), std::move(Args),
69 0)
6970 .setDiscardResult();
7071
7172 std::pair CallResult = DAG.getTargetLoweringInfo().LowerCallTo(CLI);
491491 CLI.setDebugLoc(DL).setChain(Chain)
492492 .setCallee(CallingConv::C, IntPtrTy,
493493 DAG.getExternalSymbol("__misaligned_load", getPointerTy()),
494 &Args, 0);
494 std::move(Args), 0);
495495
496496 std::pair CallResult = LowerCallTo(CLI);
497497 SDValue Ops[] = { CallResult.first, CallResult.second };
551551 CLI.setDebugLoc(dl).setChain(Chain)
552552 .setCallee(CallingConv::C, Type::getVoidTy(*DAG.getContext()),
553553 DAG.getExternalSymbol("__misaligned_store", getPointerTy()),
554 &Args, 0);
554 std::move(Args), 0);
555555
556556 std::pair CallResult = LowerCallTo(CLI);
557557 return CallResult.second;
4545 .setCallee(TLI.getLibcallCallingConv(RTLIB::MEMCPY),
4646 Type::getVoidTy(*DAG.getContext()),
4747 DAG.getExternalSymbol("__memcpy_4", TLI.getPointerTy()),
48 &Args, 0)
48 std::move(Args), 0)
4949 .setDiscardResult();
5050
5151 std::pair CallResult = TLI.LowerCallTo(CLI);