mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-14 15:19:33 +00:00
Move a call to getGlobalContext out of lib/LTO.
llvm-svn: 254696
This commit is contained in:
parent
d25663ec5d
commit
b0476044d6
@ -62,8 +62,7 @@ namespace llvm {
|
||||
struct LTOCodeGenerator {
|
||||
static const char *getVersionString();
|
||||
|
||||
LTOCodeGenerator();
|
||||
LTOCodeGenerator(std::unique_ptr<LLVMContext> Context);
|
||||
LTOCodeGenerator(LLVMContext &Context);
|
||||
~LTOCodeGenerator();
|
||||
|
||||
/// Merge given module. Return true on success.
|
||||
@ -168,7 +167,6 @@ private:
|
||||
|
||||
typedef StringMap<uint8_t> StringSet;
|
||||
|
||||
std::unique_ptr<LLVMContext> OwnedContext;
|
||||
LLVMContext &Context;
|
||||
std::unique_ptr<Module> MergedModule;
|
||||
std::unique_ptr<Linker> IRLinker;
|
||||
|
@ -64,20 +64,13 @@ const char* LTOCodeGenerator::getVersionString() {
|
||||
#endif
|
||||
}
|
||||
|
||||
LTOCodeGenerator::LTOCodeGenerator()
|
||||
: Context(getGlobalContext()),
|
||||
LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
|
||||
: Context(Context),
|
||||
MergedModule(new Module("ld-temp.o", Context)),
|
||||
IRLinker(new Linker(*MergedModule)) {
|
||||
initializeLTOPasses();
|
||||
}
|
||||
|
||||
LTOCodeGenerator::LTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||
: OwnedContext(std::move(Context)), Context(*OwnedContext),
|
||||
MergedModule(new Module("ld-temp.o", *OwnedContext)),
|
||||
IRLinker(new Linker(*MergedModule)) {
|
||||
initializeLTOPasses();
|
||||
}
|
||||
|
||||
LTOCodeGenerator::~LTOCodeGenerator() {}
|
||||
|
||||
// Initialize LTO passes. Please keep this function in sync with
|
||||
|
@ -257,7 +257,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
unsigned BaseArg = 0;
|
||||
|
||||
LTOCodeGenerator CodeGen;
|
||||
LTOCodeGenerator CodeGen(getGlobalContext());
|
||||
|
||||
if (UseDiagnosticHandler)
|
||||
CodeGen.setDiagnosticHandler(handleDiagnostics, nullptr);
|
||||
|
@ -95,13 +95,14 @@ static void handleLibLTODiagnostic(lto_codegen_diagnostic_severity_t Severity,
|
||||
// libLTO API semantics, which require that the code generator owns the object
|
||||
// file.
|
||||
struct LibLTOCodeGenerator : LTOCodeGenerator {
|
||||
LibLTOCodeGenerator() {
|
||||
LibLTOCodeGenerator() : LTOCodeGenerator(getGlobalContext()) {
|
||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||
LibLTOCodeGenerator(std::unique_ptr<LLVMContext> Context)
|
||||
: LTOCodeGenerator(std::move(Context)) {
|
||||
: LTOCodeGenerator(*Context), OwnedContext(std::move(Context)) {
|
||||
setDiagnosticHandler(handleLibLTODiagnostic, nullptr); }
|
||||
|
||||
std::unique_ptr<MemoryBuffer> NativeObjectFile;
|
||||
std::unique_ptr<LLVMContext> OwnedContext;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user