aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-04 16:31:12 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-04 16:31:12 +0000
commit6df01501b102dca2ceceabedbb644ba51e09cc5a (patch)
tree105564af6cfe5909b3013049cc379daf32342c59
parent42979a57d6a3edc0ee70abb92a26f236de8270d1 (diff)
downloadexternal_llvm-6df01501b102dca2ceceabedbb644ba51e09cc5a.zip
external_llvm-6df01501b102dca2ceceabedbb644ba51e09cc5a.tar.gz
external_llvm-6df01501b102dca2ceceabedbb644ba51e09cc5a.tar.bz2
Add CallSite::hasArgument to allow for seeing if a call passes a certain value as an argument quickly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51946 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/CallSite.h4
-rw-r--r--lib/VMCore/Instructions.cpp7
2 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h
index f118680..513269f 100644
--- a/include/llvm/Support/CallSite.h
+++ b/include/llvm/Support/CallSite.h
@@ -129,6 +129,10 @@ public:
else
I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB
}
+
+ /// hasArgument - Returns true if this CallSite passes the given Value* as an
+ /// argument to the called function.
+ bool hasArgument(Value *Arg);
/// arg_iterator - The type of iterator to use when looping over actual
/// arguments at this call site...
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 3fb1c61..d789267 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -91,6 +91,13 @@ void CallSite::setDoesNotThrow(bool doesNotThrow) {
cast<InvokeInst>(I)->setDoesNotThrow(doesNotThrow);
}
+bool CallSite::hasArgument(Value *Arg) {
+ for (arg_iterator AI = this->arg_begin(), E = this->arg_end(); AI != E; ++AI)
+ if (AI->get() == Arg)
+ return true;
+ return false;
+}
+
//===----------------------------------------------------------------------===//
// TerminatorInst Class
//===----------------------------------------------------------------------===//