Mercurial > projects > ldc
changeset 936:2ebac4750adb
Removed some dead code.
Fixed assertion filenames for imported template instances. Fixes #152 .
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Wed, 04 Feb 2009 02:10:23 +0100 |
parents | acd745fbdb66 |
children | 6c09179ebba0 |
files | gen/llvmhelpers.cpp gen/llvmhelpers.h gen/toir.cpp gen/toobj.cpp ir/irfunction.cpp ir/irfunction.h |
diffstat | 6 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Tue Feb 03 17:27:01 2009 -0700 +++ b/gen/llvmhelpers.cpp Wed Feb 04 02:10:23 2009 +0100 @@ -109,7 +109,7 @@ // ASSERT HELPER ////////////////////////////////////////////////////////////////////////////////////////*/ -void DtoAssert(Loc* loc, DValue* msg) +void DtoAssert(Module* M, Loc* loc, DValue* msg) { std::vector<LLValue*> args; @@ -124,7 +124,12 @@ } // file param - args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName)); + + // we might be generating for an imported template function + if (!M->ir.irModule) + M->ir.irModule = new IrModule(M, M->srcfile->toChars()); + + args.push_back(DtoLoad(M->ir.irModule->fileName)); // line param LLConstant* c = DtoConstUint(loc->linnum);
--- a/gen/llvmhelpers.h Tue Feb 03 17:27:01 2009 -0700 +++ b/gen/llvmhelpers.h Wed Feb 04 02:10:23 2009 +0100 @@ -16,7 +16,7 @@ llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name = ""); // assertion generator -void DtoAssert(Loc* loc, DValue* msg); +void DtoAssert(Module* M, Loc* loc, DValue* msg); // return the LabelStatement from the current function with the given identifier or NULL if not found LabelStatement* DtoLabelStatement(Identifier* ident);
--- a/gen/toir.cpp Tue Feb 03 17:27:01 2009 -0700 +++ b/gen/toir.cpp Wed Feb 04 02:10:23 2009 +0100 @@ -1768,7 +1768,7 @@ // call assert runtime functions p->scope() = IRScope(assertbb,endbb); - DtoAssert(&loc, msg ? msg->toElem(p) : NULL); + DtoAssert(p->func()->decl->getModule(), &loc, msg ? msg->toElem(p) : NULL); // rewrite the scope p->scope() = IRScope(endbb,oldend); @@ -1943,7 +1943,7 @@ // FIXME: DMD inserts a trap here... we probably should as well !?! #if 1 - DtoAssert(&loc, NULL); + DtoAssert(p->func()->decl->getModule(), &loc, NULL); #else // call the new (?) trap intrinsic p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");
--- a/gen/toobj.cpp Tue Feb 03 17:27:01 2009 -0700 +++ b/gen/toobj.cpp Wed Feb 04 02:10:23 2009 +0100 @@ -99,8 +99,9 @@ ir.module = new llvm::Module(mname); // module ir state - // might already exist via import, just overwrite... - //FIXME: is there a good reason for overwriting? + // might already exist via import, just overwrite since + // the global created for the filename must belong to the right llvm module + // FIXME: but shouldn't this always get reset between modules? like other IrSymbols this->ir.irModule = new IrModule(this, srcfile->toChars()); // set target stuff
--- a/ir/irfunction.cpp Tue Feb 03 17:27:01 2009 -0700 +++ b/ir/irfunction.cpp Wed Feb 04 02:10:23 2009 +0100 @@ -33,9 +33,6 @@ dwarfSubProg = NULL; - srcfileArg = NULL; - msgArg = NULL; - nextUnique.push(0); }
--- a/ir/irfunction.h Tue Feb 03 17:27:01 2009 -0700 +++ b/ir/irfunction.h Wed Feb 04 02:10:23 2009 +0100 @@ -30,9 +30,6 @@ llvm::Constant* dwarfSubProg; - llvm::AllocaInst* srcfileArg; - llvm::AllocaInst* msgArg; - // pushes a unique label scope of the given name void pushUniqueLabelScope(const char* name); // pops a label scope