mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-13 17:06:15 +00:00
Change IRObjectFile to parse the bitcode lazily.
The main point of this class is to provide a cheap object interface to a bitcode file, so it has to be as lazy as possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc21bbde87
commit
d681e31b46
@ -23,7 +23,8 @@ using namespace object;
|
|||||||
IRObjectFile::IRObjectFile(MemoryBuffer *Object, std::error_code &EC,
|
IRObjectFile::IRObjectFile(MemoryBuffer *Object, std::error_code &EC,
|
||||||
LLVMContext &Context, bool BufferOwned)
|
LLVMContext &Context, bool BufferOwned)
|
||||||
: SymbolicFile(Binary::ID_IR, Object, BufferOwned) {
|
: SymbolicFile(Binary::ID_IR, Object, BufferOwned) {
|
||||||
ErrorOr<Module*> MOrErr = parseBitcodeFile(Object, Context);
|
ErrorOr<Module *> MOrErr =
|
||||||
|
getLazyBitcodeModule(Object, Context, /*BufferOwned*/ false);
|
||||||
if ((EC = MOrErr.getError()))
|
if ((EC = MOrErr.getError()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -104,11 +105,21 @@ std::error_code IRObjectFile::printSymbolName(raw_ostream &OS,
|
|||||||
return object_error::success;
|
return object_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isDeclaration(const GlobalValue &V) {
|
||||||
|
if (V.hasAvailableExternallyLinkage())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (V.isMaterializable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return V.isDeclaration();
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
|
uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
|
||||||
const GlobalValue &GV = getGV(Symb);
|
const GlobalValue &GV = getGV(Symb);
|
||||||
|
|
||||||
uint32_t Res = BasicSymbolRef::SF_None;
|
uint32_t Res = BasicSymbolRef::SF_None;
|
||||||
if (GV.isDeclaration() || GV.hasAvailableExternallyLinkage())
|
if (isDeclaration(GV))
|
||||||
Res |= BasicSymbolRef::SF_Undefined;
|
Res |= BasicSymbolRef::SF_Undefined;
|
||||||
if (GV.hasPrivateLinkage())
|
if (GV.hasPrivateLinkage())
|
||||||
Res |= BasicSymbolRef::SF_FormatSpecific;
|
Res |= BasicSymbolRef::SF_FormatSpecific;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user