mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
LTO: introduce object file-based on-disk module format.
This format is simply a regular object file with the bitcode stored in a section named ".llvmbc", plus any number of other (non-allocated) sections. One immediate use case for this is to accommodate compilation processes which expect the object file to contain metadata in non-allocated sections, such as the ".go_export" section used by some Go compilers [1], although I imagine that in the future we could consider compiling parts of the module (such as large non-inlinable functions) directly into the object file to improve LTO efficiency. [1] http://golang.org/doc/install/gccgo#Imports Differential Revision: http://reviews.llvm.org/D4371 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -22,6 +22,8 @@ class Module;
|
||||
class GlobalValue;
|
||||
|
||||
namespace object {
|
||||
class ObjectFile;
|
||||
|
||||
class IRObjectFile : public SymbolicFile {
|
||||
std::unique_ptr<Module> M;
|
||||
std::unique_ptr<Mangler> Mang;
|
||||
@ -49,6 +51,16 @@ public:
|
||||
return v->isIR();
|
||||
}
|
||||
|
||||
/// \brief Finds and returns bitcode embedded in the given object file, or an
|
||||
/// error code if not found.
|
||||
static ErrorOr<MemoryBufferRef> findBitcodeInObject(const ObjectFile &Obj);
|
||||
|
||||
/// \brief Finds and returns bitcode in the given memory buffer (which may
|
||||
/// be either a bitcode file or a native object file with embedded bitcode),
|
||||
/// or an error code if not found.
|
||||
static ErrorOr<MemoryBufferRef>
|
||||
findBitcodeInMemBuffer(MemoryBufferRef Object);
|
||||
|
||||
static ErrorOr<std::unique_ptr<IRObjectFile>>
|
||||
createIRObjectFile(MemoryBufferRef Object, LLVMContext &Context);
|
||||
};
|
||||
|
Reference in New Issue
Block a user