From a236c89ee3b920751a0abca593b1603515a5a43a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 16 Nov 2008 04:38:30 +0000 Subject: [PATCH] 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 --- include/llvm/Support/PatternMatch.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index f5356a6edd2..24f4fe61374 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -100,6 +100,21 @@ inline bind_ty m_Value(Value *&V) { return V; } /// m_ConstantInt - Match a ConstantInt, capturing the value if we match. inline bind_ty 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 + 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. -- 2.34.1