[llvm-commits] CVS: llvm/tools/llvm-abcd/llvm-abcd.cpp
LLVM
llvm at cs.uiuc.edu
Tue Jun 29 18:35:01 PDT 2004
Changes in directory llvm/tools/llvm-abcd:
llvm-abcd.cpp updated: 1.4 -> 1.5
---
Log message:
Implement verification feature.
Ensure output occurs even in the face of an error.
---
Diffs of the changes: (+20 -4)
Index: llvm/tools/llvm-abcd/llvm-abcd.cpp
diff -u llvm/tools/llvm-abcd/llvm-abcd.cpp:1.4 llvm/tools/llvm-abcd/llvm-abcd.cpp:1.5
--- llvm/tools/llvm-abcd/llvm-abcd.cpp:1.4 Thu Jun 10 13:38:44 2004
+++ llvm/tools/llvm-abcd/llvm-abcd.cpp Tue Jun 29 18:34:27 2004
@@ -29,6 +29,7 @@
// the bytecode file (-dump option).
//===----------------------------------------------------------------------===//
+#include "llvm/Analysis/Verifier.h"
#include "llvm/Bytecode/Analyzer.h"
#include "Support/CommandLine.h"
#include "llvm/System/Signals.h"
@@ -41,7 +42,8 @@
InputFilename(cl::Positional, cl::desc("<input bytecode>"), cl::init("-"));
static cl::opt<bool> NoDetails ("nodetails", cl::desc("Skip detailed output"));
-static cl::opt<bool> Dump ("dump", cl::desc("Detailed output"));
+static cl::opt<bool> Dump ("dump", cl::desc("Dump low level bytecode trace"));
+static cl::opt<bool> Verify ("verify", cl::desc("Progressively verify module"));
int
main(int argc, char **argv)
@@ -59,9 +61,25 @@
/// Determine what to generate
bca.dumpBytecode = Dump;
bca.detailedResults = !NoDetails;
+ bca.progressiveVerify = Verify;
/// Analyze the bytecode file
- AnalyzeBytecodeFile(InputFilename, bca, &ErrorMessage);
+ Module* M = AnalyzeBytecodeFile(InputFilename, bca, &ErrorMessage);
+
+ // All that abcd does is write the gathered statistics to the output
+ PrintBytecodeAnalysis(bca,*Out);
+
+ if ( M && Verify ) {
+ std::string verificationMsg;
+ try {
+ verifyModule( *M, ThrowExceptionAction );
+ } catch (std::string& errmsg ) {
+ verificationMsg = errmsg;
+ }
+ if ( verificationMsg.length() > 0 )
+ std::cerr << "Final Verification Message: " << verificationMsg << "\n";
+ }
+
// If there was an error, print it and stop.
if ( ErrorMessage.size() ) {
@@ -69,8 +87,6 @@
return 1;
}
- // All that abcd does is write the gathered statistics to the output
- PrintBytecodeAnalysis(bca,*Out);
if (Out != &std::cout) {
((std::ofstream*)Out)->close();
More information about the llvm-commits
mailing list