Mercurial > projects > ldc
diff gen/classes.cpp @ 155:7f92f477ff53 trunk
[svn r171] starting to move IR data from AST nodes into IRState; started with IrFunction
author | ChristianK |
---|---|
date | Tue, 29 Apr 2008 21:33:50 +0200 |
parents | 4c577c2b7229 |
children | ccd07d9f2ce9 |
line wrap: on
line diff
--- 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<llvm::Constant>(fd->irFunc->func); + assert(gIR->irFunc[fd]->func); + llvm::Constant* c = llvm::cast<llvm::Constant>(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<llvm::Constant>(fd->irFunc->func); + assert(gIR->irFunc[fd]->func); + llvm::Constant* c = llvm::cast<llvm::Constant>(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<llvm::Value*> ctorargs; @@ -881,8 +881,8 @@ for (size_t i=0; i<arr->dim; 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); }