[llvm-commits] [llvm] r59393 - /llvm/trunk/include/llvm/Support/PatternMatch.h
Chris Lattner
sabre at nondot.org
Sat Nov 15 20:38:31 PST 2008
Author: lattner
Date: Sat Nov 15 22:38:30 2008
New Revision: 59393
URL: http://llvm.org/viewvc/llvm-project?rev=59393&view=rev
Log:
add a new m_Specific pattern that matches only if we have a specific Value*.
Modified:
llvm/trunk/include/llvm/Support/PatternMatch.h
Modified: llvm/trunk/include/llvm/Support/PatternMatch.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PatternMatch.h?rev=59393&r1=59392&r2=59393&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PatternMatch.h (original)
+++ llvm/trunk/include/llvm/Support/PatternMatch.h Sat Nov 15 22:38:30 2008
@@ -100,6 +100,21 @@
/// 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.
More information about the llvm-commits
mailing list