diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-20 17:56:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-20 17:56:53 +0000 |
commit | 22d26d7c7d7c9666d0da0e51250586da5a0744da (patch) | |
tree | 2aef60a605f9ccb8c9ded541203f385e0b1846d0 /tools | |
parent | 0b91acf5db507f0800c1c51e85e1e3f324322ef1 (diff) | |
download | external_llvm-22d26d7c7d7c9666d0da0e51250586da5a0744da.zip external_llvm-22d26d7c7d7c9666d0da0e51250586da5a0744da.tar.gz external_llvm-22d26d7c7d7c9666d0da0e51250586da5a0744da.tar.bz2 |
* Expose the verifier pass as one that can be ran
* Force the verifier to run before bytecode is written
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/opt/opt.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 13a0774..2d77306 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -11,6 +11,7 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Bytecode/WriteBytecodePass.h" #include "llvm/Assembly/PrintModulePass.h" +#include "llvm/Analysis/Verifier.h" #include "llvm/Transforms/UnifyMethodExitNodes.h" #include "llvm/Transforms/ConstantMerge.h" #include "llvm/Transforms/CleanupGCCOutput.h" @@ -36,7 +37,10 @@ enum Opts { dce, constprop, inlining, constmerge, strip, mstrip, mergereturn, // Miscellaneous Transformations - trace, tracem, print, raiseallocs, cleangcc, + trace, tracem, raiseallocs, cleangcc, + + // Printing and verifying... + print, verify, // More powerful optimizations indvars, instcombine, sccp, adce, raise, mem2reg, @@ -93,6 +97,7 @@ struct { { trace , New<InsertTraceCode, bool, true, bool, true> }, { tracem , New<InsertTraceCode, bool, false, bool, true> }, { print , NewPrintMethodPass }, + { verify , createVerifierPass }, { raiseallocs, New<RaiseAllocations> }, { cleangcc , New<CleanupGCCOutput> }, { globaldce , New<GlobalDCE> }, @@ -134,7 +139,9 @@ cl::EnumList<enum Opts> OptimizationList(cl::NoFlags, clEnumVal(raise , "Raise to Higher Level"), clEnumVal(trace , "Insert BB & Method trace code"), clEnumVal(tracem , "Insert Method trace code only"), + clEnumVal(print , "Print working method to stderr"), + clEnumVal(verify , "Verify module is well formed"), 0); @@ -185,6 +192,9 @@ int main(int argc, char **argv) { Passes.add(new PrintModulePass(&std::cerr)); } + // Check that the module is well formed on completion of optimization + Passes.add(createVerifierPass()); + // Write bytecode out to disk or cout as the last step... Passes.add(new WriteBytecodePass(Out, Out != &std::cout)); |