[llvm-commits] [llvm] r53225 - /llvm/trunk/include/llvm/Support/CallSite.h
Matthijs Kooijman
matthijs at stdin.nl
Tue Jul 8 01:51:47 PDT 2008
Author: matthijs
Date: Tue Jul 8 03:51:47 2008
New Revision: 53225
URL: http://llvm.org/viewvc/llvm-project?rev=53225&view=rev
Log:
Add CallSite::getArgumentNo() to be able to translate an operand number into a
argument number.
Modified:
llvm/trunk/include/llvm/Support/CallSite.h
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=53225&r1=53224&r2=53225&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Tue Jul 8 03:51:47 2008
@@ -133,6 +133,15 @@
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;
More information about the llvm-commits
mailing list