diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:38:30 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:38:30 +0000 |
commit | 50b9a15a43cf7e15072160074bae697859d2a448 (patch) | |
tree | c17b663095b85aa2af5b043ff53f3174eadb6f2e | |
parent | fae5e331115b5a1e674ede64880e835825b4f1c6 (diff) | |
download | bcm5719-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.h | 15 |
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. |