aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Support/PatternMatch.h
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2011-02-01 09:06:20 +0000
committerDuncan Sands <baldrick@free.fr>2011-02-01 09:06:20 +0000
commitf9e4a986c03fe3af7dbc9de0b0a9251280fbdf41 (patch)
treea23d44f0ee01755ac75b94593e56ef71cd4b2f13 /include/llvm/Support/PatternMatch.h
parent93c780288df9631d11f996b010b2212a8b44d4d3 (diff)
Add a m_Undef pattern for convenience. This is so that code that uses
pattern matching can also pattern match undef, creating a more uniform style. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124657 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PatternMatch.h')
-rw-r--r--include/llvm/Support/PatternMatch.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h
index ea065a769e..cb94fe5f6e 100644
--- a/include/llvm/Support/PatternMatch.h
+++ b/include/llvm/Support/PatternMatch.h
@@ -75,6 +75,16 @@ inline constantint_ty<Val> m_ConstantInt() {
return constantint_ty<Val>();
}
+struct undef_ty {
+ template<typename ITy>
+ bool match(ITy *V) {
+ return isa<UndefValue>(V);
+ }
+};
+
+/// m_Undef() - Match an arbitrary undef constant.
+inline undef_ty m_Undef() { return undef_ty(); }
+
struct zero_ty {
template<typename ITy>
bool match(ITy *V) {