[llvm-commits] [parallel] CVS: llvm/tools/llvm-dis/Makefile llvm-dis.cpp

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 19:48:50 PST 2004


Changes in directory llvm/tools/llvm-dis:

Makefile updated: 1.12 -> 1.12.6.1
llvm-dis.cpp updated: 1.37 -> 1.37.4.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+14 -19)

Index: llvm/tools/llvm-dis/Makefile
diff -u llvm/tools/llvm-dis/Makefile:1.12 llvm/tools/llvm-dis/Makefile:1.12.6.1
--- llvm/tools/llvm-dis/Makefile:1.12	Mon Oct 20 17:27:27 2003
+++ llvm/tools/llvm-dis/Makefile	Mon Mar  1 17:59:18 2004
@@ -9,5 +9,5 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-dis
-USEDLIBS = bcreader cwriter ipa.a vmcore support.a
+USEDLIBS = bcreader vmcore support.a
 include $(LEVEL)/Makefile.common


Index: llvm/tools/llvm-dis/llvm-dis.cpp
diff -u llvm/tools/llvm-dis/llvm-dis.cpp:1.37 llvm/tools/llvm-dis/llvm-dis.cpp:1.37.4.1
--- llvm/tools/llvm-dis/llvm-dis.cpp:1.37	Tue Nov 11 22:59:59 2003
+++ llvm/tools/llvm-dis/llvm-dis.cpp	Mon Mar  1 17:59:18 2004
@@ -20,7 +20,6 @@
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
 #include "llvm/Bytecode/Reader.h"
-#include "llvm/Assembly/CWriter.h"
 #include "llvm/Assembly/PrintModulePass.h"
 #include "Support/CommandLine.h"
 #include "Support/Signals.h"
@@ -49,13 +48,22 @@
 WriteMode(cl::desc("Specify the output format:"),
           cl::values(clEnumValN(LLVM, "llvm", "Output LLVM assembly"),
                      clEnumVal(c, "Output C code for program"),
-                    0));
+                    0),
+          cl::ReallyHidden);
 
 int main(int argc, char **argv) {
   cl::ParseCommandLineOptions(argc, argv, " llvm .bc -> .ll disassembler\n");
+  PrintStackTraceOnErrorSignal();
+
   std::ostream *Out = &std::cout;  // Default to printing to stdout...
   std::string ErrorMessage;
 
+  if (WriteMode == c) {
+    std::cerr << "ERROR: llvm-dis no longer contains the C backend. "
+              << "Use 'llc -march=c' instead!\n";
+    exit(1);
+  }
+
   std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage));
   if (M.get() == 0) {
     std::cerr << argv[0] << ": ";
@@ -84,14 +92,10 @@
       int Len = IFN.length();
       if (IFN[Len-3] == '.' && IFN[Len-2] == 'b' && IFN[Len-1] == 'c') {
 	// Source ends in .bc
-	OutputFilename = std::string(IFN.begin(), IFN.end()-3);
+	OutputFilename = std::string(IFN.begin(), IFN.end()-3)+".ll";
       } else {
-	OutputFilename = IFN;   // Append a .ll to it
+	OutputFilename = IFN+".ll";
       }
-      if (WriteMode == c)
-        OutputFilename += ".c";
-      else
-        OutputFilename += ".ll";
 
       if (!Force && std::ifstream(OutputFilename.c_str())) {
         // If force is not specified, make sure not to overwrite a file!
@@ -116,16 +120,7 @@
   // All that dis does is write the assembly or C out to a file...
   //
   PassManager Passes;
-
-  switch (WriteMode) {
-  case LLVM:           // Output LLVM assembly
-    Passes.add(new PrintModulePass(Out));
-    break;
-  case c:              // Convert LLVM to C
-    Passes.add(createWriteToCPass(*Out));
-    break;
-  }
-
+  Passes.add(new PrintModulePass(Out));
   Passes.run(*M.get());
 
   if (Out != &std::cout) {





More information about the llvm-commits mailing list