llvm.org GIT mirror llvm / 5e8edbb
add bitcode support, optimize reading to not read all function bodies just to get deplibs git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36851 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
2 changed file(s) with 17 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1414 #include "CompilerDriver.h"
1515 #include "ConfigLexer.h"
1616 #include "llvm/Module.h"
17 #include "llvm/Bitcode/ReaderWriter.h"
1718 #include "llvm/Bytecode/Reader.h"
19 #include "llvm/Support/MemoryBuffer.h"
1820 #include "llvm/Support/Timer.h"
1921 #include "llvm/System/Signals.h"
2022 #include "llvm/ADT/SetVector.h"
2224 #include "llvm/Config/alloca.h"
2325 #include
2426 using namespace llvm;
27
28
29 static bool Bitcode = false;
2530
2631 namespace {
2732
6570 Module::LibraryListType& deplibs,
6671 BCDecompressor_t *BCDC,
6772 std::string* ErrMsg) {
68 ModuleProvider* MP = getBytecodeModuleProvider(fname, BCDC, ErrMsg);
73 ModuleProvider *MP = 0;
74 if (Bitcode) {
75 if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&fname[0],
76 fname.size())) {
77 MP = getBitcodeModuleProvider(Buffer);
78 if (MP == 0) delete Buffer;
79 }
80 } else {
81 MP = getBytecodeModuleProvider(fname, BCDC, ErrMsg);
82 }
6983 if (!MP) {
7084 deplibs.clear();
7185 return true;
7286 }
73 Module* M = MP->releaseModule(ErrMsg);
74 deplibs = M->getLibraries();
75 delete M;
87 deplibs = MP->getModule()->getLibraries();
7688 delete MP;
7789 return false;
7890 }
77 ##===----------------------------------------------------------------------===##
88 LEVEL = ../..
99 TOOLNAME = llvmc
10 LINK_COMPONENTS = support system core bcreader
10 LINK_COMPONENTS = support system core bcreader bitreader
1111 CONFIG_FILES = c cpp ll st
1212 EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs
1313 REQUIRES_EH := 1