Mercurial > projects > ldc
comparison gen/toir.cpp @ 119:79c9ac745fbc trunk
[svn r123] Fixed some typeinfo module name mismatches.
Fixed D-style varargs returning through pointer.
Fixed converting nested function to delegate.
Added std.string and std.format to Phobos.
author | lindquist |
---|---|
date | Mon, 26 Nov 2007 06:45:13 +0100 |
parents | d580b95cce2b |
children | 5ce8ab11e75a |
comparison
equal
deleted
inserted
replaced
118:d580b95cce2b | 119:79c9ac745fbc |
---|---|
2086 } | 2086 } |
2087 else { | 2087 else { |
2088 lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); | 2088 lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); |
2089 } | 2089 } |
2090 | 2090 |
2091 llvm::Value* uval; | |
2092 if (DFuncValue* f = u->isFunc()) { | |
2093 //assert(f->vthis); | |
2094 //uval = f->vthis; | |
2095 llvm::Value* nestvar = p->func()->decl->llvmNested; | |
2096 if (nestvar) | |
2097 uval = nestvar; | |
2098 else | |
2099 uval = llvm::ConstantPointerNull::get(llvm::PointerType::get(llvm::Type::Int8Ty)); | |
2100 } | |
2101 else { | |
2102 uval = u->getRVal(); | |
2103 } | |
2104 | |
2091 llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); | 2105 llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); |
2092 llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb()); | 2106 llvm::Value* castcontext = DtoBitCast(uval,int8ptrty); |
2093 new llvm::StoreInst(castcontext, context, p->scopebb()); | 2107 new llvm::StoreInst(castcontext, context, p->scopebb()); |
2094 | 2108 |
2095 llvm::Value* fptr = DtoGEP(lval,zero,one,"tmp",p->scopebb()); | 2109 llvm::Value* fptr = DtoGEP(lval,zero,one,"tmp",p->scopebb()); |
2096 | 2110 |
2097 assert(func->llvmValue); | 2111 assert(func->llvmValue); |
2098 llvm::Value* castfptr = new llvm::BitCastInst(func->llvmValue,fptr->getType()->getContainedType(0),"tmp",p->scopebb()); | 2112 llvm::Value* castfptr = DtoBitCast(func->llvmValue,fptr->getType()->getContainedType(0)); |
2099 new llvm::StoreInst(castfptr, fptr, p->scopebb()); | 2113 new llvm::StoreInst(castfptr, fptr, p->scopebb()); |
2100 | 2114 |
2101 return new DImValue(type, u->getRVal(), true); | 2115 return new DVarValue(type, lval, true); |
2102 } | 2116 } |
2103 | 2117 |
2104 ////////////////////////////////////////////////////////////////////////////////////////// | 2118 ////////////////////////////////////////////////////////////////////////////////////////// |
2105 | 2119 |
2106 DValue* IdentityExp::toElem(IRState* p) | 2120 DValue* IdentityExp::toElem(IRState* p) |