Introduce a debug info builder.

Moves all code from todebug into a new class.
Also caches the compilation unit in order to fix a LLVM 3.4 compile error.
This commit is contained in:
kai
2013-07-28 23:32:51 +02:00
parent 4e8acf7eb6
commit c28c7fb134
14 changed files with 521 additions and 493 deletions

View File

@@ -34,7 +34,6 @@
#include "gen/rttibuilder.h"
#include "gen/runtime.h"
#include "gen/structs.h"
#include "gen/todebug.h"
#include "gen/tollvm.h"
#include "ir/irdsymbol.h"
#include "ir/irmodule.h"
@@ -78,7 +77,7 @@ static llvm::Function* build_module_function(const std::string &name, const std:
IRBuilder<> builder(bb);
// debug info
DtoDwarfSubProgramInternal(name.c_str(), symbolName.c_str());
gIR->DBuilder.EmitSubProgramInternal(name.c_str(), symbolName.c_str());
// Call ctor's
typedef std::list<FuncDeclaration*>::const_iterator FuncIterator;
@@ -193,7 +192,7 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo)
IRBuilder<> builder(bb);
// debug info
DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str());
gIR->DBuilder.EmitSubProgramInternal(fname.c_str(), fname.c_str());
// get current beginning
LLValue* curbeg = builder.CreateLoad(mref, "current");
@@ -262,7 +261,7 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
gABI = TargetABI::getTarget();
// debug info
DtoDwarfCompileUnit(this);
gIR->DBuilder.EmitCompileUnit(this);
// handle invalid 'objectø module
if (!ClassDeclaration::object) {
@@ -301,8 +300,8 @@ llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
}
}
// finilize debug info
DtoDwarfModuleEnd();
// finalize debug info
gIR->DBuilder.EmitModuleEnd();
// generate ModuleInfo
genmoduleinfo();