Mercurial > projects > ldc
comparison gen/toir.cpp @ 118:d580b95cce2b trunk
[svn r122] Fixed temporary delegates can now alloca their own storage.
author | lindquist |
---|---|
date | Mon, 26 Nov 2007 05:50:33 +0100 |
parents | fd7ad91fd713 |
children | 79c9ac745fbc |
comparison
equal
deleted
inserted
replaced
117:56a21f3e5d3e | 118:d580b95cce2b |
---|---|
2077 llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false); | 2077 llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false); |
2078 llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false); | 2078 llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false); |
2079 | 2079 |
2080 const llvm::Type* int8ptrty = llvm::PointerType::get(llvm::Type::Int8Ty); | 2080 const llvm::Type* int8ptrty = llvm::PointerType::get(llvm::Type::Int8Ty); |
2081 | 2081 |
2082 assert(p->topexp() && p->topexp()->e2 == this && p->topexp()->v); | 2082 llvm::Value* lval; |
2083 llvm::Value* lval = p->topexp()->v->getLVal(); | 2083 if (p->topexp() && p->topexp()->e2 == this) { |
2084 assert(p->topexp()->v); | |
2085 lval = p->topexp()->v->getLVal(); | |
2086 } | |
2087 else { | |
2088 lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint()); | |
2089 } | |
2084 | 2090 |
2085 llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); | 2091 llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb()); |
2086 llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb()); | 2092 llvm::Value* castcontext = new llvm::BitCastInst(u->getRVal(),int8ptrty,"tmp",p->scopebb()); |
2087 new llvm::StoreInst(castcontext, context, p->scopebb()); | 2093 new llvm::StoreInst(castcontext, context, p->scopebb()); |
2088 | 2094 |