comparison gen/toir.cpp @ 295:895e1b50cf2a trunk

[svn r316] Fixed array slice assignments like: int[] arr = ...; arr[] = 42; There was problems with most non basic types... Added an option to premake so we can do: premake --target gnu --no-boehm to disable the Boehm GC.
author lindquist
date Mon, 23 Jun 2008 14:48:42 +0200
parents 068cb3c60afb
children 6b62e8cdf970
comparison
equal deleted inserted replaced
294:94435b0ab2dd 295:895e1b50cf2a
2700 const LLType* llt = DtoType(type); 2700 const LLType* llt = DtoType(type);
2701 2701
2702 LLValue* mem = 0; 2702 LLValue* mem = 0;
2703 bool isinplace = true; 2703 bool isinplace = true;
2704 2704
2705 // already has memory (r-value of assignment)
2706 IRExp* topexp = p->topexp();
2707 if (topexp && topexp->e2 == this && !topexp->v->isSlice())
2708 {
2709 assert(topexp->e2 == this);
2710 sptr = topexp->v->getLVal();
2711 }
2705 // temporary struct literal 2712 // temporary struct literal
2706 if (!p->topexp() || p->topexp()->e2 != this) 2713 else
2707 { 2714 {
2708 sptr = new llvm::AllocaInst(llt,"tmpstructliteral",p->topallocapoint()); 2715 sptr = new llvm::AllocaInst(llt,"tmpstructliteral",p->topallocapoint());
2709 isinplace = false; 2716 isinplace = false;
2710 } 2717 }
2711 // already has memory 2718
2712 else
2713 {
2714 assert(p->topexp()->e2 == this);
2715 sptr = p->topexp()->v->getLVal();
2716 }
2717 2719
2718 // num elements in literal 2720 // num elements in literal
2719 unsigned n = elements->dim; 2721 unsigned n = elements->dim;
2720 2722
2721 // unions might have different types for each literal 2723 // unions might have different types for each literal