add a new m_Specific pattern that matches only if we have a specific Value*.
authorChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 04:38:30 +0000 (04:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2008 04:38:30 +0000 (04:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59393 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PatternMatch.h

index f5356a6edd2540eae6312eb9b29780be54c63923..24f4fe613744405913737b46608425a0a80c00c9 100644 (file)
@@ -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.