[llvm-commits] [llvm-gcc-4.2] r74643 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-linker-hack.cpp
Owen Anderson
resistor at mac.com
Wed Jul 1 14:24:00 PDT 2009
Author: resistor
Date: Wed Jul 1 16:24:00 2009
New Revision: 74643
URL: http://llvm.org/viewvc/llvm-project?rev=74643&view=rev
Log:
Hold the LLVMContext by reference rather than by pointer.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=74643&r1=74642&r2=74643&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul 1 16:24:00 2009
@@ -87,7 +87,6 @@
static int flag_no_implicit_float = 0;
// Global state for the LLVM backend.
-LLVMContext* Context = 0;
Module *TheModule = 0;
DebugInfo *TheDebugInfo = 0;
TargetMachine *TheTarget = 0;
@@ -420,8 +419,7 @@
int pseudo_argc = Args.size()-1;
cl::ParseCommandLineOptions(pseudo_argc, (char**)&Args[0]);
- Context = new LLVMContext();
- TheModule = new Module("", Context);
+ TheModule = new Module("", getGlobalContext());
// If the target wants to override the architecture, e.g. turning
// powerpc-darwin-... into powerpc64-darwin-... when -m64 is enabled, do so
@@ -525,7 +523,7 @@
memcpy((char*)MB->getBufferStart(), Buffer, Size);
std::string ErrMsg;
- TheModule = ParseBitcodeFile(MB, Context, &ErrMsg);
+ TheModule = ParseBitcodeFile(MB, getGlobalContext(), &ErrMsg);
delete MB;
// FIXME - Do not disable debug info while writing pch.
Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=74643&r1=74642&r2=74643&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Wed Jul 1 16:24:00 2009
@@ -20,6 +20,7 @@
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Analysis/Verifier.h"
@@ -91,6 +92,8 @@
llvm::createLoopDeletionPass();
llvm::createFunctionAttrsPass();
llvm::createPrintModulePass(0);
+
+ llvm::getGlobalContext();
llvm::PrettyStackTraceProgram::PrettyStackTraceProgram(0, 0);
llvm::DIFactory::DIFactory(*MP->getModule());
More information about the llvm-commits
mailing list