Add CallSite::getArgumentNo() to be able to translate an operand number into a

argument number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53225 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthijs Kooijman 2008-07-08 08:51:47 +00:00
parent 8c174a9b5a
commit b3739424da

View File

@ -133,6 +133,15 @@ public:
I->setOperand(getArgumentOffset() + ArgNo, newVal); I->setOperand(getArgumentOffset() + ArgNo, newVal);
} }
/// Given an operand number, returns the argument that corresponds to it.
/// OperandNo must be a valid operand number that actually corresponds to an
/// argument.
unsigned getArgumentNo(unsigned OperandNo) const {
assert(OperandNo >= getArgumentOffset() && "Operand number passed was not "
"a valid argument");
return OperandNo - getArgumentOffset();
}
/// hasArgument - Returns true if this CallSite passes the given Value* as an /// hasArgument - Returns true if this CallSite passes the given Value* as an
/// argument to the called function. /// argument to the called function.
bool hasArgument(const Value *Arg) const; bool hasArgument(const Value *Arg) const;