diff gen/arrays.cpp @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents facc562f5674
children 44a95ac7368a
line wrap: on
line diff
--- a/gen/arrays.cpp	Fri Jan 04 01:38:42 2008 +0100
+++ b/gen/arrays.cpp	Fri Jan 11 17:57:40 2008 +0100
@@ -598,6 +598,34 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
+void DtoCatArrayElement(llvm::Value* arr, Expression* exp1, Expression* exp2)
+{
+    Type* t1 = DtoDType(exp1->type);
+    Type* t2 = DtoDType(exp2->type);
+
+    assert(t1->ty == Tarray);
+    assert(t2 == DtoDType(t1->next));
+
+    DValue* e1 = exp1->toElem(gIR);
+    DValue* e2 = exp2->toElem(gIR);
+
+    llvm::Value *len1, *src1, *res;
+    llvm::Value* a = e1->getRVal();
+    len1 = gIR->ir->CreateLoad(DtoGEPi(a,0,0,"tmp"),"tmp");
+    res = gIR->ir->CreateAdd(len1,DtoConstSize_t(1),"tmp");
+
+    llvm::Value* mem = DtoNewDynArray(arr, res, DtoDType(t1->next), false);
+
+    src1 = gIR->ir->CreateLoad(DtoGEPi(a,0,1,"tmp"),"tmp");
+
+    DtoMemCpy(mem,src1,len1);
+
+    mem = gIR->ir->CreateGEP(mem,len1,"tmp");
+    DVarValue* memval = new DVarValue(e2->getType(), mem, true);
+    DtoAssign(memval, e2);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
 // helper for eq and cmp
 static llvm::Value* DtoArrayEqCmp_impl(const char* func, DValue* l, DValue* r, bool useti)
 {