[llvm-commits] CVS: llvm/lib/Linker/Linker.cpp

Chris Lattner sabre at nondot.org
Wed Feb 7 13:41:52 PST 2007



Changes in directory llvm/lib/Linker:

Linker.cpp updated: 1.13 -> 1.14
---
Log message:

push bytecode decompressor out through APIs.  Now the bytecode reader
api's look like this:

ModuleProvider *getBytecodeModuleProvider(
  const std::string &Filename,  ///< Name of file to be read
  BCDecompressor_t *BCDC = Compressor::decompressToNewBuffer,
  std::string* ErrMsg = 0,      ///< Optional error message holder 
  BytecodeHandler* H = 0        ///< Optional handler for reader events
);

This is ugly, but allows a client to say:

  getBytecodeModuleProvider("foo", 0);

If they do this, there is no dependency on the compression libraries, saving
codesize.




---
Diffs of the changes:  (+4 -1)

 Linker.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Linker/Linker.cpp
diff -u llvm/lib/Linker/Linker.cpp:1.13 llvm/lib/Linker/Linker.cpp:1.14
--- llvm/lib/Linker/Linker.cpp:1.13	Wed Dec  6 19:30:31 2006
+++ llvm/lib/Linker/Linker.cpp	Wed Feb  7 15:41:02 2007
@@ -16,6 +16,7 @@
 #include "llvm/Bytecode/Reader.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Streams.h"
+#include "llvm/Support/Compressor.h"
 using namespace llvm;
 
 Linker::Linker(const std::string& progname, const std::string& modname, unsigned flags)
@@ -99,7 +100,9 @@
 std::auto_ptr<Module>
 Linker::LoadObject(const sys::Path &FN) {
   std::string ParseErrorMessage;
-  Module *Result = ParseBytecodeFile(FN.toString(), &ParseErrorMessage);
+  Module *Result = ParseBytecodeFile(FN.toString(), 
+                                     Compressor::decompressToNewBuffer,
+                                     &ParseErrorMessage);
   if (Result)
     return std::auto_ptr<Module>(Result);
   Error = "Bytecode file '" + FN.toString() + "' could not be loaded";






More information about the llvm-commits mailing list