[llvm-commits] CVS: llvm/tools/llc/llc.cpp
Reid Spencer
reid at x10sys.com
Wed Jul 27 19:25:41 PDT 2005
Changes in directory llvm/tools/llc:
llc.cpp updated: 1.108 -> 1.109
---
Log message:
Make the verifier pass run (in debug mode) in llc. This adds a sanity check
to llc when debugging. Also allow other passes to be run from llc.
Patch contributed by Michael McCracken.
---
Diffs of the changes: (+29 -0)
llc.cpp | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+)
Index: llvm/tools/llc/llc.cpp
diff -u llvm/tools/llc/llc.cpp:1.108 llvm/tools/llc/llc.cpp:1.109
--- llvm/tools/llc/llc.cpp:1.108 Fri Jun 24 22:32:05 2005
+++ llvm/tools/llc/llc.cpp Wed Jul 27 21:25:30 2005
@@ -22,6 +22,8 @@
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/PluginLoader.h"
+#include "llvm/Support/PassNameParser.h"
+#include "llvm/Analysis/Verifier.h"
#include "llvm/System/Signals.h"
#include "llvm/Config/config.h"
#include <fstream>
@@ -57,6 +59,14 @@
" Emit a native dynamic library ('.so') file"),
clEnumValEnd));
+// The LLCPassList is populated with passes that were registered using
+// PassInfo::LLC by the FilteredPassNameParser:
+cl::list<const PassInfo*, bool, FilteredPassNameParser<PassInfo::LLC> >
+LLCPassList(cl::desc("Passes Available"));
+
+cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
+ cl::desc("Do not verify input module"));
+
// GetFileNameRoot - Helper function to get the basename of a filename.
static inline std::string
@@ -113,6 +123,25 @@
PassManager Passes;
Passes.add(new TargetData(TD));
+#ifndef NDEBUG
+ if(!NoVerify)
+ Passes.add(createVerifierPass());
+#endif
+
+ // Create a new pass for each one specified on the command line
+ for (unsigned i = 0; i < LLCPassList.size(); ++i) {
+ const PassInfo *aPass = LLCPassList[i];
+
+ if (aPass->getNormalCtor()) {
+ Pass *P = aPass->getNormalCtor()();
+ Passes.add(P);
+ } else {
+ std::cerr << argv[0] << ": cannot create pass: "
+ << aPass->getPassName() << "\n";
+ }
+ }
+
+
// Figure out where we are going to send the output...
std::ostream *Out = 0;
if (OutputFilename != "") {
More information about the llvm-commits
mailing list