Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 92:70d6113eeb8c trunk
[svn r96] Updated to DMD 1.023.
Regular bugfixes.
author | lindquist |
---|---|
date | Thu, 08 Nov 2007 19:13:28 +0100 |
parents | 3f949c6e2e9d |
children | 08508eebbb3e |
comparison
equal
deleted
inserted
replaced
91:3f949c6e2e9d | 92:70d6113eeb8c |
---|---|
793 return _init; | 793 return _init; |
794 } | 794 } |
795 | 795 |
796 ////////////////////////////////////////////////////////////////////////////////////////// | 796 ////////////////////////////////////////////////////////////////////////////////////////// |
797 | 797 |
798 DValue* DtoInitializer(Initializer* init) | 798 DValue* DtoInitializer(Initializer* init, DValue* v) |
799 { | 799 { |
800 if (ExpInitializer* ex = init->isExpInitializer()) | 800 if (ExpInitializer* ex = init->isExpInitializer()) |
801 { | 801 { |
802 Logger::println("expression initializer"); | 802 Logger::println("expression initializer"); |
803 assert(ex->exp); | |
804 if (v) gIR->exps.push_back(IRExp(NULL,ex->exp,v)); | |
803 return ex->exp->toElem(gIR); | 805 return ex->exp->toElem(gIR); |
806 if (v) gIR->exps.pop_back(); | |
804 } | 807 } |
805 else if (init->isVoidInitializer()) | 808 else if (init->isVoidInitializer()) |
806 { | 809 { |
807 // do nothing | 810 // do nothing |
808 } | 811 } |
1224 | 1227 |
1225 ////////////////////////////////////////////////////////////////////////////////////////// | 1228 ////////////////////////////////////////////////////////////////////////////////////////// |
1226 | 1229 |
1227 void DtoAssign(DValue* lhs, DValue* rhs) | 1230 void DtoAssign(DValue* lhs, DValue* rhs) |
1228 { | 1231 { |
1232 Logger::cout() << "DtoAssign(...);\n"; | |
1229 Type* t = DtoDType(lhs->getType()); | 1233 Type* t = DtoDType(lhs->getType()); |
1230 Type* t2 = DtoDType(rhs->getType()); | 1234 Type* t2 = DtoDType(rhs->getType()); |
1231 | 1235 |
1232 if (t->ty == Tstruct) { | 1236 if (t->ty == Tstruct) { |
1233 if (t2 != t) { | 1237 if (t2 != t) { |
1423 llvm::BasicBlock* initbb = new llvm::BasicBlock("ifnotinit",gIR->topfunc(),oldend); | 1427 llvm::BasicBlock* initbb = new llvm::BasicBlock("ifnotinit",gIR->topfunc(),oldend); |
1424 llvm::BasicBlock* endinitbb = new llvm::BasicBlock("ifnotinitend",gIR->topfunc(),oldend); | 1428 llvm::BasicBlock* endinitbb = new llvm::BasicBlock("ifnotinitend",gIR->topfunc(),oldend); |
1425 llvm::Value* cond = gIR->ir->CreateICmpEQ(gIR->ir->CreateLoad(gflag,"tmp"),DtoConstBool(false)); | 1429 llvm::Value* cond = gIR->ir->CreateICmpEQ(gIR->ir->CreateLoad(gflag,"tmp"),DtoConstBool(false)); |
1426 gIR->ir->CreateCondBr(cond, initbb, endinitbb); | 1430 gIR->ir->CreateCondBr(cond, initbb, endinitbb); |
1427 gIR->scope() = IRScope(initbb,endinitbb); | 1431 gIR->scope() = IRScope(initbb,endinitbb); |
1428 DValue* ie = DtoInitializer(init); | 1432 DValue* ie = DtoInitializer(init, NULL); |
1429 if (!ie->inPlace()) { | 1433 if (!ie->inPlace()) { |
1430 DValue* dst = new DVarValue(t, gvar, true); | 1434 DValue* dst = new DVarValue(t, gvar, true); |
1431 DtoAssign(dst, ie); | 1435 DtoAssign(dst, ie); |
1432 } | 1436 } |
1433 gIR->ir->CreateStore(DtoConstBool(true), gflag); | 1437 gIR->ir->CreateStore(DtoConstBool(true), gflag); |