summaryrefslogtreecommitdiff
path: root/tools/llvm-dis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-13 23:22:40 +0000
committerChris Lattner <sabre@nondot.org>2004-02-13 23:22:40 +0000
commit2f1f8e0c4e0d5c77db35aba12bc3ab1282f55ec3 (patch)
treee95c44df93725858be7f2df42cf6f4452ea183c1 /tools/llvm-dis
parent8e3eb5542b4b8ea51a6e498fcd0c81078b29b9cf (diff)
downloadllvm-2f1f8e0c4e0d5c77db35aba12bc3ab1282f55ec3.tar.gz
llvm-2f1f8e0c4e0d5c77db35aba12bc3ab1282f55ec3.tar.bz2
llvm-2f1f8e0c4e0d5c77db35aba12bc3ab1282f55ec3.tar.xz
Mercilessly rip the cbackend out of llvm-dis. Leave a helpful error message
for those who have not heard the news. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dis')
-rw-r--r--tools/llvm-dis/Makefile2
-rw-r--r--tools/llvm-dis/llvm-dis.cpp25
2 files changed, 9 insertions, 18 deletions
diff --git a/tools/llvm-dis/Makefile b/tools/llvm-dis/Makefile
index aac499c77b..a0b51cf277 100644
--- a/tools/llvm-dis/Makefile
+++ b/tools/llvm-dis/Makefile
@@ -9,5 +9,5 @@
LEVEL = ../..
TOOLNAME = llvm-dis
-USEDLIBS = cwriter ipa.a scalaropts.a target.a transformutils analysis.a bcreader vmcore support.a
+USEDLIBS = bcreader vmcore support.a
include $(LEVEL)/Makefile.common
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp
index 225787baa7..21d5162465 100644
--- a/tools/llvm-dis/llvm-dis.cpp
+++ b/tools/llvm-dis/llvm-dis.cpp
@@ -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"
@@ -56,6 +55,11 @@ int main(int argc, char **argv) {
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 +88,10 @@ int main(int argc, char **argv) {
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 +116,7 @@ int main(int argc, char **argv) {
// 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
- AddPassesToWriteC(Passes, *Out);
- break;
- }
-
+ Passes.add(new PrintModulePass(Out));
Passes.run(*M.get());
if (Out != &std::cout) {