mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
add bitcode support, optimize reading to not read all function bodies just
to get deplibs llvm-svn: 36851
This commit is contained in:
parent
206534649d
commit
5f13aacd15
@ -15,7 +15,9 @@
|
|||||||
#include "CompilerDriver.h"
|
#include "CompilerDriver.h"
|
||||||
#include "ConfigLexer.h"
|
#include "ConfigLexer.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Timer.h"
|
#include "llvm/Support/Timer.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include "llvm/ADT/SetVector.h"
|
#include "llvm/ADT/SetVector.h"
|
||||||
@ -24,6 +26,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
|
||||||
|
static bool Bitcode = false;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void WriteAction(CompilerDriver::Action* action ) {
|
void WriteAction(CompilerDriver::Action* action ) {
|
||||||
@ -66,14 +71,21 @@ static bool GetBytecodeDependentLibraries(const std::string &fname,
|
|||||||
Module::LibraryListType& deplibs,
|
Module::LibraryListType& deplibs,
|
||||||
BCDecompressor_t *BCDC,
|
BCDecompressor_t *BCDC,
|
||||||
std::string* ErrMsg) {
|
std::string* ErrMsg) {
|
||||||
ModuleProvider* MP = getBytecodeModuleProvider(fname, BCDC, 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 (!MP) {
|
if (!MP) {
|
||||||
deplibs.clear();
|
deplibs.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Module* M = MP->releaseModule(ErrMsg);
|
deplibs = MP->getModule()->getLibraries();
|
||||||
deplibs = M->getLibraries();
|
|
||||||
delete M;
|
|
||||||
delete MP;
|
delete MP;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
##===----------------------------------------------------------------------===##
|
##===----------------------------------------------------------------------===##
|
||||||
LEVEL = ../..
|
LEVEL = ../..
|
||||||
TOOLNAME = llvmc
|
TOOLNAME = llvmc
|
||||||
LINK_COMPONENTS = support system core bcreader
|
LINK_COMPONENTS = support system core bcreader bitreader
|
||||||
CONFIG_FILES = c cpp ll st
|
CONFIG_FILES = c cpp ll st
|
||||||
EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs
|
EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs
|
||||||
REQUIRES_EH := 1
|
REQUIRES_EH := 1
|
||||||
|
Loading…
Reference in New Issue
Block a user