diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-07-13 15:31:36 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-07-13 15:31:36 +0000 |
commit | 63d024fc9a4f89987fa2cf7ab466ea17ec78ed14 (patch) | |
tree | 5b68f34a7f7b021e6d68f19d375e92f2e59f051e /lib | |
parent | 26fe25f6517238fd113f280863ffe0fbe237dd7c (diff) |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 10 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 46a4ca4437..145568adcd 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1400,18 +1400,18 @@ void CppWriter::printInstruction(const Instruction *I, Out << "std::vector<Value*> " << iName << "_params;"; nl(Out); for (unsigned i = 0; i < call->getNumArgOperands(); ++i) { - Out << iName << "_params.push_back(" << opNames[i+1] << ");"; + Out << iName << "_params.push_back(" << opNames[i] << ");"; nl(Out); } Out << "CallInst* " << iName << " = CallInst::Create(" - << opNames[0] << ", " << iName << "_params.begin(), " + << opNames[call->getNumArgOperands()] << ", " << iName << "_params.begin(), " << iName << "_params.end(), \""; } else if (call->getNumArgOperands() == 1) { Out << "CallInst* " << iName << " = CallInst::Create(" - << opNames[0] << ", " << opNames[1] << ", \""; + << opNames[call->getNumArgOperands()] << ", " << opNames[0] << ", \""; } else { - Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0] - << ", \""; + Out << "CallInst* " << iName << " = CallInst::Create(" + << opNames[call->getNumArgOperands()] << ", \""; } printEscapedString(call->getName()); Out << "\", " << bbname << ");"; diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 383f062a05..f97699dabd 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -1454,7 +1454,7 @@ void Verifier::visitInstruction(Instruction &I) { if (Function *F = dyn_cast<Function>(I.getOperand(i))) { // Check to make sure that the "address of" an intrinsic function is never // taken. - Assert1(!F->isIntrinsic() || (i == 0 && isa<CallInst>(I)), + Assert1(!F->isIntrinsic() || (i + 1 == e && isa<CallInst>(I)), "Cannot take the address of an intrinsic!", &I); Assert1(F->getParent() == Mod, "Referencing function in another module!", &I); @@ -1537,7 +1537,8 @@ void Verifier::visitInstruction(Instruction &I) { "Instruction does not dominate all uses!", Op, &I); } } else if (isa<InlineAsm>(I.getOperand(i))) { - Assert1((i == 0 && isa<CallInst>(I)) || (i + 3 == e && isa<InvokeInst>(I)), + Assert1((i + 1 == e && isa<CallInst>(I)) || + (i + 3 == e && isa<InvokeInst>(I)), "Cannot take the address of an inline asm!", &I); } } |