summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-01-20 11:34:08 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-01-20 11:34:08 +0000
commit1d9ab2556024514c403135bb8fe5da34fc4f0c63 (patch)
tree527695cc0c1fb52c6e85df1a39bdb48cd60bb516 /include
parent843fa74d3851e93abf5f534f9a98021282ab3dbd (diff)
[PM] Wire up the Verifier for the new pass manager and connect it to the
various opt verifier commandline options. Mostly mechanical wiring of the verifier to the new pass manager. Exercises one of the more unusual aspects of it -- a pass can be either a module or function pass interchangably. If this is ever problematic, we can make things more constrained, but for things like the verifier where there is an "obvious" applicability at both levels, it seems convenient. This is the next-to-last piece of basic functionality left to make the opt commandline driving of the new pass manager minimally functional for testing and further development. There is still a lot to be done there (notably the factoring into .def files to kill the current boilerplate code) but it is relatively uninteresting. The only interesting bit left for minimal functionality is supporting the registration of analyses. I'm planning on doing that on top of the .def file switch mostly because the boilerplate for the analyses would be significantly worse. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199646 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/Verifier.h18
-rw-r--r--include/llvm/InitializePasses.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/include/llvm/IR/Verifier.h b/include/llvm/IR/Verifier.h
index 0f146e6936d..9a2f402ac8f 100644
--- a/include/llvm/IR/Verifier.h
+++ b/include/llvm/IR/Verifier.h
@@ -21,13 +21,15 @@
#ifndef LLVM_IR_VERIFIER_H
#define LLVM_IR_VERIFIER_H
+#include "llvm/ADT/StringRef.h"
#include <string>
namespace llvm {
+class Function;
class FunctionPass;
class Module;
-class Function;
+class PreservedAnalyses;
class raw_ostream;
/// \brief Check a function for errors, useful for use when debugging a
@@ -52,8 +54,22 @@ bool verifyModule(const Module &M, raw_ostream *OS = 0);
/// functionality. When the pass detects a verification error it is always
/// printed to stderr, and by default they are fatal. You can override that by
/// passing \c false to \p FatalErrors.
+///
+/// Note that this creates a pass suitable for the legacy pass manager. It has nothing to do with \c VerifierPass.
FunctionPass *createVerifierPass(bool FatalErrors = true);
+class VerifierPass {
+ bool FatalErrors;
+
+public:
+ explicit VerifierPass(bool FatalErrors = true) : FatalErrors(FatalErrors) {}
+
+ PreservedAnalyses run(Module *M);
+ PreservedAnalyses run(Function *F);
+
+ static StringRef name() { return "VerifierPass"; }
+};
+
} // End llvm namespace
#endif
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h
index e08e0c4baf2..36efee570b4 100644
--- a/include/llvm/InitializePasses.h
+++ b/include/llvm/InitializePasses.h
@@ -256,7 +256,7 @@ void initializeTypeBasedAliasAnalysisPass(PassRegistry&);
void initializeUnifyFunctionExitNodesPass(PassRegistry&);
void initializeUnreachableBlockElimPass(PassRegistry&);
void initializeUnreachableMachineBlockElimPass(PassRegistry&);
-void initializeVerifierPassPass(PassRegistry&);
+void initializeVerifierLegacyPassPass(PassRegistry&);
void initializeVirtRegMapPass(PassRegistry&);
void initializeVirtRegRewriterPass(PassRegistry&);
void initializeInstSimplifierPass(PassRegistry&);