summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-16 04:38:30 +0000
committerChris Lattner <sabre@nondot.org>2008-11-16 04:38:30 +0000
commit50b9a15a43cf7e15072160074bae697859d2a448 (patch)
treec17b663095b85aa2af5b043ff53f3174eadb6f2e
parentfae5e331115b5a1e674ede64880e835825b4f1c6 (diff)
downloadbcm5719-llvm-50b9a15a43cf7e15072160074bae697859d2a448.tar.gz
bcm5719-llvm-50b9a15a43cf7e15072160074bae697859d2a448.zip
add a new m_Specific pattern that matches only if we have a specific Value*.
llvm-svn: 59393
-rw-r--r--llvm/include/llvm/Support/PatternMatch.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/PatternMatch.h b/llvm/include/llvm/Support/PatternMatch.h
index f5356a6edd2..24f4fe61374 100644
--- a/llvm/include/llvm/Support/PatternMatch.h
+++ b/llvm/include/llvm/Support/PatternMatch.h
@@ -100,6 +100,21 @@ inline bind_ty<Value> m_Value(Value *&V) { return V; }
/// m_ConstantInt - Match a ConstantInt, capturing the value if we match.
inline bind_ty<ConstantInt> m_ConstantInt(ConstantInt *&CI) { return CI; }
+
+/// specificval_ty - Match a specified Value*.
+struct specificval_ty {
+ const Value *Val;
+ specificval_ty(const Value *V) : Val(V) {}
+
+ template<typename ITy>
+ bool match(ITy *V) {
+ return V == Val;
+ }
+};
+
+/// m_Specific - Match if we have a specific specified value.
+inline specificval_ty m_Specific(const Value *V) { return V; }
+
//===----------------------------------------------------------------------===//
// Matchers for specific binary operators.
OpenPOWER on IntegriCloud