From: Fedor Sergeev Date: Sun, 31 Mar 2019 10:15:39 +0000 (+0000) Subject: SafepointIRVerifier port to new Pass Manager X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=129c32597bb588c21d0fc744dd3870ae37632e58;p=llvm SafepointIRVerifier port to new Pass Manager 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 --- diff --git a/include/llvm/IR/SafepointIRVerifier.h b/include/llvm/IR/SafepointIRVerifier.h index cbdb8bd4256..ec5527954ad 100644 --- a/include/llvm/IR/SafepointIRVerifier.h +++ b/include/llvm/IR/SafepointIRVerifier.h @@ -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 { + +public: + explicit SafepointIRVerifierPass() {} + + PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); +}; } #endif // LLVM_IR_SAFEPOINT_IR_VERIFIER diff --git a/include/llvm/module.modulemap b/include/llvm/module.modulemap index dc8a7f6441e..a7ecd036369 100644 --- a/include/llvm/module.modulemap +++ b/include/llvm/module.modulemap @@ -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 * diff --git a/lib/IR/SafepointIRVerifier.cpp b/lib/IR/SafepointIRVerifier.cpp index 217f10e864d..7f3dea5e6a6 100644 --- a/lib/IR/SafepointIRVerifier.cpp +++ b/lib/IR/SafepointIRVerifier.cpp @@ -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(F); + CFGDeadness CD; + CD.processFunction(F, DT); + Verify(F, DT, CD); + return PreservedAnalyses::all(); +} +} + namespace { struct SafepointIRVerifier : public FunctionPass { diff --git a/lib/Passes/PassBuilder.cpp b/lib/Passes/PassBuilder.cpp index ba0d6c2bd68..a36956e121c 100644 --- a/lib/Passes/PassBuilder.cpp +++ b/lib/Passes/PassBuilder.cpp @@ -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" diff --git a/lib/Passes/PassRegistry.def b/lib/Passes/PassRegistry.def index 2bf5222a385..518b10dc5d5 100644 --- a/lib/Passes/PassRegistry.def +++ b/lib/Passes/PassRegistry.def @@ -231,6 +231,7 @@ FUNCTION_PASS("verify", DominatorTreeVerifierPass()) FUNCTION_PASS("verify", LoopVerifierPass()) FUNCTION_PASS("verify", MemorySSAVerifierPass()) FUNCTION_PASS("verify", RegionInfoVerifierPass()) +FUNCTION_PASS("verify", SafepointIRVerifierPass()) FUNCTION_PASS("view-cfg", CFGViewerPass()) FUNCTION_PASS("view-cfg-only", CFGOnlyViewerPass()) FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())