From 71c67457c3bba7c7c183a6a4a5888d41a9f92b6e Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 5 Oct 2013 22:47:30 +0200 Subject: [PATCH] Cleanup: Kill backend_init/term. --- driver/main.cpp | 13 ++++++------- gen/toir.cpp | 15 --------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/driver/main.cpp b/driver/main.cpp index 90db15ef..01b7775c 100644 --- a/driver/main.cpp +++ b/driver/main.cpp @@ -29,8 +29,10 @@ #include "gen/metadata.h" #include "gen/optimizer.h" #include "gen/passes/Passes.h" +#include "gen/runtime.h" #include "llvm/Linker.h" #include "llvm/Support/Host.h" +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Target/TargetMachine.h" @@ -57,8 +59,6 @@ using namespace opts; extern void getenv_setargv(const char *envvar, int *pargc, char** *pargv); -extern void backend_init(); -extern void backend_term(); static cl::opt noDefaultLib("nodefaultlib", cl::desc("Don't add a default library for linking implicitly"), @@ -668,10 +668,6 @@ int main(int argc, char** argv) Expression::init(); initPrecedence(); - backend_init(); - - //printf("%d source files\n",files.dim); - // Build import search path if (global.params.imppath) { @@ -1108,7 +1104,10 @@ int main(int argc, char** argv) } } - backend_term(); + + LLVM_D_FreeRuntime(); + llvm::llvm_shutdown(); + if (global.errors) fatal(); diff --git a/gen/toir.cpp b/gen/toir.cpp index 3fbdf039..8c6c6362 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -3544,18 +3544,3 @@ llvm::Constant* Expression::toConstElem(IRState * p) fatal(); return NULL; } - - -////////////////////////////////////////////////////////////////////////////////////////// - -void backend_init() -{ - // LLVM_D_InitRuntime is done in Module::genLLVMModule - // since it requires the semantic pass to be done -} - -void backend_term() -{ - LLVM_D_FreeRuntime(); - llvm::llvm_shutdown(); -}