From 44dadffe4bd58ab32961ca5fe537e8ba69c09243 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 May 2007 09:29:57 +0000 Subject: switch tools to bitcode instead of bytecode git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36868 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-ar/llvm-ar.cpp | 21 +++--------- tools/llvm-as/Makefile | 2 +- tools/llvm-as/llvm-as.cpp | 23 +++----------- tools/llvm-bcanalyzer/Makefile | 2 +- tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 53 ++----------------------------- tools/llvm-dis/Makefile | 2 +- tools/llvm-dis/llvm-dis.cpp | 28 +++++----------- tools/llvm-extract/Makefile | 2 +- tools/llvm-extract/llvm-extract.cpp | 31 +++++------------- tools/llvm-ld/Makefile | 2 +- tools/llvm-ld/llvm-ld.cpp | 13 +------- tools/llvm-link/Makefile | 2 +- tools/llvm-link/llvm-link.cpp | 34 ++++++-------------- tools/llvm-nm/Makefile | 2 +- tools/llvm-nm/llvm-nm.cpp | 17 ++-------- tools/llvm-prof/Makefile | 2 +- tools/llvm-prof/llvm-prof.cpp | 22 ++++--------- tools/llvm-ranlib/llvm-ranlib.cpp | 2 +- tools/llvm2cpp/Makefile | 2 +- tools/llvm2cpp/llvm2cpp.cpp | 21 ++++-------- tools/llvmc/CompilerDriver.cpp | 21 ++++-------- tools/llvmc/Makefile | 2 +- 22 files changed, 70 insertions(+), 236 deletions(-) (limited to 'tools') diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 7f6afc6bee..d0601c66c1 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -13,9 +13,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Module.h" -#include "llvm/Bytecode/Archive.h" +#include "llvm/Bitcode/Archive.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compressor.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/System/Signals.h" #include @@ -364,14 +363,8 @@ bool doPrint(std::string* ErrMsg) { if (Verbose) std::cout << "Printing " << I->getPath().toString() << "\n"; - if (I->isCompressedBytecode()) - Compressor::decompressToStream(data+4,I->getSize()-4,std::cout); - else if (I->isCompressed()) { - Compressor::decompressToStream(data,I->getSize(),std::cout); - } else { - unsigned len = I->getSize(); - std::cout.write(data, len); - } + unsigned len = I->getSize(); + std::cout.write(data, len); } else { countDown--; } @@ -469,12 +462,8 @@ doExtract(std::string* ErrMsg) { const char* data = reinterpret_cast(I->getData()); unsigned len = I->getSize(); - // Write the data, making sure to uncompress things first - if (I->isCompressed()) { - Compressor::decompressToStream(data,len,file); - } else { - file.write(data,len); - } + // Write the data. + file.write(data,len); file.close(); // If we're supposed to retain the original modification times, etc. do so diff --git a/tools/llvm-as/Makefile b/tools/llvm-as/Makefile index ce2ab9438a..c86b900b22 100644 --- a/tools/llvm-as/Makefile +++ b/tools/llvm-as/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm-as -LINK_COMPONENTS := asmparser bcwriter bitwriter +LINK_COMPONENTS := asmparser bitwriter REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index a7463b532e..e4c7344776 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -9,15 +9,14 @@ // // This utility may be invoked in the following manner: // llvm-as --help - Output information about command line switches -// llvm-as [options] - Read LLVM asm from stdin, write bytecode to stdout -// llvm-as [options] x.ll - Read LLVM asm from the x.ll file, write bytecode +// llvm-as [options] - Read LLVM asm from stdin, write bitcode to stdout +// llvm-as [options] x.ll - Read LLVM asm from the x.ll file, write bitcode // to the x.bc file. // //===----------------------------------------------------------------------===// #include "llvm/Module.h" #include "llvm/Assembly/Parser.h" -#include "llvm/Bytecode/Writer.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Support/CommandLine.h" @@ -43,18 +42,10 @@ Force("f", cl::desc("Overwrite output files")); static cl::opt DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden); -static cl::opt -NoCompress("disable-compression", cl::init(true), - cl::desc("Don't compress the generated bytecode")); - static cl::opt DisableVerify("disable-verify", cl::Hidden, cl::desc("Do not run verifier on input LLVM (dangerous!)")); -static cl::opt -EnableBitcode("bitcode", cl::desc("Emit bitcode")); - - int main(int argc, char **argv) { llvm_shutdown_obj X; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .bc assembler\n"); @@ -134,14 +125,8 @@ int main(int argc, char **argv) { return 1; } - if (Force || !CheckBytecodeOutputToConsole(Out,true)) { - if (EnableBitcode) { - WriteBitcodeToFile(M.get(), *Out); - } else { - OStream L(*Out); - WriteBytecodeToFile(M.get(), L, !NoCompress); - } - } + if (Force || !CheckBytecodeOutputToConsole(Out,true)) + WriteBitcodeToFile(M.get(), *Out); } catch (const std::string& msg) { cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; diff --git a/tools/llvm-bcanalyzer/Makefile b/tools/llvm-bcanalyzer/Makefile index 65be92123f..b5747cf9f4 100644 --- a/tools/llvm-bcanalyzer/Makefile +++ b/tools/llvm-bcanalyzer/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm-bcanalyzer -LINK_COMPONENTS := bcreader +LINK_COMPONENTS := bitreader REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 733e4a9e86..1c96a2b3a8 100644 --- a/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -13,8 +13,6 @@ // // Options: // --help - Output information about command line switches -// --nodetails - Don't print out detailed informaton about individual -// blocks and functions // --dump - Dump low-level bytecode structure in readable format // // This tool provides analytical information about a bytecode file. It is @@ -22,8 +20,7 @@ // produces on std::out a summary of the bytecode file that shows various // statistics about the contents of the file. By default this information is // detailed and contains information about individual bytecode blocks and the -// functions in the module. To avoid this more detailed output, use the -// -nodetails option to limit the output to just module level information. +// functions in the module. // The tool is also able to print a bytecode file in a straight forward text // format that shows the containment and relationships of the information in // the bytecode file (-dump option). @@ -33,12 +30,11 @@ #include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/BitstreamReader.h" #include "llvm/Bitcode/LLVMBitCodes.h" -#include "llvm/Bytecode/Analyzer.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compressor.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/System/Signals.h" +#include #include #include #include @@ -50,15 +46,12 @@ static cl::opt static cl::opt OutputFilename("-o", cl::init("-"), cl::desc("")); -static cl::opt NoDetails("nodetails", cl::desc("Skip detailed output")); static cl::opt Dump("dump", cl::desc("Dump low level bytecode trace")); -static cl::opt Verify("verify", cl::desc("Progressively verify module")); //===----------------------------------------------------------------------===// // Bitcode specific analysis. //===----------------------------------------------------------------------===// -static cl::opt Bitcode("bitcode", cl::desc("Read a bitcode file")); static cl::opt NoHistogram("disable-histogram", cl::desc("Do not print per-code histogram")); @@ -501,51 +494,11 @@ static int AnalyzeBitcode() { } -//===----------------------------------------------------------------------===// -// Bytecode specific analysis. -//===----------------------------------------------------------------------===// - int main(int argc, char **argv) { llvm_shutdown_obj X; // Call llvm_shutdown() on exit. cl::ParseCommandLineOptions(argc, argv, " llvm-bcanalyzer file analyzer\n"); sys::PrintStackTraceOnErrorSignal(); - if (Bitcode) - return AnalyzeBitcode(); - - try { - std::ostream *Out = &std::cout; // Default to printing to stdout... - std::string ErrorMessage; - BytecodeAnalysis bca; - - /// Determine what to generate - bca.detailedResults = !NoDetails; - bca.progressiveVerify = Verify; - - /// Analyze the bytecode file - Module* M = AnalyzeBytecodeFile(InputFilename, bca, - Compressor::decompressToNewBuffer, - &ErrorMessage, (Dump?Out:0)); - - // All that bcanalyzer does is write the gathered statistics to the output - PrintBytecodeAnalysis(bca,*Out); - - if (M && Verify) { - std::string verificationMsg; - if (verifyModule(*M, ReturnStatusAction, &verificationMsg)) - std::cerr << "Final Verification Message: " << verificationMsg << "\n"; - } - - if (Out != &std::cout) { - ((std::ofstream*)Out)->close(); - delete Out; - } - return 0; - } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; - } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; - } - return 1; + return AnalyzeBitcode(); } diff --git a/tools/llvm-dis/Makefile b/tools/llvm-dis/Makefile index 4b1088aec9..8e9501d38d 100644 --- a/tools/llvm-dis/Makefile +++ b/tools/llvm-dis/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm-dis -LINK_COMPONENTS := bcreader bitreader +LINK_COMPONENTS := bitreader REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 12a53285c0..6321551446 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -19,9 +19,7 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Assembly/PrintModulePass.h" -#include "llvm/Support/Compressor.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" @@ -45,9 +43,6 @@ Force("f", cl::desc("Overwrite output files")); static cl::opt DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden); -static cl::opt -Bitcode("bitcode", cl::desc("Read a bitcode file")); - int main(int argc, char **argv) { llvm_shutdown_obj X; // Call llvm_shutdown() on exit. try { @@ -59,21 +54,14 @@ int main(int argc, char **argv) { std::auto_ptr M; - if (Bitcode) { - MemoryBuffer *Buffer - = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()); - - if (Buffer == 0) - ErrorMessage = "Error reading file '" + InputFilename + "'"; - else - M.reset(ParseBitcodeFile(Buffer, &ErrorMessage)); - - delete Buffer; - } else { - M.reset(ParseBytecodeFile(InputFilename, - Compressor::decompressToNewBuffer, - &ErrorMessage)); - } + MemoryBuffer *Buffer + = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()); + + if (Buffer == 0) + ErrorMessage = "Error reading file '" + InputFilename + "'"; + else + M.reset(ParseBitcodeFile(Buffer, &ErrorMessage)); + delete Buffer; if (M.get() == 0) { cerr << argv[0] << ": "; diff --git a/tools/llvm-extract/Makefile b/tools/llvm-extract/Makefile index 51416c6426..fafa1cb4cd 100644 --- a/tools/llvm-extract/Makefile +++ b/tools/llvm-extract/Makefile @@ -10,6 +10,6 @@ LEVEL = ../.. TOOLNAME = llvm-extract -LINK_COMPONENTS := bcreader bcwriter ipo bitreader bitwriter +LINK_COMPONENTS := ipo bitreader bitwriter include $(LEVEL)/Makefile.common diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 60171c10e2..97c45f6dcc 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -15,23 +15,17 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm/Bytecode/WriteBytecodePass.h" #include "llvm/Transforms/IPO.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/Compressor.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include #include #include using namespace llvm; -cl::opt Bitcode("bitcode"); - // InputFilename - The filename to read from. static cl::opt InputFilename(cl::Positional, cl::desc(""), @@ -63,20 +57,15 @@ int main(int argc, char **argv) { std::auto_ptr M; - if (Bitcode) { - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], - InputFilename.size()); - if (Buffer == 0) { - cerr << "Error reading file '" + InputFilename + "'"; - return 1; - } else { - M.reset(ParseBitcodeFile(Buffer)); - } - delete Buffer; + MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], + InputFilename.size()); + if (Buffer == 0) { + cerr << "Error reading file '" + InputFilename + "'"; + return 1; } else { - M.reset(ParseBytecodeFile(InputFilename, - Compressor::decompressToNewBuffer)); + M.reset(ParseBitcodeFile(Buffer)); } + delete Buffer; if (M.get() == 0) { cerr << argv[0] << ": bytecode didn't read correctly.\n"; @@ -120,11 +109,7 @@ int main(int argc, char **argv) { Out = &std::cout; } - OStream L(*Out); - if (Bitcode) - Passes.add(CreateBitcodeWriterPass(*Out)); - else - Passes.add(new WriteBytecodePass(&L)); // Write bytecode to file... + Passes.add(CreateBitcodeWriterPass(*Out)); Passes.run(*M.get()); if (Out != &std::cout) diff --git a/tools/llvm-ld/Makefile b/tools/llvm-ld/Makefile index b22035b931..f772504aa7 100644 --- a/tools/llvm-ld/Makefile +++ b/tools/llvm-ld/Makefile @@ -10,7 +10,7 @@ LEVEL = ../.. TOOLNAME = llvm-ld -LINK_COMPONENTS = ipo scalaropts linker archive bcwriter bitwriter +LINK_COMPONENTS = ipo scalaropts linker archive bitwriter REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 2aa6d18350..9b3e66d884 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -26,7 +26,6 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Writer.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachineRegistry.h" @@ -41,8 +40,6 @@ #include using namespace llvm; -cl::opt Bitcode("bitcode"); - // Input/Output Options static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); @@ -78,9 +75,6 @@ static cl::opt Native("native", static cl::optNativeCBE("native-cbe", cl::desc("Generate a native binary with the C backend and GCC")); -static cl::optDisableCompression("disable-compression", cl::init(true), - cl::desc("Disable writing of compressed bytecode files")); - static cl::list PostLinkOpts("post-link-opts", cl::value_desc("path"), cl::desc("Run one or more optimization programs after linking")); @@ -227,12 +221,7 @@ void GenerateBytecode(Module* M, const std::string& FileName) { sys::RemoveFileOnSignal(sys::Path(FileName)); // Write it out - if (Bitcode) { - WriteBitcodeToFile(M, Out); - } else { - OStream L(Out); - WriteBytecodeToFile(M, L, !DisableCompression); - } + WriteBitcodeToFile(M, Out); // Close the bytecode file. Out.close(); diff --git a/tools/llvm-link/Makefile b/tools/llvm-link/Makefile index 4371c69712..1985c44a80 100644 --- a/tools/llvm-link/Makefile +++ b/tools/llvm-link/Makefile @@ -9,6 +9,6 @@ LEVEL = ../.. TOOLNAME = llvm-link -LINK_COMPONENTS = linker bcreader bcwriter bitreader bitwriter +LINK_COMPONENTS = linker bitreader bitwriter include $(LEVEL)/Makefile.common diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index cd9380d70b..aceb90889b 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -16,12 +16,9 @@ #include "llvm/Module.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm/Bytecode/Writer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include "llvm/System/Path.h" #include @@ -29,8 +26,6 @@ #include using namespace llvm; -cl::opt Bitcode("bitcode"); - static cl::list InputFilenames(cl::Positional, cl::OneOrMore, cl::desc("")); @@ -65,20 +60,14 @@ static inline std::auto_ptr LoadFile(const std::string &FN) { if (Verbose) cerr << "Loading '" << Filename.c_str() << "'\n"; Module* Result = 0; - if (Bitcode) { - const std::string &FNStr = Filename.toString(); - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&FNStr[0], - FNStr.size()); - if (Buffer == 0) - ErrorMessage = "Error reading file '" + FNStr + "'"; - else - Result = ParseBitcodeFile(Buffer, &ErrorMessage); - delete Buffer; - } else { - Result = ParseBytecodeFile(Filename.toString(), - Compressor::decompressToNewBuffer, - &ErrorMessage); - } + const std::string &FNStr = Filename.toString(); + MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&FNStr[0], + FNStr.size()); + if (Buffer == 0) + ErrorMessage = "Error reading file '" + FNStr + "'"; + else + Result = ParseBitcodeFile(Buffer, &ErrorMessage); + delete Buffer; if (Result) return std::auto_ptr(Result); // Load successful! if (Verbose) { @@ -159,12 +148,7 @@ int main(int argc, char **argv) { } if (Verbose) cerr << "Writing bytecode...\n"; - if (Bitcode) { - WriteBitcodeToFile(Composite.get(), *Out); - } else { - OStream L(*Out); - WriteBytecodeToFile(Composite.get(), L, !NoCompress); - } + WriteBitcodeToFile(Composite.get(), *Out); if (Out != &std::cout) delete Out; return 0; diff --git a/tools/llvm-nm/Makefile b/tools/llvm-nm/Makefile index 42233c7894..4af89174e3 100644 --- a/tools/llvm-nm/Makefile +++ b/tools/llvm-nm/Makefile @@ -9,6 +9,6 @@ LEVEL = ../.. TOOLNAME = llvm-nm -LINK_COMPONENTS = archive bcreader bitreader +LINK_COMPONENTS = archive bitreader include $(LEVEL)/Makefile.common diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 5b98be7056..c4aa7baf43 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -18,8 +18,7 @@ #include "llvm/Module.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" -#include "llvm/Bytecode/Archive.h" +#include "llvm/Bitcode/Archive.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" @@ -31,8 +30,6 @@ #include using namespace llvm; -cl::opt Bitcode("bitcode"); - namespace { enum OutputFormatTy { bsd, sysv, posix }; cl::opt @@ -125,17 +122,7 @@ static void DumpSymbolNamesFromFile(std::string &Filename) { std::string ErrorMessage; sys::Path aPath(Filename); // Note: Currently we do not support reading an archive from stdin. - if (Filename == "-" || aPath.isBytecodeFile()) { - Module *Result = ParseBytecodeFile(Filename, - Compressor::decompressToNewBuffer, - &ErrorMessage); - if (Result) { - DumpSymbolNamesFromModule (Result); - } else { - std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n"; - return; - } - } else if (aPath.isBitcodeFile()) { + if (Filename == "-" || aPath.isBitcodeFile()) { std::auto_ptr Buffer( MemoryBuffer::getFileOrSTDIN(&Filename[0], Filename.size())); Module *Result = 0; diff --git a/tools/llvm-prof/Makefile b/tools/llvm-prof/Makefile index 72e2bcf184..505576b903 100644 --- a/tools/llvm-prof/Makefile +++ b/tools/llvm-prof/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm-prof -LINK_COMPONENTS = bcreader bitreader analysis +LINK_COMPONENTS = bitreader analysis REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 7b1e292253..106eed8c3f 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -17,7 +17,6 @@ #include "llvm/Module.h" #include "llvm/Assembly/AsmAnnotationWriter.h" #include "llvm/Analysis/ProfileInfoLoader.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" @@ -32,7 +31,6 @@ using namespace llvm; namespace { - cl::opt Bitcode("bitcode"); cl::opt BytecodeFile(cl::Positional, cl::desc(""), cl::Required); @@ -120,19 +118,13 @@ int main(int argc, char **argv) { // Read in the bytecode file... std::string ErrorMessage; Module *M; - if (Bitcode) { - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&BytecodeFile[0], - BytecodeFile.size()); - if (Buffer == 0) - ErrorMessage = "Error reading file '" + BytecodeFile + "'"; - else - M = ParseBitcodeFile(Buffer, &ErrorMessage); - delete Buffer; - } else { - M = ParseBytecodeFile(BytecodeFile, - Compressor::decompressToNewBuffer, - &ErrorMessage); - } + MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&BytecodeFile[0], + BytecodeFile.size()); + if (Buffer == 0) + ErrorMessage = "Error reading file '" + BytecodeFile + "'"; + else + M = ParseBitcodeFile(Buffer, &ErrorMessage); + delete Buffer; if (M == 0) { std::cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage << "\n"; diff --git a/tools/llvm-ranlib/llvm-ranlib.cpp b/tools/llvm-ranlib/llvm-ranlib.cpp index ef1704a78d..440b536194 100644 --- a/tools/llvm-ranlib/llvm-ranlib.cpp +++ b/tools/llvm-ranlib/llvm-ranlib.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Module.h" -#include "llvm/Bytecode/Archive.h" +#include "llvm/Bitcode/Archive.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/System/Signals.h" diff --git a/tools/llvm2cpp/Makefile b/tools/llvm2cpp/Makefile index 89ffc97e80..3bb68b8daa 100644 --- a/tools/llvm2cpp/Makefile +++ b/tools/llvm2cpp/Makefile @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvm2cpp -LINK_COMPONENTS = bcreader bitreader +LINK_COMPONENTS = bitreader include $(LEVEL)/Makefile.common diff --git a/tools/llvm2cpp/llvm2cpp.cpp b/tools/llvm2cpp/llvm2cpp.cpp index 3424482fda..7a4460282d 100644 --- a/tools/llvm2cpp/llvm2cpp.cpp +++ b/tools/llvm2cpp/llvm2cpp.cpp @@ -18,7 +18,6 @@ #include "llvm/Module.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" @@ -31,8 +30,6 @@ #include using namespace llvm; -cl::opt Bitcode("bitcode"); - static cl::opt InputFilename(cl::Positional, cl::desc(""), cl::init("-")); @@ -54,18 +51,12 @@ int main(int argc, char **argv) { std::string ErrorMessage; std::auto_ptr M; - if (Bitcode) { - std::auto_ptr Buffer( - MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size())); - if (Buffer.get()) - M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage)); - else - ErrorMessage = "Error reading file '" + InputFilename + "'"; - } else { - M.reset(ParseBytecodeFile(InputFilename, - Compressor::decompressToNewBuffer, - &ErrorMessage)); - } + std::auto_ptr Buffer( + MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size())); + if (Buffer.get()) + M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage)); + else + ErrorMessage = "Error reading file '" + InputFilename + "'"; if (M.get() == 0) { std::cerr << argv[0] << ": "; if (ErrorMessage.size()) diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp index 251da34290..2f94ee84c7 100644 --- a/tools/llvmc/CompilerDriver.cpp +++ b/tools/llvmc/CompilerDriver.cpp @@ -15,8 +15,8 @@ #include "CompilerDriver.h" #include "ConfigLexer.h" #include "llvm/Module.h" +#include "llvm/ModuleProvider.h" #include "llvm/Bitcode/ReaderWriter.h" -#include "llvm/Bytecode/Reader.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Timer.h" #include "llvm/System/Signals.h" @@ -27,8 +27,6 @@ using namespace llvm; -static bool Bitcode = false; - namespace { void WriteAction(CompilerDriver::Action* action ) { @@ -69,17 +67,12 @@ void DumpConfigData(CompilerDriver::ConfigData* cd, const std::string& type ){ static bool GetBytecodeDependentLibraries(const std::string &fname, Module::LibraryListType& deplibs, - BCDecompressor_t *BCDC, std::string* ErrMsg) { ModuleProvider *MP = 0; - if (Bitcode) { - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&fname[0], - fname.size())) { - MP = getBitcodeModuleProvider(Buffer); - if (MP == 0) delete Buffer; - } - } else { - MP = getBytecodeModuleProvider(fname, BCDC, ErrMsg); + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&fname[0], + fname.size())) { + MP = getBitcodeModuleProvider(Buffer); + if (MP == 0) delete Buffer; } if (!MP) { deplibs.clear(); @@ -598,9 +591,7 @@ private: if (fullpath.isBytecodeFile()) { // Process the dependent libraries recursively Module::LibraryListType modlibs; - if (GetBytecodeDependentLibraries(fullpath.toString(),modlibs, - Compressor::decompressToNewBuffer, - &err)) { + if (GetBytecodeDependentLibraries(fullpath.toString(),modlibs, &err)) { // Traverse the dependent libraries list Module::lib_iterator LI = modlibs.begin(); Module::lib_iterator LE = modlibs.end(); diff --git a/tools/llvmc/Makefile b/tools/llvmc/Makefile index 4c66afc59f..fbbc7e8288 100644 --- a/tools/llvmc/Makefile +++ b/tools/llvmc/Makefile @@ -8,7 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvmc -LINK_COMPONENTS = support system core bcreader bitreader +LINK_COMPONENTS = support system core bitreader CONFIG_FILES = c cpp ll st EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs REQUIRES_EH := 1 -- cgit v1.2.3