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 | a236c89ee3b920751a0abca593b1603515a5a43a (patch) | |
tree | ffe864823a65862774438552443c317862ed9218 /include/llvm/Support | |
parent | 321e6a6e82e5908a3703777ddf9567b066c8e72a (diff) |
add a new m_Specific pattern that matches only if we have a specific Value*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/PatternMatch.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index f5356a6edd..24f4fe6137 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/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. |