diff gen/toir.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 d0dad1fe0f45
children 50f6e2337a6b
line wrap: on
line diff
--- a/gen/toir.cpp	Tue Aug 05 08:08:00 2008 +0200
+++ b/gen/toir.cpp	Tue Aug 05 19:28:19 2008 +0200
@@ -358,7 +358,7 @@
 
     if (dtype->ty == Tarray) {
         LLConstant* clen = llvm::ConstantInt::get(DtoSize_t(),len,false);
-        LLValue* tmpmem = new llvm::AllocaInst(DtoType(dtype),"tempstring",p->topallocapoint());
+        LLValue* tmpmem = DtoAlloca(DtoType(dtype),"tempstring");
         DtoSetArray(tmpmem, clen, arrptr);
         return new DVarValue(type, tmpmem, true);
     }
@@ -770,7 +770,7 @@
             DValue* expv = exp->toElem(p);
             if (expv->getType()->toBasetype()->ty != Tint32)
                 expv = DtoCast(loc, expv, Type::tint32);
-            return new DImValue(type, gIR->ir->CreateAlloca(LLType::Int8Ty, expv->getRVal(), ".alloca"));
+            return new DImValue(type, DtoAlloca(LLType::Int8Ty, expv->getRVal(), ".alloca"));
         }
     }
 
@@ -1595,7 +1595,7 @@
     // allocate a temporary for the final result. failed to come up with a better way :/
     LLValue* resval = 0;
     llvm::BasicBlock* entryblock = &p->topfunc()->front();
-    resval = new llvm::AllocaInst(LLType::Int1Ty,"andandtmp",p->topallocapoint());
+    resval = DtoAlloca(LLType::Int1Ty,"andandtmp");
 
     DValue* u = e1->toElem(p);
 
@@ -1631,7 +1631,7 @@
     // allocate a temporary for the final result. failed to come up with a better way :/
     LLValue* resval = 0;
     llvm::BasicBlock* entryblock = &p->topfunc()->front();
-    resval = new llvm::AllocaInst(LLType::Int1Ty,"orortmp",p->topallocapoint());
+    resval = DtoAlloca(LLType::Int1Ty,"orortmp");
 
     DValue* u = e1->toElem(p);
 
@@ -1758,7 +1758,7 @@
 
     const LLPointerType* int8ptrty = getPtrToType(LLType::Int8Ty);
 
-    LLValue* lval = new llvm::AllocaInst(DtoType(type), "tmpdelegate", p->topallocapoint());
+    LLValue* lval = DtoAlloca(DtoType(type), "tmpdelegate");
 
     DValue* u = e1->toElem(p);
     LLValue* uval;
@@ -1897,7 +1897,7 @@
 
     // allocate a temporary for the final result. failed to come up with a better way :/
     llvm::BasicBlock* entryblock = &p->topfunc()->front();
-    LLValue* resval = new llvm::AllocaInst(resty,"condtmp",p->topallocapoint());
+    LLValue* resval = DtoAlloca(resty,"condtmp");
     DVarValue* dvv = new DVarValue(type, resval, true);
 
     llvm::BasicBlock* oldend = p->scopeend();
@@ -2034,7 +2034,7 @@
     DtoForceDefineDsymbol(fd);
 
     const LLType* dgty = DtoType(type);
-    LLValue* lval = new llvm::AllocaInst(dgty,"dgstorage",p->topallocapoint());
+    LLValue* lval = DtoAlloca(dgty,"dgstorage");
 
     LLValue* context = DtoGEPi(lval,0,0);
     const LLPointerType* pty = isaPointer(context->getType()->getContainedType(0));
@@ -2085,7 +2085,7 @@
 
     // dst pointer
     LLValue* dstMem = 0;
-    dstMem = new llvm::AllocaInst(llStoType, "arrayliteral", p->topallocapoint());
+    dstMem = DtoAlloca(llStoType, "arrayliteral");
 
     // store elements
     for (size_t i=0; i<len; ++i)
@@ -2143,7 +2143,7 @@
 
     LLValue* mem = 0;
 
-    LLValue* sptr = new llvm::AllocaInst(llt,"tmpstructliteral",p->topallocapoint());
+    LLValue* sptr = DtoAlloca(llt,"tmpstructliteral");
 
 
     // num elements in literal
@@ -2255,7 +2255,7 @@
     const LLType* aalltype = DtoType(type);
 
     // it should be possible to avoid the temporary in some cases
-    LLValue* tmp = new llvm::AllocaInst(aalltype,"aaliteral",p->topallocapoint());
+    LLValue* tmp = DtoAlloca(aalltype,"aaliteral");
     DValue* aa = new DVarValue(type, tmp, true);
     DtoStore(LLConstant::getNullValue(aalltype), tmp);