Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
593 src2 = gIR->ir->CreateLoad(DtoGEPi(b,0,1,"tmp"),"tmp"); | 593 src2 = gIR->ir->CreateLoad(DtoGEPi(b,0,1,"tmp"),"tmp"); |
594 | 594 |
595 DtoMemCpy(mem,src1,len1); | 595 DtoMemCpy(mem,src1,len1); |
596 mem = gIR->ir->CreateGEP(mem,len1,"tmp"); | 596 mem = gIR->ir->CreateGEP(mem,len1,"tmp"); |
597 DtoMemCpy(mem,src2,len2); | 597 DtoMemCpy(mem,src2,len2); |
598 } | |
599 | |
600 ////////////////////////////////////////////////////////////////////////////////////////// | |
601 void DtoCatArrayElement(llvm::Value* arr, Expression* exp1, Expression* exp2) | |
602 { | |
603 Type* t1 = DtoDType(exp1->type); | |
604 Type* t2 = DtoDType(exp2->type); | |
605 | |
606 assert(t1->ty == Tarray); | |
607 assert(t2 == DtoDType(t1->next)); | |
608 | |
609 DValue* e1 = exp1->toElem(gIR); | |
610 DValue* e2 = exp2->toElem(gIR); | |
611 | |
612 llvm::Value *len1, *src1, *res; | |
613 llvm::Value* a = e1->getRVal(); | |
614 len1 = gIR->ir->CreateLoad(DtoGEPi(a,0,0,"tmp"),"tmp"); | |
615 res = gIR->ir->CreateAdd(len1,DtoConstSize_t(1),"tmp"); | |
616 | |
617 llvm::Value* mem = DtoNewDynArray(arr, res, DtoDType(t1->next), false); | |
618 | |
619 src1 = gIR->ir->CreateLoad(DtoGEPi(a,0,1,"tmp"),"tmp"); | |
620 | |
621 DtoMemCpy(mem,src1,len1); | |
622 | |
623 mem = gIR->ir->CreateGEP(mem,len1,"tmp"); | |
624 DVarValue* memval = new DVarValue(e2->getType(), mem, true); | |
625 DtoAssign(memval, e2); | |
598 } | 626 } |
599 | 627 |
600 ////////////////////////////////////////////////////////////////////////////////////////// | 628 ////////////////////////////////////////////////////////////////////////////////////////// |
601 // helper for eq and cmp | 629 // helper for eq and cmp |
602 static llvm::Value* DtoArrayEqCmp_impl(const char* func, DValue* l, DValue* r, bool useti) | 630 static llvm::Value* DtoArrayEqCmp_impl(const char* func, DValue* l, DValue* r, bool useti) |