[PATCH] D48279: [PatternMatch] Add m_Store pattern match helper
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 18 06:43:23 PDT 2018
SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: spatel, craig.topper, samparker.
Looks like we don't add tests for this, but I am planning on using it in https://reviews.llvm.org/D48128
https://reviews.llvm.org/D48279
Files:
include/llvm/IR/PatternMatch.h
Index: include/llvm/IR/PatternMatch.h
===================================================================
--- include/llvm/IR/PatternMatch.h
+++ include/llvm/IR/PatternMatch.h
@@ -1193,6 +1193,27 @@
}
//===----------------------------------------------------------------------===//
+// Matcher for StoreInst classes
+//
+
+template <typename Op_t> struct StoreClass_match {
+ Op_t Op;
+
+ StoreClass_match(const Op_t &OpMatch) : Op(OpMatch) {}
+
+ template <typename OpTy> bool match(OpTy *V) {
+ if (auto *LI = dyn_cast<StoreInst>(V))
+ return Op.match(LI->getPointerOperand());
+ return false;
+ }
+};
+
+/// Matches StoreInst.
+template <typename OpTy> inline StoreClass_match<OpTy> m_Store(const OpTy &Op) {
+ return StoreClass_match<OpTy>(Op);
+}
+
+//===----------------------------------------------------------------------===//
// Matchers for unary operators
//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48279.151704.patch
Type: text/x-patch
Size: 895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/75cfb2de/attachment.bin>
More information about the llvm-commits
mailing list