# HG changeset patch # User ChristianK # Date 1209497630 -7200 # Node ID 7f92f477ff53ecab881ecbdb62db76b8dcabb0a9 # Parent 5cb946f323d2faf9c10080314cb9a347806d189f [svn r171] starting to move IR data from AST nodes into IRState; started with IrFunction diff -r 5cb946f323d2 -r 7f92f477ff53 dmd/declaration.h --- a/dmd/declaration.h Tue Mar 25 18:25:24 2008 +0100 +++ b/dmd/declaration.h Tue Apr 29 21:33:50 2008 +0200 @@ -24,7 +24,6 @@ namespace llvm { class Value; } -struct IrFunction; struct IrVar; struct IrGlobal; struct IrLocal; @@ -614,7 +613,6 @@ // llvmdc stuff bool runTimeHack; - IrFunction* irFunc; std::set nestedVars; }; diff -r 5cb946f323d2 -r 7f92f477ff53 dmd/func.c --- a/dmd/func.c Tue Mar 25 18:25:24 2008 +0100 +++ b/dmd/func.c Tue Apr 29 21:33:50 2008 +0200 @@ -75,7 +75,6 @@ shidden = NULL; // llvmdc runTimeHack = false; - irFunc = NULL; } Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s) diff -r 5cb946f323d2 -r 7f92f477ff53 gen/classes.cpp --- a/gen/classes.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/classes.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -553,8 +553,8 @@ if (FuncDeclaration* fd = dsym->isFuncDeclaration()) { DtoForceDeclareDsymbol(fd); - assert(fd->irFunc->func); - llvm::Constant* c = llvm::cast(fd->irFunc->func); + assert(gIR->irFunc[fd]->func); + llvm::Constant* c = llvm::cast(gIR->irFunc[fd]->func); // cast if necessary (overridden method) if (c->getType() != vtbltype->getElementType(k)) c = llvm::ConstantExpr::getBitCast(c, vtbltype->getElementType(k)); @@ -636,8 +636,8 @@ FuncDeclaration* fd = dsym->isFuncDeclaration(); assert(fd); DtoForceDeclareDsymbol(fd); - assert(fd->irFunc->func); - llvm::Constant* c = llvm::cast(fd->irFunc->func); + assert(gIR->irFunc[fd]->func); + llvm::Constant* c = llvm::cast(gIR->irFunc[fd]->func); // we have to bitcast, as the type created in ResolveClass expects a different this type c = llvm::ConstantExpr::getBitCast(c, iri->vtblTy->getContainedType(k)); @@ -783,9 +783,9 @@ LOG_SCOPE; size_t idx = 2; //idx += tc->sym->irStruct->interfaces.size(); - llvm::Value* nest = gIR->func()->decl->irFunc->nestedVar; + llvm::Value* nest = gIR->irFunc[gIR->func()->decl]->nestedVar; if (!nest) - nest = gIR->func()->decl->irFunc->thisVar; + nest = gIR->irFunc[gIR->func()->decl]->thisVar; assert(nest); llvm::Value* gep = DtoGEPi(mem,0,idx,"tmp"); nest = DtoBitCast(nest, gep->getType()->getContainedType(0)); @@ -851,7 +851,7 @@ assert(ctor); DtoForceDeclareDsymbol(ctor); - llvm::Function* fn = ctor->irFunc->func; + llvm::Function* fn = gIR->irFunc[ctor]->func; TypeFunction* tf = (TypeFunction*)DtoDType(ctor->type); std::vector ctorargs; @@ -881,8 +881,8 @@ for (size_t i=0; idim; i++) { FuncDeclaration* fd = (FuncDeclaration*)arr->data[i]; - assert(fd->irFunc->func); - new llvm::CallInst(fd->irFunc->func, instance, "", gIR->scopebb()); + assert(gIR->irFunc[fd]->func); + new llvm::CallInst(gIR->irFunc[fd]->func, instance, "", gIR->scopebb()); } } @@ -1300,8 +1300,8 @@ else if (cd->dtors.dim == 1) { DtorDeclaration *d = (DtorDeclaration *)cd->dtors.data[0]; DtoForceDeclareDsymbol(d); - assert(d->irFunc->func); - return llvm::ConstantExpr::getBitCast(isaConstant(d->irFunc->func), getPtrToType(llvm::Type::Int8Ty)); + assert(gIR->irFunc[d]->func); + return llvm::ConstantExpr::getBitCast(isaConstant(gIR->irFunc[d]->func), getPtrToType(llvm::Type::Int8Ty)); } std::string gname("_D"); @@ -1319,8 +1319,8 @@ { DtorDeclaration *d = (DtorDeclaration *)cd->dtors.data[i]; DtoForceDeclareDsymbol(d); - assert(d->irFunc->func); - builder.CreateCall(d->irFunc->func, thisptr); + assert(gIR->irFunc[d]->func); + builder.CreateCall(gIR->irFunc[d]->func, thisptr); } builder.CreateRetVoid(); @@ -1516,7 +1516,7 @@ // default constructor if (cd->defaultCtor && !cd->isInterfaceDeclaration() && !cd->isAbstract()) { DtoForceDeclareDsymbol(cd->defaultCtor); - c = isaConstant(cd->defaultCtor->irFunc->func); + c = isaConstant(gIR->irFunc[cd->defaultCtor]->func); const llvm::Type* toTy = cinfo->irStruct->constInit->getOperand(12)->getType(); c = llvm::ConstantExpr::getBitCast(c, toTy); } diff -r 5cb946f323d2 -r 7f92f477ff53 gen/functions.cpp --- a/gen/functions.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/functions.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -232,7 +232,7 @@ llvm::Function* func = llvm::dyn_cast(fn); assert(func); assert(func->isIntrinsic()); - fdecl->irFunc->func = func; + gIR->irFunc[fdecl]->func = func; return func; } @@ -311,9 +311,9 @@ if (fdecl->runTimeHack) { Logger::println("runtime hack func chars: %s", fdecl->toChars()); - if (!fdecl->irFunc) { - fdecl->irFunc = new IrFunction(fdecl); - fdecl->irFunc->func = LLVM_D_GetRuntimeFunction(gIR->module, fdecl->toChars()); + if (gIR->irFunc.find(fdecl) == gIR->irFunc.end()) { + gIR->irFunc[fdecl] = new IrFunction(fdecl); + gIR->irFunc[fdecl]->func = LLVM_D_GetRuntimeFunction(gIR->module, fdecl->toChars()); } return; } @@ -330,8 +330,8 @@ else if (fdecl->llvmInternal == LLVMva_start) declareOnly = true; - if (!fdecl->irFunc) { - fdecl->irFunc = new IrFunction(fdecl); + if (gIR->irFunc.find(fdecl) == gIR->irFunc.end()) { + gIR->irFunc[fdecl] = new IrFunction(fdecl); } // mangled name @@ -358,7 +358,7 @@ assert(func->getFunctionType() == functype); // add func to IRFunc - fdecl->irFunc->func = func; + gIR->irFunc[fdecl]->func = func; // calling convention if (!vafunc && fdecl->llvmInternal != LLVMintrinsic) @@ -366,7 +366,7 @@ else // fall back to C, it should be the right thing to do func->setCallingConv(llvm::CallingConv::C); - fdecl->irFunc->func = func; + gIR->irFunc[fdecl]->func = func; assert(llvm::isa(f->llvmType->get())); // main @@ -388,22 +388,22 @@ int k = 0; if (f->llvmRetInPtr) { iarg->setName("retval"); - fdecl->irFunc->retArg = iarg; + gIR->irFunc[fdecl]->retArg = iarg; ++iarg; } if (f->llvmUsesThis) { iarg->setName("this"); - fdecl->irFunc->thisVar = iarg; - assert(fdecl->irFunc->thisVar); + gIR->irFunc[fdecl]->thisVar = iarg; + assert(gIR->irFunc[fdecl]->thisVar); ++iarg; } if (f->linkage == LINKd && f->varargs == 1) { iarg->setName("_arguments"); - fdecl->irFunc->_arguments = iarg; + gIR->irFunc[fdecl]->_arguments = iarg; ++iarg; iarg->setName("_argptr"); - fdecl->irFunc->_argptr = iarg; + gIR->irFunc[fdecl]->_argptr = iarg; ++iarg; } @@ -457,14 +457,14 @@ // debug info if (global.params.symdebug) { Module* mo = fd->getModule(); - fd->irFunc->dwarfSubProg = DtoDwarfSubProgram(fd, DtoDwarfCompileUnit(mo)); + gIR->irFunc[fd]->dwarfSubProg = DtoDwarfSubProgram(fd, DtoDwarfCompileUnit(mo)); } Type* t = DtoDType(fd->type); TypeFunction* f = (TypeFunction*)t; assert(f->llvmType); - llvm::Function* func = fd->irFunc->func; + llvm::Function* func = gIR->irFunc[fd]->func; const llvm::FunctionType* functype = func->getFunctionType(); // only members of the current module or template instances maybe be defined @@ -476,8 +476,8 @@ if (fd->fbody != 0) { Logger::println("Doing function body for: %s", fd->toChars()); - assert(fd->irFunc); - gIR->functions.push_back(fd->irFunc); + assert(gIR->irFunc.count(fd) != 0); + gIR->functions.push_back(gIR->irFunc[fd]); if (fd->isMain()) gIR->emitMain = true; @@ -527,7 +527,7 @@ llvm::Value* parentNested = NULL; if (FuncDeclaration* fd2 = fd->toParent2()->isFuncDeclaration()) { if (!fd->isStatic()) // huh? - parentNested = fd2->irFunc->nestedVar; + parentNested = gIR->irFunc[fd2]->nestedVar; } // need result variable? (nested) @@ -553,7 +553,7 @@ if (vd->isParameter()) { if (!vd->irLocal->value) { assert(vd == fd->vthis); - vd->irLocal->value = fd->irFunc->thisVar; + vd->irLocal->value = gIR->irFunc[fd]->thisVar; } assert(vd->irLocal->value); nestTypes.push_back(vd->irLocal->value->getType()); @@ -564,18 +564,18 @@ } const llvm::StructType* nestSType = llvm::StructType::get(nestTypes); Logger::cout() << "nested var struct has type:" << *nestSType << '\n'; - fd->irFunc->nestedVar = new llvm::AllocaInst(nestSType,"nestedvars",allocaPoint); + gIR->irFunc[fd]->nestedVar = new llvm::AllocaInst(nestSType,"nestedvars",allocaPoint); if (parentNested) { - assert(fd->irFunc->thisVar); - llvm::Value* ptr = gIR->ir->CreateBitCast(fd->irFunc->thisVar, parentNested->getType(), "tmp"); - gIR->ir->CreateStore(ptr, DtoGEPi(fd->irFunc->nestedVar, 0,0, "tmp")); + assert(gIR->irFunc[fd]->thisVar); + llvm::Value* ptr = gIR->ir->CreateBitCast(gIR->irFunc[fd]->thisVar, parentNested->getType(), "tmp"); + gIR->ir->CreateStore(ptr, DtoGEPi(gIR->irFunc[fd]->nestedVar, 0,0, "tmp")); } for (std::set::iterator i=fd->nestedVars.begin(); i!=fd->nestedVars.end(); ++i) { VarDeclaration* vd = *i; if (vd->isParameter()) { assert(vd->irLocal); - gIR->ir->CreateStore(vd->irLocal->value, DtoGEPi(fd->irFunc->nestedVar, 0, vd->irLocal->nestedIndex, "tmp")); - vd->irLocal->value = fd->irFunc->nestedVar; + gIR->ir->CreateStore(vd->irLocal->value, DtoGEPi(gIR->irFunc[fd]->nestedVar, 0, vd->irLocal->nestedIndex, "tmp")); + vd->irLocal->value = gIR->irFunc[fd]->nestedVar; } } } @@ -583,9 +583,9 @@ // copy _argptr to a memory location if (f->linkage == LINKd && f->varargs == 1) { - llvm::Value* argptrmem = new llvm::AllocaInst(fd->irFunc->_argptr->getType(), "_argptrmem", gIR->topallocapoint()); - new llvm::StoreInst(fd->irFunc->_argptr, argptrmem, gIR->scopebb()); - fd->irFunc->_argptr = argptrmem; + llvm::Value* argptrmem = new llvm::AllocaInst(gIR->irFunc[fd]->_argptr->getType(), "_argptrmem", gIR->topallocapoint()); + new llvm::StoreInst(gIR->irFunc[fd]->_argptr, argptrmem, gIR->scopebb()); + gIR->irFunc[fd]->_argptr = argptrmem; } // output function body diff -r 5cb946f323d2 -r 7f92f477ff53 gen/irstate.h --- a/gen/irstate.h Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/irstate.h Tue Apr 29 21:33:50 2008 +0200 @@ -3,6 +3,7 @@ #include #include +#include #include "root.h" #include "aggregate.h" @@ -76,6 +77,8 @@ typedef std::vector FunctionVector; FunctionVector functions; IrFunction* func(); + // ir data associated with function declarations + std::map irFunc; llvm::Function* topfunc(); TypeFunction* topfunctype(); diff -r 5cb946f323d2 -r 7f92f477ff53 gen/statements.cpp --- a/gen/statements.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/statements.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -77,11 +77,11 @@ if (p->topfunc()->getReturnType() == llvm::Type::VoidTy) { IrFunction* f = p->func(); assert(f->type->llvmRetInPtr); - assert(f->decl->irFunc->retArg); + assert(gIR->irFunc[f->decl]->retArg); if (global.params.symdebug) DtoDwarfStopPoint(loc.linnum); - DValue* rvar = new DVarValue(f->type->next, f->decl->irFunc->retArg, true); + DValue* rvar = new DVarValue(f->type->next, gIR->irFunc[f->decl]->retArg, true); p->exps.push_back(IRExp(NULL,exp,rvar)); DValue* e = exp->toElem(p); diff -r 5cb946f323d2 -r 7f92f477ff53 gen/todebug.cpp --- a/gen/todebug.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/todebug.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -182,14 +182,14 @@ void DtoDwarfFuncStart(FuncDeclaration* fd) { - assert(fd->irFunc->dwarfSubProg); - gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), dbgToArrTy(fd->irFunc->dwarfSubProg)); + assert(gIR->irFunc[fd]->dwarfSubProg); + gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.func.start"), dbgToArrTy(gIR->irFunc[fd]->dwarfSubProg)); } void DtoDwarfFuncEnd(FuncDeclaration* fd) { - assert(fd->irFunc->dwarfSubProg); - gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.region.end"), dbgToArrTy(fd->irFunc->dwarfSubProg)); + assert(gIR->irFunc[fd]->dwarfSubProg); + gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.region.end"), dbgToArrTy(gIR->irFunc[fd]->dwarfSubProg)); } ////////////////////////////////////////////////////////////////////////////////////////////////// diff -r 5cb946f323d2 -r 7f92f477ff53 gen/toir.cpp --- a/gen/toir.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/toir.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -62,7 +62,7 @@ if (vd->nestedref) { Logger::println("has nestedref set"); assert(vd->irLocal); - vd->irLocal->value = p->func()->decl->irFunc->nestedVar; + vd->irLocal->value = gIR->irFunc[p->func()->decl]->nestedVar; assert(vd->irLocal->value); assert(vd->irLocal->nestedIndex >= 0); } @@ -157,7 +157,7 @@ vd->getIrValue() = p->func()->decl->irFunc->_arguments; assert(vd->getIrValue()); return new DVarValue(vd, vd->getIrValue(), true);*/ - llvm::Value* v = p->func()->decl->irFunc->_arguments; + llvm::Value* v = gIR->irFunc[p->func()->decl]->_arguments; assert(v); return new DVarValue(vd, v, true); } @@ -169,7 +169,7 @@ vd->getIrValue() = p->func()->decl->irFunc->_argptr; assert(vd->getIrValue()); return new DVarValue(vd, vd->getIrValue(), true);*/ - llvm::Value* v = p->func()->decl->irFunc->_argptr; + llvm::Value* v = gIR->irFunc[p->func()->decl]->_argptr; assert(v); return new DVarValue(vd, v, true); } @@ -243,7 +243,7 @@ if (fdecl->llvmInternal != LLVMva_arg) {// && fdecl->llvmValue == 0) DtoForceDeclareDsymbol(fdecl); } - return new DFuncValue(fdecl, fdecl->irFunc->func); + return new DFuncValue(fdecl, gIR->irFunc[fdecl]->func); } else if (SymbolDeclaration* sdecl = var->isSymbolDeclaration()) { @@ -1317,7 +1317,7 @@ FuncDeclaration* fd = fv->func; assert(fd); DtoForceDeclareDsymbol(fd); - return new DFuncValue(fd, fd->irFunc->func); + return new DFuncValue(fd, gIR->irFunc[fd]->func); } else if (DImValue* im = v->isIm()) { Logger::println("is immediate"); @@ -1422,7 +1422,7 @@ // super call if (e1->op == TOKsuper) { DtoForceDeclareDsymbol(fdecl); - funcval = fdecl->irFunc->func; + funcval = gIR->irFunc[fdecl]->func; assert(funcval); } // normal virtual call @@ -1443,7 +1443,7 @@ // static call else { DtoForceDeclareDsymbol(fdecl); - funcval = fdecl->irFunc->func; + funcval = gIR->irFunc[fdecl]->func; assert(funcval); //assert(funcval->getType() == DtoType(fdecl->type)); } @@ -1466,7 +1466,7 @@ if (VarDeclaration* vd = var->isVarDeclaration()) { llvm::Value* v; - v = p->func()->decl->irFunc->thisVar; + v = gIR->irFunc[p->func()->decl]->thisVar; if (llvm::isa(v)) v = new llvm::LoadInst(v, "tmp", p->scopebb()); return new DThisValue(vd, v); @@ -2216,7 +2216,7 @@ if (DFuncValue* f = u->isFunc()) { //assert(f->vthis); //uval = f->vthis; - llvm::Value* nestvar = p->func()->decl->irFunc->nestedVar; + llvm::Value* nestvar = gIR->irFunc[p->func()->decl]->nestedVar; if (nestvar) uval = nestvar; else @@ -2256,7 +2256,7 @@ else { DtoForceDeclareDsymbol(func); - castfptr = func->irFunc->func; + castfptr = gIR->irFunc[func]->func; } castfptr = DtoBitCast(castfptr, fptr->getType()->getContainedType(0)); @@ -2490,7 +2490,7 @@ llvm::Value* context = DtoGEPi(lval,0,0,"tmp",p->scopebb()); const llvm::PointerType* pty = isaPointer(context->getType()->getContainedType(0)); - llvm::Value* llvmNested = p->func()->decl->irFunc->nestedVar; + llvm::Value* llvmNested = gIR->irFunc[p->func()->decl]->nestedVar; if (llvmNested == NULL) { llvm::Value* nullcontext = llvm::ConstantPointerNull::get(pty); p->ir->CreateStore(nullcontext, context); @@ -2502,8 +2502,8 @@ llvm::Value* fptr = DtoGEPi(lval,0,1,"tmp",p->scopebb()); - assert(fd->irFunc->func); - llvm::Value* castfptr = new llvm::BitCastInst(fd->irFunc->func,fptr->getType()->getContainedType(0),"tmp",p->scopebb()); + assert(gIR->irFunc[fd]->func); + llvm::Value* castfptr = new llvm::BitCastInst(gIR->irFunc[fd]->func,fptr->getType()->getContainedType(0),"tmp",p->scopebb()); new llvm::StoreInst(castfptr, fptr, p->scopebb()); if (temp) diff -r 5cb946f323d2 -r 7f92f477ff53 gen/tollvm.cpp --- a/gen/tollvm.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/tollvm.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -724,7 +724,7 @@ assert(p->isFuncDeclaration() || p->isClassDeclaration()); if (FuncDeclaration* fd = p->isFuncDeclaration()) { - llvm::Value* v = fd->irFunc->nestedVar; + llvm::Value* v = gIR->irFunc[fd]->nestedVar; assert(v); return v->getType(); } @@ -754,9 +754,9 @@ if (fd->toParent2() == func) { - if (!func->irFunc->nestedVar) + if (!gIR->irFunc[func]->nestedVar) return NULL; - return DtoBitCast(v, func->irFunc->nestedVar->getType()); + return DtoBitCast(v, gIR->irFunc[func]->nestedVar->getType()); } v = DtoBitCast(v, get_next_frame_ptr_type(fd)); @@ -807,10 +807,10 @@ // in the right scope already if (func == irfunc->decl) - return irfunc->decl->irFunc->nestedVar; + return gIR->irFunc[irfunc->decl]->nestedVar; // use the 'this' pointer - llvm::Value* ptr = irfunc->decl->irFunc->thisVar; + llvm::Value* ptr = gIR->irFunc[irfunc->decl]->thisVar; assert(ptr); // return the fully resolved frame pointer @@ -878,7 +878,7 @@ assert(ptr && "nested var, but no context"); // we must cast here to be sure. nested classes just have a void* - ptr = DtoBitCast(ptr, func->irFunc->nestedVar->getType()); + ptr = DtoBitCast(ptr, gIR->irFunc[func]->nestedVar->getType()); // index nested var and load (if necessary) llvm::Value* v = DtoGEPi(ptr, 0, vd->irLocal->nestedIndex, "tmp"); @@ -964,9 +964,9 @@ llvm::Value* tmp = rhs->getRVal(); FuncDeclaration* fdecl = gIR->func()->decl; // respecify the this param - if (!llvm::isa(fdecl->irFunc->thisVar)) - fdecl->irFunc->thisVar = new llvm::AllocaInst(tmp->getType(), "newthis", gIR->topallocapoint()); - DtoStore(tmp, fdecl->irFunc->thisVar); + if (!llvm::isa(gIR->irFunc[fdecl]->thisVar)) + gIR->irFunc[fdecl]->thisVar = new llvm::AllocaInst(tmp->getType(), "newthis", gIR->topallocapoint()); + DtoStore(tmp, gIR->irFunc[fdecl]->thisVar); } // regular class ref -> class ref assignment else { diff -r 5cb946f323d2 -r 7f92f477ff53 gen/toobj.cpp --- a/gen/toobj.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/toobj.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -177,7 +177,7 @@ size_t n = gIR->ctors.size(); if (n == 1) - return gIR->ctors[0]->irFunc->func; + return gIR->irFunc[gIR->ctors[0]]->func; std::string name("_D"); name.append(gIR->dmodule->mangle()); @@ -192,7 +192,7 @@ LLVMBuilder builder(bb); for (size_t i=0; ictors[i]->irFunc->func; + llvm::Function* f = gIR->irFunc[gIR->ctors[i]]->func; llvm::CallInst* call = builder.CreateCall(f,""); call->setCallingConv(llvm::CallingConv::Fast); } @@ -210,7 +210,7 @@ size_t n = gIR->dtors.size(); if (n == 1) - return gIR->dtors[0]->irFunc->func; + return gIR->irFunc[gIR->dtors[0]]->func; std::string name("_D"); name.append(gIR->dmodule->mangle()); @@ -225,7 +225,7 @@ LLVMBuilder builder(bb); for (size_t i=0; idtors[i]->irFunc->func; + llvm::Function* f = gIR->irFunc[gIR->dtors[i]]->func; llvm::CallInst* call = builder.CreateCall(f,""); call->setCallingConv(llvm::CallingConv::Fast); } @@ -243,7 +243,7 @@ size_t n = gIR->unitTests.size(); if (n == 1) - return gIR->unitTests[0]->irFunc->func; + return gIR->irFunc[gIR->unitTests[0]]->func; std::string name("_D"); name.append(gIR->dmodule->mangle()); @@ -258,7 +258,7 @@ LLVMBuilder builder(bb); for (size_t i=0; iunitTests[i]->irFunc->func; + llvm::Function* f = gIR->irFunc[gIR->unitTests[i]]->func; llvm::CallInst* call = builder.CreateCall(f,""); call->setCallingConv(llvm::CallingConv::Fast); } diff -r 5cb946f323d2 -r 7f92f477ff53 gen/typinf.cpp --- a/gen/typinf.cpp Tue Mar 25 18:25:24 2008 +0100 +++ b/gen/typinf.cpp Tue Apr 29 21:33:50 2008 +0200 @@ -925,8 +925,8 @@ fd = fdx->overloadExactMatch(tftohash); if (fd) { DtoForceDeclareDsymbol(fd); - assert(fd->irFunc->func != 0); - llvm::Constant* c = isaConstant(fd->irFunc->func); + assert(gIR->irFunc[fd]->func != 0); + llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func); assert(c); c = llvm::ConstantExpr::getBitCast(c, ptty); sinits.push_back(c); @@ -951,8 +951,8 @@ fd = fdx->overloadExactMatch(tfeqptr); if (fd) { DtoForceDeclareDsymbol(fd); - assert(fd->irFunc->func != 0); - llvm::Constant* c = isaConstant(fd->irFunc->func); + assert(gIR->irFunc[fd]->func != 0); + llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func); assert(c); c = llvm::ConstantExpr::getBitCast(c, ptty); sinits.push_back(c); @@ -979,8 +979,8 @@ fd = fdx->overloadExactMatch(tftostring); if (fd) { DtoForceDeclareDsymbol(fd); - assert(fd->irFunc->func != 0); - llvm::Constant* c = isaConstant(fd->irFunc->func); + assert(gIR->irFunc[fd]->func != 0); + llvm::Constant* c = isaConstant(gIR->irFunc[fd]->func); assert(c); c = llvm::ConstantExpr::getBitCast(c, ptty); sinits.push_back(c);