Mercurial > projects > ldc
diff gen/arrays.cpp @ 683:b411c41a9716
Only allocate the module file name once. Fixes #90.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 12 Oct 2008 10:35:16 +0200 |
parents | 93433f4b6963 |
children | 30b42a283c8e |
line wrap: on
line diff
--- a/gen/arrays.cpp Sat Oct 11 22:44:17 2008 +0200 +++ b/gen/arrays.cpp Sun Oct 12 10:35:16 2008 +0200 @@ -1,6 +1,7 @@ #include "gen/llvm.h" #include "mtype.h" +#include "module.h" #include "dsymbol.h" #include "aggregate.h" #include "declaration.h" @@ -13,6 +14,7 @@ #include "gen/runtime.h" #include "gen/logger.h" #include "gen/dvalue.h" +#include "ir/irmodule.h" ////////////////////////////////////////////////////////////////////////////////////////// @@ -1072,25 +1074,11 @@ llvm::AttrListPtr palist; // file param - // FIXME: every array bounds check creates a global for the filename !!! - LLConstant* c = DtoConstString(loc.filename); - - llvm::AllocaInst* alloc = gIR->func()->srcfileArg; - if (!alloc) - { - alloc = DtoAlloca(c->getType(), ".srcfile"); - gIR->func()->srcfileArg = alloc; - } - LLValue* ptr = DtoGEPi(alloc, 0,0, "tmp"); - DtoStore(c->getOperand(0), ptr); - ptr = DtoGEPi(alloc, 0,1, "tmp"); - DtoStore(c->getOperand(1), ptr); - - args.push_back(alloc); + args.push_back(gIR->dmodule->ir.irModule->fileName); palist = palist.addAttr(1, llvm::Attribute::ByVal); // line param - c = DtoConstUint(loc.linnum); + LLConstant* c = DtoConstUint(loc.linnum); args.push_back(c); // call