OSDN Git Service

switch tools to bitcode instead of bytecode
authorChris Lattner <sabre@nondot.org>
Sun, 6 May 2007 09:29:57 +0000 (09:29 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 6 May 2007 09:29:57 +0000 (09:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36868 91177308-0d34-0410-b5e6-96231b3b80d8

22 files changed:
tools/llvm-ar/llvm-ar.cpp
tools/llvm-as/Makefile
tools/llvm-as/llvm-as.cpp
tools/llvm-bcanalyzer/Makefile
tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
tools/llvm-dis/Makefile
tools/llvm-dis/llvm-dis.cpp
tools/llvm-extract/Makefile
tools/llvm-extract/llvm-extract.cpp
tools/llvm-ld/Makefile
tools/llvm-ld/llvm-ld.cpp
tools/llvm-link/Makefile
tools/llvm-link/llvm-link.cpp
tools/llvm-nm/Makefile
tools/llvm-nm/llvm-nm.cpp
tools/llvm-prof/Makefile
tools/llvm-prof/llvm-prof.cpp
tools/llvm-ranlib/llvm-ranlib.cpp
tools/llvm2cpp/Makefile
tools/llvm2cpp/llvm2cpp.cpp
tools/llvmc/CompilerDriver.cpp
tools/llvmc/Makefile

index 7f6afc6..d0601c6 100644 (file)
@@ -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 <iostream>
@@ -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<const char*>(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
index ce2ab94..c86b900 100644 (file)
@@ -9,7 +9,7 @@
 
 LEVEL = ../..
 TOOLNAME = llvm-as
-LINK_COMPONENTS := asmparser bcwriter bitwriter
+LINK_COMPONENTS := asmparser bitwriter
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
index a7463b5..e4c7344 100644 (file)
@@ -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"
@@ -44,17 +43,9 @@ static cl::opt<bool>
 DumpAsm("d", cl::desc("Print assembly as parsed"), cl::Hidden);
 
 static cl::opt<bool>
-NoCompress("disable-compression", cl::init(true),
-           cl::desc("Don't compress the generated bytecode"));
-
-static cl::opt<bool>
 DisableVerify("disable-verify", cl::Hidden,
               cl::desc("Do not run verifier on input LLVM (dangerous!)"));
 
-static cl::opt<bool>
-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;
index 65be921..b5747cf 100644 (file)
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-bcanalyzer
-LINK_COMPONENTS := bcreader
+LINK_COMPONENTS := bitreader
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
index 733e4a9..1c96a2b 100644 (file)
@@ -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).
 #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 <map>
 #include <fstream>
 #include <iostream>
 #include <algorithm>
@@ -50,15 +46,12 @@ static cl::opt<std::string>
 static cl::opt<std::string>
   OutputFilename("-o", cl::init("-"), cl::desc("<output file>"));
 
-static cl::opt<bool> NoDetails("nodetails", cl::desc("Skip 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"));
 
 //===----------------------------------------------------------------------===//
 // Bitcode specific analysis.
 //===----------------------------------------------------------------------===//
 
-static cl::opt<bool> Bitcode("bitcode", cl::desc("Read a bitcode file"));
 static cl::opt<bool> 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();
 }
index 4b1088a..8e9501d 100644 (file)
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-dis
-LINK_COMPONENTS := bcreader bitreader
+LINK_COMPONENTS := bitreader
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
index 12a5328..6321551 100644 (file)
@@ -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<bool>
 DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
 
-static cl::opt<bool>
-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<Module> 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] << ": ";
index 51416c6..fafa1cb 100644 (file)
@@ -10,6 +10,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-extract
-LINK_COMPONENTS := bcreader bcwriter ipo bitreader bitwriter
+LINK_COMPONENTS := ipo bitreader bitwriter
 
 include $(LEVEL)/Makefile.common
index 60171c1..97c45f6 100644 (file)
 #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 <iostream>
 #include <memory>
 #include <fstream>
 using namespace llvm;
 
-cl::opt<bool> Bitcode("bitcode");
-
 // InputFilename - The filename to read from.
 static cl::opt<std::string>
 InputFilename(cl::Positional, cl::desc("<input bytecode file>"),
@@ -63,20 +57,15 @@ int main(int argc, char **argv) {
 
   std::auto_ptr<Module> 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)
index b22035b..f772504 100644 (file)
@@ -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
index 2aa6d18..9b3e66d 100644 (file)
@@ -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 <memory>
 using namespace llvm;
 
-cl::opt<bool> Bitcode("bitcode");
-
 // Input/Output Options
 static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
   cl::desc("<input bytecode files>"));
@@ -78,9 +75,6 @@ static cl::opt<bool> Native("native",
 static cl::opt<bool>NativeCBE("native-cbe",
   cl::desc("Generate a native binary with the C backend and GCC"));
 
-static cl::opt<bool>DisableCompression("disable-compression", cl::init(true),
-  cl::desc("Disable writing of compressed bytecode files"));
-
 static cl::list<std::string> 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();
index 4371c69..1985c44 100644 (file)
@@ -9,6 +9,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-link
-LINK_COMPONENTS = linker bcreader bcwriter bitreader bitwriter
+LINK_COMPONENTS = linker bitreader bitwriter
 
 include $(LEVEL)/Makefile.common
index cd9380d..aceb908 100644 (file)
 #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 <fstream>
@@ -29,8 +26,6 @@
 #include <memory>
 using namespace llvm;
 
-cl::opt<bool> Bitcode("bitcode");
-
 static cl::list<std::string>
 InputFilenames(cl::Positional, cl::OneOrMore,
                cl::desc("<input bytecode files>"));
@@ -65,20 +60,14 @@ static inline std::auto_ptr<Module> 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<Module>(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;
index 42233c7..4af8917 100644 (file)
@@ -9,6 +9,6 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-nm
-LINK_COMPONENTS = archive bcreader bitreader
+LINK_COMPONENTS = archive bitreader
 
 include $(LEVEL)/Makefile.common
index 5b98be7..c4aa7ba 100644 (file)
@@ -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 <iostream>
 using namespace llvm;
 
-cl::opt<bool> Bitcode("bitcode");
-
 namespace {
   enum OutputFormatTy { bsd, sysv, posix };
   cl::opt<OutputFormatTy>
@@ -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<MemoryBuffer> Buffer(
                    MemoryBuffer::getFileOrSTDIN(&Filename[0], Filename.size()));
     Module *Result = 0;
index 72e2bcf..505576b 100644 (file)
@@ -9,7 +9,7 @@
 LEVEL = ../..
 
 TOOLNAME = llvm-prof
-LINK_COMPONENTS = bcreader bitreader analysis
+LINK_COMPONENTS = bitreader analysis
 REQUIRES_EH := 1
 
 include $(LEVEL)/Makefile.common
index 7b1e292..106eed8 100644 (file)
@@ -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<bool> Bitcode("bitcode");
   cl::opt<std::string>
   BytecodeFile(cl::Positional, cl::desc("<program bytecode file>"),
                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";
index ef1704a..440b536 100644 (file)
@@ -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"
index 89ffc97..3bb68b8 100644 (file)
@@ -8,7 +8,7 @@
 ##===----------------------------------------------------------------------===##
 LEVEL = ../..
 TOOLNAME = llvm2cpp
-LINK_COMPONENTS = bcreader bitreader
+LINK_COMPONENTS = bitreader
 
 include $(LEVEL)/Makefile.common
 
index 3424482..7a44602 100644 (file)
@@ -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 <memory>
 using namespace llvm;
 
-cl::opt<bool> Bitcode("bitcode");
-
 static cl::opt<std::string>
 InputFilename(cl::Positional, cl::desc("<input LLVM bytecode file>"), 
   cl::init("-"));
@@ -54,18 +51,12 @@ int main(int argc, char **argv) {
   std::string ErrorMessage;
   
   std::auto_ptr<Module> M;
-  if (Bitcode) {
-    std::auto_ptr<MemoryBuffer> 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<MemoryBuffer> 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())
index 251da34..2f94ee8 100644 (file)
@@ -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();
index 4c66afc..fbbc7e8 100644 (file)
@@ -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