From: Matthijs Kooijman Date: Tue, 8 Jul 2008 08:51:47 +0000 (+0000) Subject: Add CallSite::getArgumentNo() to be able to translate an operand number into a X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b3739424dadf3b12579c4b838326a657a92815fa;p=oota-llvm.git 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 --- diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h index dfb3b5eae1a..ce95cc5aaac 100644 --- a/include/llvm/Support/CallSite.h +++ b/include/llvm/Support/CallSite.h @@ -133,6 +133,15 @@ public: 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 /// argument to the called function. bool hasArgument(const Value *Arg) const;