Mercurial > projects > ldc
diff gen/toir.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 | d11848349f97 |
children | ccd07d9f2ce9 |
line wrap: on
line diff
--- 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<llvm::AllocaInst>(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)