comparison gen/statements.cpp @ 479:672eb4893b55

Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding.
author Christian Kamm <kamm incasoftware de>
date Tue, 05 Aug 2008 19:28:19 +0200
parents 0e6b4d65d3f8
children a34078905d01
comparison
equal deleted inserted replaced
478:b657298222d9 479:672eb4893b55
142 if (global.params.symdebug) 142 if (global.params.symdebug)
143 DtoDwarfStopPoint(loc.linnum); 143 DtoDwarfStopPoint(loc.linnum);
144 144
145 if (match) 145 if (match)
146 { 146 {
147 LLValue* allocainst = new llvm::AllocaInst(DtoType(match->type), "._tmp_if_var", p->topallocapoint()); 147 LLValue* allocainst = DtoAlloca(DtoType(match->type), "._tmp_if_var");
148 match->ir.irLocal = new IrLocal(match); 148 match->ir.irLocal = new IrLocal(match);
149 match->ir.irLocal->value = allocainst; 149 match->ir.irLocal->value = allocainst;
150 } 150 }
151 151
152 DValue* cond_e = condition->toElem(p); 152 DValue* cond_e = condition->toElem(p);
673 DValue* val = e->toElem(gIR); 673 DValue* val = e->toElem(gIR);
674 LLValue* llval; 674 LLValue* llval;
675 if (DSliceValue* sval = val->isSlice()) 675 if (DSliceValue* sval = val->isSlice())
676 { 676 {
677 // give storage 677 // give storage
678 llval = new llvm::AllocaInst(DtoType(e->type), "tmp", gIR->topallocapoint()); 678 llval = DtoAlloca(DtoType(e->type), "tmp");
679 DVarValue* vv = new DVarValue(e->type, llval, true); 679 DVarValue* vv = new DVarValue(e->type, llval, true);
680 DtoAssign(e->loc, vv, val); 680 DtoAssign(e->loc, vv, val);
681 } 681 }
682 else 682 else
683 { 683 {
911 911
912 Logger::println("aggr = %s", aggr->toChars()); 912 Logger::println("aggr = %s", aggr->toChars());
913 913
914 // key 914 // key
915 const LLType* keytype = key ? DtoType(key->type) : DtoSize_t(); 915 const LLType* keytype = key ? DtoType(key->type) : DtoSize_t();
916 LLValue* keyvar = new llvm::AllocaInst(keytype, "foreachkey", p->topallocapoint()); 916 LLValue* keyvar = DtoAlloca(keytype, "foreachkey");
917 if (key) 917 if (key)
918 { 918 {
919 //key->llvmValue = keyvar; 919 //key->llvmValue = keyvar;
920 assert(!key->ir.irLocal); 920 assert(!key->ir.irLocal);
921 key->ir.irLocal = new IrLocal(key); 921 key->ir.irLocal = new IrLocal(key);
926 // value 926 // value
927 Logger::println("value = %s", value->toPrettyChars()); 927 Logger::println("value = %s", value->toPrettyChars());
928 const LLType* valtype = DtoType(value->type); 928 const LLType* valtype = DtoType(value->type);
929 LLValue* valvar = NULL; 929 LLValue* valvar = NULL;
930 if (!value->isRef() && !value->isOut()) 930 if (!value->isRef() && !value->isOut())
931 valvar = new llvm::AllocaInst(valtype, "foreachval", p->topallocapoint()); 931 valvar = DtoAlloca(valtype, "foreachval");
932 if (!value->ir.irLocal) 932 if (!value->ir.irLocal)
933 value->ir.irLocal = new IrLocal(value); 933 value->ir.irLocal = new IrLocal(value);
934 934
935 // what to iterate 935 // what to iterate
936 DValue* aggrval = aggr->toElem(p); 936 DValue* aggrval = aggr->toElem(p);
1246 // FIXME: every use creates a global for the filename !!! 1246 // FIXME: every use creates a global for the filename !!!
1247 c = DtoConstString(loc.filename); 1247 c = DtoConstString(loc.filename);
1248 llvm::AllocaInst* alloc = gIR->func()->srcfileArg; 1248 llvm::AllocaInst* alloc = gIR->func()->srcfileArg;
1249 if (!alloc) 1249 if (!alloc)
1250 { 1250 {
1251 alloc = new llvm::AllocaInst(c->getType(), ".srcfile", gIR->topallocapoint()); 1251 alloc = DtoAlloca(c->getType(), ".srcfile");
1252 gIR->func()->srcfileArg = alloc; 1252 gIR->func()->srcfileArg = alloc;
1253 } 1253 }
1254 LLValue* ptr = DtoGEPi(alloc, 0,0, "tmp"); 1254 LLValue* ptr = DtoGEPi(alloc, 0,0, "tmp");
1255 DtoStore(c->getOperand(0), ptr); 1255 DtoStore(c->getOperand(0), ptr);
1256 ptr = DtoGEPi(alloc, 0,1, "tmp"); 1256 ptr = DtoGEPi(alloc, 0,1, "tmp");