]> granicus.if.org Git - llvm/commitdiff
SafepointIRVerifier port to new Pass Manager
authorFedor Sergeev <fedor.sergeev@azul.com>
Sun, 31 Mar 2019 10:15:39 +0000 (10:15 +0000)
committerFedor Sergeev <fedor.sergeev@azul.com>
Sun, 31 Mar 2019 10:15:39 +0000 (10:15 +0000)
Straightforward port of StatepointIRVerifier pass to new Pass Manager framework.

Fix By: skatkov
Reviewed By: fedor.sergeev
Differential Revision: https://reviews.llvm.org/D59825

This is a re-land of r357147/r357148 with LLVM_ENABLE_MODULES build fixed.
Adding IR/SafepointIRVerifier.h into its own module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357361 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/SafepointIRVerifier.h
include/llvm/module.modulemap
lib/IR/SafepointIRVerifier.cpp
lib/Passes/PassBuilder.cpp
lib/Passes/PassRegistry.def

index cbdb8bd425643481c1281bedf484a7c2fc6e137e..ec5527954adcb65efb72e00f1fae496f88ab403e 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef LLVM_IR_SAFEPOINT_IR_VERIFIER
 #define LLVM_IR_SAFEPOINT_IR_VERIFIER
 
+#include "llvm/IR/PassManager.h"
+
 namespace llvm {
 
 class Function;
@@ -29,6 +31,16 @@ void verifySafepointIR(Function &F);
 /// Create an instance of the safepoint verifier pass which can be added to
 /// a pass pipeline to check for relocation bugs.
 FunctionPass *createSafepointIRVerifierPass();
+
+/// Create an instance of the safepoint verifier pass which can be added to
+/// a pass pipeline to check for relocation bugs.
+class SafepointIRVerifierPass : public PassInfoMixin<SafepointIRVerifierPass> {
+
+public:
+  explicit SafepointIRVerifierPass() {}
+
+  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
 }
 
 #endif // LLVM_IR_SAFEPOINT_IR_VERIFIER
index dc8a7f6441e1cb38ff8f1b7f1e351bc40d873f72..a7ecd0363691944f8da490ecab9ba45f9df22786 100644 (file)
@@ -236,6 +236,7 @@ module LLVM_intrinsic_gen {
   }
   module IR_IntrinsicInst { header "IR/IntrinsicInst.h" export * }
   module IR_PatternMatch { header "IR/PatternMatch.h" export * }
+  module IR_SafepointIRVerifier { header "IR/SafepointIRVerifier.h" export * }
   module IR_Statepoint { header "IR/Statepoint.h" export * }
 
   export *
index 217f10e864d15f2fbd70ed57ddc88ac01e77c0d7..7f3dea5e6a6d2701b36c9f9c68bfb1e06ab5476e 100644 (file)
@@ -197,6 +197,17 @@ protected:
 static void Verify(const Function &F, const DominatorTree &DT,
                    const CFGDeadness &CD);
 
+namespace llvm {
+PreservedAnalyses SafepointIRVerifierPass::run(Function &F,
+                                               FunctionAnalysisManager &AM) {
+  const auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+  CFGDeadness CD;
+  CD.processFunction(F, DT);
+  Verify(F, DT, CD);
+  return PreservedAnalyses::all();
+}
+}
+
 namespace {
 
 struct SafepointIRVerifier : public FunctionPass {
index ba0d6c2bd684a439007003c62b894dfa9598d5c0..a36956e121ce49b7091eba9585c37a04609a5c9a 100644 (file)
@@ -56,6 +56,7 @@
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/IRPrintingPasses.h"
 #include "llvm/IR/PassManager.h"
+#include "llvm/IR/SafepointIRVerifier.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
index 2bf5222a385f4583afb24eeb7f79592ec3abda64..518b10dc5d5915823c45078e2f90d6fbcbabebb2 100644 (file)
@@ -231,6 +231,7 @@ FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
 FUNCTION_PASS("verify<loops>", LoopVerifierPass())
 FUNCTION_PASS("verify<memoryssa>", MemorySSAVerifierPass())
 FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
+FUNCTION_PASS("verify<safepoint-ir>", SafepointIRVerifierPass())
 FUNCTION_PASS("view-cfg", CFGViewerPass())
 FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass())
 FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())