Mercurial > projects > ldc
comparison gen/arrays.c @ 51:61bc1b4ad3c4 trunk
[svn r55] Foreach was always generating code as if the value variable was 'ref'
Other not-so-major improvements
author | lindquist |
---|---|
date | Mon, 22 Oct 2007 17:25:44 +0200 |
parents | 4d171915a77b |
children | 0c77619e803b |
comparison
equal
deleted
inserted
replaced
50:6fcc08a4d406 | 51:61bc1b4ad3c4 |
---|---|
443 ptr = new llvm::LoadInst(ptr, "tmp", gIR->scopebb()); | 443 ptr = new llvm::LoadInst(ptr, "tmp", gIR->scopebb()); |
444 ptr = new llvm::GetElementPtrInst(ptr, idx, "tmp", gIR->scopebb()); | 444 ptr = new llvm::GetElementPtrInst(ptr, idx, "tmp", gIR->scopebb()); |
445 | 445 |
446 elem* e = exp->toElem(gIR); | 446 elem* e = exp->toElem(gIR); |
447 Type* et = LLVM_DtoDType(exp->type); | 447 Type* et = LLVM_DtoDType(exp->type); |
448 | 448 LLVM_DtoAssign(et, ptr, e->getValue()); |
449 if (et->ty == Tstruct) { | 449 delete e; |
450 TypeStruct* ts = (TypeStruct*)et; | |
451 LLVM_DtoStructCopy(ts,ptr,e->getValue()); | |
452 } | |
453 else { | |
454 llvm::Value* val = e->getValue(); | |
455 Logger::cout() << "ptr = '" << *ptr << "' element = '" << *val << "'\n"; | |
456 new llvm::StoreInst(val, ptr, gIR->scopebb()); | |
457 } | |
458 } | 450 } |
459 | 451 |
460 ////////////////////////////////////////////////////////////////////////////////////////// | 452 ////////////////////////////////////////////////////////////////////////////////////////// |
461 llvm::Value* LLVM_DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r) | 453 llvm::Value* LLVM_DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r) |
462 { | 454 { |