mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
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
This commit is contained in:
@ -944,6 +944,9 @@ public:
|
|||||||
/// @deprecated these "define hacks" will go away soon
|
/// @deprecated these "define hacks" will go away soon
|
||||||
/// @brief coerce out-of-tree code to abandon the low-level interfaces
|
/// @brief coerce out-of-tree code to abandon the low-level interfaces
|
||||||
/// @detail see below comments and update your code to high-level interfaces
|
/// @detail see below comments and update your code to high-level interfaces
|
||||||
|
/// - getOperand(0) ---> getCalledValue(), or possibly getCalledFunction
|
||||||
|
/// - setOperand(0, V) ---> setCalledFunction(V)
|
||||||
|
///
|
||||||
/// in LLVM v2.8-only code
|
/// in LLVM v2.8-only code
|
||||||
/// - getOperand(N+1) ---> getArgOperand(N)
|
/// - getOperand(N+1) ---> getArgOperand(N)
|
||||||
/// - setOperand(N+1, V) ---> setArgOperand(N, V)
|
/// - setOperand(N+1, V) ---> setArgOperand(N, V)
|
||||||
@ -961,23 +964,11 @@ public:
|
|||||||
# undef protected
|
# undef protected
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum { ArgOffset = 1 }; ///< temporary, do not use for new code!
|
enum { ArgOffset = 0 }; ///< temporary, do not use for new code!
|
||||||
unsigned getNumArgOperands() const { return getNumOperands() - 1; }
|
unsigned getNumArgOperands() const { return getNumOperands() - 1; }
|
||||||
Value *getArgOperand(unsigned i) const { return getOperand(i + ArgOffset); }
|
Value *getArgOperand(unsigned i) const { return getOperand(i + ArgOffset); }
|
||||||
void setArgOperand(unsigned i, Value *v) { setOperand(i + ArgOffset, v); }
|
void setArgOperand(unsigned i, Value *v) { setOperand(i + ArgOffset, v); }
|
||||||
|
|
||||||
/// Provide compile-time errors for accessing operand 0
|
|
||||||
/// @deprecated these will go away soon
|
|
||||||
/// @detail see below comments and update your code to high-level interfaces
|
|
||||||
/// - getOperand(0) ---> getCalledValue(), or possibly getCalledFunction
|
|
||||||
/// - setOperand(0, V) ---> setCalledFunction(V)
|
|
||||||
///
|
|
||||||
private:
|
|
||||||
void getOperand(void*); // NO IMPL ---> use getCalledValue (or possibly
|
|
||||||
// getCalledFunction) instead
|
|
||||||
void setOperand(void*, Value*); // NO IMPL ---> use setCalledFunction instead
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// getCallingConv/setCallingConv - Get or set the calling convention of this
|
/// getCallingConv/setCallingConv - Get or set the calling convention of this
|
||||||
/// function call.
|
/// function call.
|
||||||
CallingConv::ID getCallingConv() const {
|
CallingConv::ID getCallingConv() const {
|
||||||
|
@ -1400,18 +1400,18 @@ void CppWriter::printInstruction(const Instruction *I,
|
|||||||
Out << "std::vector<Value*> " << iName << "_params;";
|
Out << "std::vector<Value*> " << iName << "_params;";
|
||||||
nl(Out);
|
nl(Out);
|
||||||
for (unsigned i = 0; i < call->getNumArgOperands(); ++i) {
|
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);
|
nl(Out);
|
||||||
}
|
}
|
||||||
Out << "CallInst* " << iName << " = CallInst::Create("
|
Out << "CallInst* " << iName << " = CallInst::Create("
|
||||||
<< opNames[0] << ", " << iName << "_params.begin(), "
|
<< opNames[call->getNumArgOperands()] << ", " << iName << "_params.begin(), "
|
||||||
<< iName << "_params.end(), \"";
|
<< iName << "_params.end(), \"";
|
||||||
} else if (call->getNumArgOperands() == 1) {
|
} else if (call->getNumArgOperands() == 1) {
|
||||||
Out << "CallInst* " << iName << " = CallInst::Create("
|
Out << "CallInst* " << iName << " = CallInst::Create("
|
||||||
<< opNames[0] << ", " << opNames[1] << ", \"";
|
<< opNames[call->getNumArgOperands()] << ", " << opNames[0] << ", \"";
|
||||||
} else {
|
} else {
|
||||||
Out << "CallInst* " << iName << " = CallInst::Create(" << opNames[0]
|
Out << "CallInst* " << iName << " = CallInst::Create("
|
||||||
<< ", \"";
|
<< opNames[call->getNumArgOperands()] << ", \"";
|
||||||
}
|
}
|
||||||
printEscapedString(call->getName());
|
printEscapedString(call->getName());
|
||||||
Out << "\", " << bbname << ");";
|
Out << "\", " << bbname << ");";
|
||||||
|
@ -1454,7 +1454,7 @@ void Verifier::visitInstruction(Instruction &I) {
|
|||||||
if (Function *F = dyn_cast<Function>(I.getOperand(i))) {
|
if (Function *F = dyn_cast<Function>(I.getOperand(i))) {
|
||||||
// Check to make sure that the "address of" an intrinsic function is never
|
// Check to make sure that the "address of" an intrinsic function is never
|
||||||
// taken.
|
// 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);
|
"Cannot take the address of an intrinsic!", &I);
|
||||||
Assert1(F->getParent() == Mod, "Referencing function in another module!",
|
Assert1(F->getParent() == Mod, "Referencing function in another module!",
|
||||||
&I);
|
&I);
|
||||||
@ -1537,7 +1537,8 @@ void Verifier::visitInstruction(Instruction &I) {
|
|||||||
"Instruction does not dominate all uses!", Op, &I);
|
"Instruction does not dominate all uses!", Op, &I);
|
||||||
}
|
}
|
||||||
} else if (isa<InlineAsm>(I.getOperand(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);
|
"Cannot take the address of an inline asm!", &I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user