llvm.org GIT mirror llvm / 63d024f
rotate CallInst operands with this commit the callee moves to the end of the operand array (from the start) and the call arguments now start at index 0 (formerly 1) this ordering is now consistent with InvokeInst this commit only flips the switch, functionally it is equivalent to r101465 I intend to commit several cleanups after a few days of soak period git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108240 91177308-0d34-0410-b5e6-96231b3b80d8 Gabor Greif 10 years ago
3 changed file(s) with 12 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
943943 /// @deprecated these "define hacks" will go away soon
944944 /// @brief coerce out-of-tree code to abandon the low-level interfaces
945945 /// @detail see below comments and update your code to high-level interfaces
946 /// - getOperand(0) ---> getCalledValue(), or possibly getCalledFunction
947 /// - setOperand(0, V) ---> setCalledFunction(V)
948 ///
946949 /// in LLVM v2.8-only code
947950 /// - getOperand(N+1) ---> getArgOperand(N)
948951 /// - setOperand(N+1, V) ---> setArgOperand(N, V)
960963 # undef protected
961964 public:
962965
963 enum { ArgOffset = 1 }; ///< temporary, do not use for new code!
966 enum { ArgOffset = 0 }; ///< temporary, do not use for new code!
964967 unsigned getNumArgOperands() const { return getNumOperands() - 1; }
965968 Value *getArgOperand(unsigned i) const { return getOperand(i + ArgOffset); }
966969 void setArgOperand(unsigned i, Value *v) { setOperand(i + ArgOffset, v); }
967
968 /// Provide compile-time errors for accessing operand 0
969 /// @deprecated these will go away soon
970 /// @detail see below comments and update your code to high-level interfaces
971 /// - getOperand(0) ---> getCalledValue(), or possibly getCalledFunction
972 /// - setOperand(0, V) ---> setCalledFunction(V)
973 ///
974 private:
975 void getOperand(void*); // NO IMPL ---> use getCalledValue (or possibly
976 // getCalledFunction) instead
977 void setOperand(void*, Value*); // NO IMPL ---> use setCalledFunction instead
978 public:
979970
980971 /// getCallingConv/setCallingConv - Get or set the calling convention of this
981972 /// function call.
13991399 Out << "std::vector " << iName << "_params;";
14001400 nl(Out);
14011401 for (unsigned i = 0; i < call->getNumArgOperands(); ++i) {
1402 Out << iName << "_params.push_back(" << opNames[i+1] << ");";
1402 Out << iName << "_params.push_back(" << opNames[i] << ");";
14031403 nl(Out);
14041404 }
14051405 Out << "CallInst* " << iName << " = CallInst::Create("
1406 << opNames[0] << ", " << iName << "_params.begin(), "
1406 << opNames[call->getNumArgOperands()] << ", " << iName << "_params.begin(), "
14071407 << iName << "_params.end(), \"";
14081408 } else if (call->getNumArgOperands() == 1) {
14091409 Out << "CallInst* " << iName << " = CallInst::Create("
1410 << opNames[0] << ", " << opNames[1] << ", \"";
1410 << opNames[call->getNumArgOperands()] << ", " << opNames[0] << ", \"";
14111411 } else {
1412 Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0]
1413 << ", \"";
1412 Out << "CallInst* " << iName << " = CallInst::Create("
1413 << opNames[call->getNumArgOperands()] << ", \"";
14141414 }
14151415 printEscapedString(call->getName());
14161416 Out << "\", " << bbname << ");";
14531453 if (Function *F = dyn_cast(I.getOperand(i))) {
14541454 // Check to make sure that the "address of" an intrinsic function is never
14551455 // taken.
1456 Assert1(!F->isIntrinsic() || (i == 0 && isa(I)),
1456 Assert1(!F->isIntrinsic() || (i + 1 == e && isa(I)),
14571457 "Cannot take the address of an intrinsic!", &I);
14581458 Assert1(F->getParent() == Mod, "Referencing function in another module!",
14591459 &I);
15361536 "Instruction does not dominate all uses!", Op, &I);
15371537 }
15381538 } else if (isa(I.getOperand(i))) {
1539 Assert1((i == 0 && isa(I)) || (i + 3 == e && isa(I)),
1539 Assert1((i + 1 == e && isa(I)) ||
1540 (i + 3 == e && isa(I)),
15401541 "Cannot take the address of an inline asm!", &I);
15411542 }
15421543 }