mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Be lazy about loading metadata in IRObjectFile.
This speeds up llvm-ar building lib64/libclangSema.a with debug IR files from 8.658015807 seconds to just 0.351036519 seconds :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232221 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -53,6 +53,8 @@ public:
|
|||||||
///
|
///
|
||||||
virtual std::error_code MaterializeModule(Module *M) = 0;
|
virtual std::error_code MaterializeModule(Module *M) = 0;
|
||||||
|
|
||||||
|
virtual std::error_code materializeMetadata() = 0;
|
||||||
|
|
||||||
virtual std::vector<StructType *> getIdentifiedStructTypes() const = 0;
|
virtual std::vector<StructType *> getIdentifiedStructTypes() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -502,6 +502,8 @@ public:
|
|||||||
/// Materializer.
|
/// Materializer.
|
||||||
std::error_code materializeAllPermanently();
|
std::error_code materializeAllPermanently();
|
||||||
|
|
||||||
|
std::error_code materializeMetadata();
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Direct access to the globals list, functions list, and symbol table
|
/// @name Direct access to the globals list, functions list, and symbol table
|
||||||
/// @{
|
/// @{
|
||||||
|
@@ -255,7 +255,7 @@ public:
|
|||||||
static uint64_t decodeSignRotatedValue(uint64_t V);
|
static uint64_t decodeSignRotatedValue(uint64_t V);
|
||||||
|
|
||||||
/// Materialize any deferred Metadata block.
|
/// Materialize any deferred Metadata block.
|
||||||
std::error_code materializeMetadata();
|
std::error_code materializeMetadata() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<StructType *> IdentifiedStructTypes;
|
std::vector<StructType *> IdentifiedStructTypes;
|
||||||
|
@@ -413,6 +413,12 @@ std::error_code Module::materializeAllPermanently() {
|
|||||||
return std::error_code();
|
return std::error_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::error_code Module::materializeMetadata() {
|
||||||
|
if (!Materializer)
|
||||||
|
return std::error_code();
|
||||||
|
return Materializer->materializeMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Other module related stuff.
|
// Other module related stuff.
|
||||||
//
|
//
|
||||||
|
@@ -300,7 +300,9 @@ llvm::object::IRObjectFile::create(MemoryBufferRef Object,
|
|||||||
std::unique_ptr<MemoryBuffer> Buff(
|
std::unique_ptr<MemoryBuffer> Buff(
|
||||||
MemoryBuffer::getMemBuffer(BCOrErr.get(), false));
|
MemoryBuffer::getMemBuffer(BCOrErr.get(), false));
|
||||||
|
|
||||||
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(std::move(Buff), Context);
|
ErrorOr<Module *> MOrErr =
|
||||||
|
getLazyBitcodeModule(std::move(Buff), Context, nullptr,
|
||||||
|
/*ShouldLazyLoadMetadata*/ true);
|
||||||
if (std::error_code EC = MOrErr.getError())
|
if (std::error_code EC = MOrErr.getError())
|
||||||
return EC;
|
return EC;
|
||||||
|
|
||||||
|
@@ -598,6 +598,7 @@ getModuleForFile(LLVMContext &Context, claimed_file &F,
|
|||||||
|
|
||||||
Module &M = Obj.getModule();
|
Module &M = Obj.getModule();
|
||||||
|
|
||||||
|
M.materializeMetadata();
|
||||||
UpgradeDebugInfo(M);
|
UpgradeDebugInfo(M);
|
||||||
|
|
||||||
SmallPtrSet<GlobalValue *, 8> Used;
|
SmallPtrSet<GlobalValue *, 8> Used;
|
||||||
|
Reference in New Issue
Block a user