From b3739424dadf3b12579c4b838326a657a92815fa Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 8 Jul 2008 08:51:47 +0000 Subject: [PATCH] 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 --- include/llvm/Support/CallSite.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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;