comparison gen/toir.cpp @ 399:0e6b4d65d3f8

Give error messages for invalid casts. This required passing Loc information to certain functions. Fixes nocompile/b/bug_cgcs_354_A/B.
author Christian Kamm <kamm incasoftware de>
date Sat, 26 Jul 2008 17:19:16 +0200
parents 9ec89aad9dbc
children ac1fcc138e42
comparison
equal deleted inserted replaced
398:811f82dfddbd 399:0e6b4d65d3f8
566 ArrayLengthExp *ale = (ArrayLengthExp *)e1; 566 ArrayLengthExp *ale = (ArrayLengthExp *)e1;
567 DValue* arr = ale->e1->toElem(p); 567 DValue* arr = ale->e1->toElem(p);
568 DVarValue arrval(ale->e1->type, arr->getLVal(), true); 568 DVarValue arrval(ale->e1->type, arr->getLVal(), true);
569 DValue* newlen = e2->toElem(p); 569 DValue* newlen = e2->toElem(p);
570 DSliceValue* slice = DtoResizeDynArray(arrval.getType(), &arrval, newlen); 570 DSliceValue* slice = DtoResizeDynArray(arrval.getType(), &arrval, newlen);
571 DtoAssign(&arrval, slice); 571 DtoAssign(loc, &arrval, slice);
572 return newlen; 572 return newlen;
573 } 573 }
574 574
575 Logger::println("performing normal assignment"); 575 Logger::println("performing normal assignment");
576 576
577 DValue* l = e1->toElem(p); 577 DValue* l = e1->toElem(p);
578 DValue* r = e2->toElem(p); 578 DValue* r = e2->toElem(p);
579 DtoAssign(l, r); 579 DtoAssign(loc, l, r);
580 580
581 if (l->isSlice() || l->isComplex()) 581 if (l->isSlice() || l->isComplex())
582 return l; 582 return l;
583 583
584 LLValue* v; 584 LLValue* v;
628 } 628 }
629 LLValue* v = llvm::GetElementPtrInst::Create(l->getRVal(), r->getRVal(), "tmp", p->scopebb()); 629 LLValue* v = llvm::GetElementPtrInst::Create(l->getRVal(), r->getRVal(), "tmp", p->scopebb());
630 return new DImValue(type, v); 630 return new DImValue(type, v);
631 } 631 }
632 else if (t->iscomplex()) { 632 else if (t->iscomplex()) {
633 return DtoComplexAdd(type, l, r); 633 return DtoComplexAdd(loc, type, l, r);
634 } 634 }
635 assert(0); 635 assert(0);
636 } 636 }
637 else if (t->iscomplex()) { 637 else if (t->iscomplex()) {
638 return DtoComplexAdd(type, l, r); 638 return DtoComplexAdd(loc, type, l, r);
639 } 639 }
640 else { 640 else {
641 return DtoBinAdd(l,r); 641 return DtoBinAdd(l,r);
642 } 642 }
643 } 643 }
658 if (DtoDType(e1->type)->ty == Tpointer) { 658 if (DtoDType(e1->type)->ty == Tpointer) {
659 LLValue* gep = llvm::GetElementPtrInst::Create(l->getRVal(),r->getRVal(),"tmp",p->scopebb()); 659 LLValue* gep = llvm::GetElementPtrInst::Create(l->getRVal(),r->getRVal(),"tmp",p->scopebb());
660 res = new DImValue(type, gep); 660 res = new DImValue(type, gep);
661 } 661 }
662 else if (t->iscomplex()) { 662 else if (t->iscomplex()) {
663 res = DtoComplexAdd(e1->type, l, r); 663 res = DtoComplexAdd(loc, e1->type, l, r);
664 } 664 }
665 else { 665 else {
666 res = DtoBinAdd(l,r); 666 res = DtoBinAdd(l,r);
667 } 667 }
668 DtoAssign(l, res); 668 DtoAssign(loc, l, res);
669 669
670 return res; 670 return res;
671 } 671 }
672 672
673 ////////////////////////////////////////////////////////////////////////////////////////// 673 //////////////////////////////////////////////////////////////////////////////////////////
699 LLValue* idx = p->ir->CreateNeg(r->getRVal(), "tmp"); 699 LLValue* idx = p->ir->CreateNeg(r->getRVal(), "tmp");
700 LLValue* v = llvm::GetElementPtrInst::Create(l->getRVal(), idx, "tmp", p->scopebb()); 700 LLValue* v = llvm::GetElementPtrInst::Create(l->getRVal(), idx, "tmp", p->scopebb());
701 return new DImValue(type, v); 701 return new DImValue(type, v);
702 } 702 }
703 else if (t->iscomplex()) { 703 else if (t->iscomplex()) {
704 return DtoComplexSub(type, l, r); 704 return DtoComplexSub(loc, type, l, r);
705 } 705 }
706 else { 706 else {
707 return DtoBinSub(l,r); 707 return DtoBinSub(l,r);
708 } 708 }
709 } 709 }
729 tmp = llvm::GetElementPtrInst::Create(l->getRVal(),tmp,"tmp",p->scopebb()); 729 tmp = llvm::GetElementPtrInst::Create(l->getRVal(),tmp,"tmp",p->scopebb());
730 res = new DImValue(type, tmp); 730 res = new DImValue(type, tmp);
731 } 731 }
732 else if (t->iscomplex()) { 732 else if (t->iscomplex()) {
733 Logger::println("complex"); 733 Logger::println("complex");
734 res = DtoComplexSub(type, l, r); 734 res = DtoComplexSub(loc, type, l, r);
735 } 735 }
736 else { 736 else {
737 Logger::println("basic"); 737 Logger::println("basic");
738 res = DtoBinSub(l,r); 738 res = DtoBinSub(l,r);
739 } 739 }
740 DtoAssign(l, res); 740 DtoAssign(loc, l, res);
741 741
742 return res; 742 return res;
743 } 743 }
744 744
745 ////////////////////////////////////////////////////////////////////////////////////////// 745 //////////////////////////////////////////////////////////////////////////////////////////
751 751
752 DValue* l = e1->toElem(p); 752 DValue* l = e1->toElem(p);
753 DValue* r = e2->toElem(p); 753 DValue* r = e2->toElem(p);
754 754
755 if (type->iscomplex()) { 755 if (type->iscomplex()) {
756 return DtoComplexMul(type, l, r); 756 return DtoComplexMul(loc, type, l, r);
757 } 757 }
758 758
759 return DtoBinMul(l,r); 759 return DtoBinMul(l,r);
760 } 760 }
761 761
769 DValue* l = e1->toElem(p); 769 DValue* l = e1->toElem(p);
770 DValue* r = e2->toElem(p); 770 DValue* r = e2->toElem(p);
771 771
772 DValue* res; 772 DValue* res;
773 if (type->iscomplex()) { 773 if (type->iscomplex()) {
774 res = DtoComplexMul(type, l, r); 774 res = DtoComplexMul(loc, type, l, r);
775 } 775 }
776 else { 776 else {
777 res = DtoBinMul(l,r); 777 res = DtoBinMul(l,r);
778 } 778 }
779 DtoAssign(l, res); 779 DtoAssign(loc, l, res);
780 780
781 return res; 781 return res;
782 } 782 }
783 783
784 ////////////////////////////////////////////////////////////////////////////////////////// 784 //////////////////////////////////////////////////////////////////////////////////////////
790 790
791 DValue* l = e1->toElem(p); 791 DValue* l = e1->toElem(p);
792 DValue* r = e2->toElem(p); 792 DValue* r = e2->toElem(p);
793 793
794 if (type->iscomplex()) { 794 if (type->iscomplex()) {
795 return DtoComplexDiv(type, l, r); 795 return DtoComplexDiv(loc, type, l, r);
796 } 796 }
797 797
798 return DtoBinDiv(l, r); 798 return DtoBinDiv(l, r);
799 } 799 }
800 800
808 DValue* l = e1->toElem(p); 808 DValue* l = e1->toElem(p);
809 DValue* r = e2->toElem(p); 809 DValue* r = e2->toElem(p);
810 810
811 DValue* res; 811 DValue* res;
812 if (type->iscomplex()) { 812 if (type->iscomplex()) {
813 res = DtoComplexDiv(type, l, r); 813 res = DtoComplexDiv(loc, type, l, r);
814 } 814 }
815 else { 815 else {
816 res = DtoBinDiv(l,r); 816 res = DtoBinDiv(l,r);
817 } 817 }
818 DtoAssign(l, res); 818 DtoAssign(loc, l, res);
819 819
820 return res; 820 return res;
821 } 821 }
822 822
823 ////////////////////////////////////////////////////////////////////////////////////////// 823 //////////////////////////////////////////////////////////////////////////////////////////
842 842
843 DValue* l = e1->toElem(p); 843 DValue* l = e1->toElem(p);
844 DValue* r = e2->toElem(p); 844 DValue* r = e2->toElem(p);
845 845
846 DValue* res = DtoBinRem(l, r); 846 DValue* res = DtoBinRem(l, r);
847 DtoAssign(l, res); 847 DtoAssign(loc, l, res);
848 848
849 return res; 849 return res;
850 } 850 }
851 851
852 ////////////////////////////////////////////////////////////////////////////////////////// 852 //////////////////////////////////////////////////////////////////////////////////////////
931 else if (fndecl->llvmInternal == LLVMalloca) { 931 else if (fndecl->llvmInternal == LLVMalloca) {
932 //Argument* fnarg = Argument::getNth(tf->parameters, 0); 932 //Argument* fnarg = Argument::getNth(tf->parameters, 0);
933 Expression* exp = (Expression*)arguments->data[0]; 933 Expression* exp = (Expression*)arguments->data[0];
934 DValue* expv = exp->toElem(p); 934 DValue* expv = exp->toElem(p);
935 if (expv->getType()->toBasetype()->ty != Tint32) 935 if (expv->getType()->toBasetype()->ty != Tint32)
936 expv = DtoCast(expv, Type::tint32); 936 expv = DtoCast(loc, expv, Type::tint32);
937 LLValue* alloc = new llvm::AllocaInst(LLType::Int8Ty, expv->getRVal(), "alloca", p->scopebb()); 937 LLValue* alloc = new llvm::AllocaInst(LLType::Int8Ty, expv->getRVal(), "alloca", p->scopebb());
938 // done 938 // done
939 return new DImValue(type, alloc); 939 return new DImValue(type, alloc);
940 } 940 }
941 } 941 }
1206 { 1206 {
1207 Logger::print("CastExp::toElem: %s | %s\n", toChars(), type->toChars()); 1207 Logger::print("CastExp::toElem: %s | %s\n", toChars(), type->toChars());
1208 LOG_SCOPE; 1208 LOG_SCOPE;
1209 1209
1210 DValue* u = e1->toElem(p); 1210 DValue* u = e1->toElem(p);
1211 DValue* v = DtoCast(u, to); 1211 DValue* v = DtoCast(loc, u, to);
1212 // force d type to this->type 1212 // force d type to this->type
1213 v->getType() = type; 1213 v->getType() = type;
1214 1214
1215 if (v->isSlice()) { 1215 if (v->isSlice()) {
1216 // only valid as rvalue! 1216 // only valid as rvalue!
1435 else if (e1type->ty == Tarray) { 1435 else if (e1type->ty == Tarray) {
1436 arrptr = DtoArrayPtr(l); 1436 arrptr = DtoArrayPtr(l);
1437 arrptr = DtoGEP1(arrptr,r->getRVal()); 1437 arrptr = DtoGEP1(arrptr,r->getRVal());
1438 } 1438 }
1439 else if (e1type->ty == Taarray) { 1439 else if (e1type->ty == Taarray) {
1440 return DtoAAIndex(type, l, r); 1440 return DtoAAIndex(loc, type, l, r);
1441 } 1441 }
1442 else { 1442 else {
1443 Logger::println("invalid index exp! e1type: %s", e1type->toChars()); 1443 Logger::println("invalid index exp! e1type: %s", e1type->toChars());
1444 assert(0); 1444 assert(0);
1445 } 1445 }
1669 eval = p->ir->CreateICmp(cmpop, lv, rv, "tmp"); 1669 eval = p->ir->CreateICmp(cmpop, lv, rv, "tmp");
1670 } 1670 }
1671 else if (t->iscomplex()) 1671 else if (t->iscomplex())
1672 { 1672 {
1673 Logger::println("complex"); 1673 Logger::println("complex");
1674 eval = DtoComplexEquals(op, l, r); 1674 eval = DtoComplexEquals(loc, op, l, r);
1675 } 1675 }
1676 else if (t->isfloating()) 1676 else if (t->isfloating())
1677 { 1677 {
1678 Logger::println("floating"); 1678 Logger::println("floating");
1679 llvm::FCmpInst::Predicate cmpop; 1679 llvm::FCmpInst::Predicate cmpop;
1835 DVarValue tmpvar(newtype, mem, true); 1835 DVarValue tmpvar(newtype, mem, true);
1836 1836
1837 // default initialize 1837 // default initialize
1838 Expression* exp = newtype->defaultInit(loc); 1838 Expression* exp = newtype->defaultInit(loc);
1839 DValue* iv = exp->toElem(gIR); 1839 DValue* iv = exp->toElem(gIR);
1840 DtoAssign(&tmpvar, iv); 1840 DtoAssign(loc, &tmpvar, iv);
1841 1841
1842 // return as pointer-to 1842 // return as pointer-to
1843 return new DImValue(type, mem, false); 1843 return new DImValue(type, mem, false);
1844 } 1844 }
1845 1845
1932 llvm::BasicBlock* oldend = p->scopeend(); 1932 llvm::BasicBlock* oldend = p->scopeend();
1933 llvm::BasicBlock* assertbb = llvm::BasicBlock::Create("assert", p->topfunc(), oldend); 1933 llvm::BasicBlock* assertbb = llvm::BasicBlock::Create("assert", p->topfunc(), oldend);
1934 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("noassert", p->topfunc(), oldend); 1934 llvm::BasicBlock* endbb = llvm::BasicBlock::Create("noassert", p->topfunc(), oldend);
1935 1935
1936 // test condition 1936 // test condition
1937 LLValue* condval = DtoBoolean(cond); 1937 LLValue* condval = DtoBoolean(loc, cond);
1938 1938
1939 // branch 1939 // branch
1940 llvm::BranchInst::Create(endbb, assertbb, condval, p->scopebb()); 1940 llvm::BranchInst::Create(endbb, assertbb, condval, p->scopebb());
1941 1941
1942 // call assert runtime functions 1942 // call assert runtime functions
1961 Logger::print("NotExp::toElem: %s | %s\n", toChars(), type->toChars()); 1961 Logger::print("NotExp::toElem: %s | %s\n", toChars(), type->toChars());
1962 LOG_SCOPE; 1962 LOG_SCOPE;
1963 1963
1964 DValue* u = e1->toElem(p); 1964 DValue* u = e1->toElem(p);
1965 1965
1966 LLValue* b = DtoBoolean(u); 1966 LLValue* b = DtoBoolean(loc, u);
1967 1967
1968 LLConstant* zero = DtoConstBool(false); 1968 LLConstant* zero = DtoConstBool(false);
1969 b = p->ir->CreateICmpEQ(b,zero); 1969 b = p->ir->CreateICmpEQ(b,zero);
1970 1970
1971 return new DImValue(type, b); 1971 return new DImValue(type, b);
1987 1987
1988 llvm::BasicBlock* oldend = p->scopeend(); 1988 llvm::BasicBlock* oldend = p->scopeend();
1989 llvm::BasicBlock* andand = llvm::BasicBlock::Create("andand", gIR->topfunc(), oldend); 1989 llvm::BasicBlock* andand = llvm::BasicBlock::Create("andand", gIR->topfunc(), oldend);
1990 llvm::BasicBlock* andandend = llvm::BasicBlock::Create("andandend", gIR->topfunc(), oldend); 1990 llvm::BasicBlock* andandend = llvm::BasicBlock::Create("andandend", gIR->topfunc(), oldend);
1991 1991
1992 LLValue* ubool = DtoBoolean(u); 1992 LLValue* ubool = DtoBoolean(loc, u);
1993 DtoStore(ubool,resval); 1993 DtoStore(ubool,resval);
1994 llvm::BranchInst::Create(andand,andandend,ubool,p->scopebb()); 1994 llvm::BranchInst::Create(andand,andandend,ubool,p->scopebb());
1995 1995
1996 p->scope() = IRScope(andand, andandend); 1996 p->scope() = IRScope(andand, andandend);
1997 DValue* v = e2->toElem(p); 1997 DValue* v = e2->toElem(p);
1998 1998
1999 LLValue* vbool = DtoBoolean(v); 1999 LLValue* vbool = DtoBoolean(loc, v);
2000 LLValue* uandvbool = llvm::BinaryOperator::create(llvm::BinaryOperator::And, ubool, vbool,"tmp",p->scopebb()); 2000 LLValue* uandvbool = llvm::BinaryOperator::create(llvm::BinaryOperator::And, ubool, vbool,"tmp",p->scopebb());
2001 DtoStore(uandvbool,resval); 2001 DtoStore(uandvbool,resval);
2002 llvm::BranchInst::Create(andandend,p->scopebb()); 2002 llvm::BranchInst::Create(andandend,p->scopebb());
2003 2003
2004 p->scope() = IRScope(andandend, oldend); 2004 p->scope() = IRScope(andandend, oldend);
2023 2023
2024 llvm::BasicBlock* oldend = p->scopeend(); 2024 llvm::BasicBlock* oldend = p->scopeend();
2025 llvm::BasicBlock* oror = llvm::BasicBlock::Create("oror", gIR->topfunc(), oldend); 2025 llvm::BasicBlock* oror = llvm::BasicBlock::Create("oror", gIR->topfunc(), oldend);
2026 llvm::BasicBlock* ororend = llvm::BasicBlock::Create("ororend", gIR->topfunc(), oldend); 2026 llvm::BasicBlock* ororend = llvm::BasicBlock::Create("ororend", gIR->topfunc(), oldend);
2027 2027
2028 LLValue* ubool = DtoBoolean(u); 2028 LLValue* ubool = DtoBoolean(loc, u);
2029 DtoStore(ubool,resval); 2029 DtoStore(ubool,resval);
2030 llvm::BranchInst::Create(ororend,oror,ubool,p->scopebb()); 2030 llvm::BranchInst::Create(ororend,oror,ubool,p->scopebb());
2031 2031
2032 p->scope() = IRScope(oror, ororend); 2032 p->scope() = IRScope(oror, ororend);
2033 DValue* v = e2->toElem(p); 2033 DValue* v = e2->toElem(p);
2034 2034
2035 LLValue* vbool = DtoBoolean(v); 2035 LLValue* vbool = DtoBoolean(loc, v);
2036 DtoStore(vbool,resval); 2036 DtoStore(vbool,resval);
2037 llvm::BranchInst::Create(ororend,p->scopebb()); 2037 llvm::BranchInst::Create(ororend,p->scopebb());
2038 2038
2039 p->scope() = IRScope(ororend, oldend); 2039 p->scope() = IRScope(ororend, oldend);
2040 2040
2287 llvm::BasicBlock* condtrue = llvm::BasicBlock::Create("condtrue", gIR->topfunc(), oldend); 2287 llvm::BasicBlock* condtrue = llvm::BasicBlock::Create("condtrue", gIR->topfunc(), oldend);
2288 llvm::BasicBlock* condfalse = llvm::BasicBlock::Create("condfalse", gIR->topfunc(), oldend); 2288 llvm::BasicBlock* condfalse = llvm::BasicBlock::Create("condfalse", gIR->topfunc(), oldend);
2289 llvm::BasicBlock* condend = llvm::BasicBlock::Create("condend", gIR->topfunc(), oldend); 2289 llvm::BasicBlock* condend = llvm::BasicBlock::Create("condend", gIR->topfunc(), oldend);
2290 2290
2291 DValue* c = econd->toElem(p); 2291 DValue* c = econd->toElem(p);
2292 LLValue* cond_val = DtoBoolean(c); 2292 LLValue* cond_val = DtoBoolean(loc, c);
2293 llvm::BranchInst::Create(condtrue,condfalse,cond_val,p->scopebb()); 2293 llvm::BranchInst::Create(condtrue,condfalse,cond_val,p->scopebb());
2294 2294
2295 p->scope() = IRScope(condtrue, condfalse); 2295 p->scope() = IRScope(condtrue, condfalse);
2296 DValue* u = e1->toElem(p); 2296 DValue* u = e1->toElem(p);
2297 DtoAssign(dvv, u); 2297 DtoAssign(loc, dvv, u);
2298 llvm::BranchInst::Create(condend,p->scopebb()); 2298 llvm::BranchInst::Create(condend,p->scopebb());
2299 2299
2300 p->scope() = IRScope(condfalse, condend); 2300 p->scope() = IRScope(condfalse, condend);
2301 DValue* v = e2->toElem(p); 2301 DValue* v = e2->toElem(p);
2302 DtoAssign(dvv, v); 2302 DtoAssign(loc, dvv, v);
2303 llvm::BranchInst::Create(condend,p->scopebb()); 2303 llvm::BranchInst::Create(condend,p->scopebb());
2304 2304
2305 p->scope() = IRScope(condend, oldend); 2305 p->scope() = IRScope(condend, oldend);
2306 return dvv; 2306 return dvv;
2307 } 2307 }
2330 LOG_SCOPE; 2330 LOG_SCOPE;
2331 2331
2332 DValue* l = e1->toElem(p); 2332 DValue* l = e1->toElem(p);
2333 2333
2334 if (type->iscomplex()) { 2334 if (type->iscomplex()) {
2335 return DtoComplexNeg(type, l); 2335 return DtoComplexNeg(loc, type, l);
2336 } 2336 }
2337 2337
2338 LLValue* val = l->getRVal(); 2338 LLValue* val = l->getRVal();
2339 Type* t = DtoDType(type); 2339 Type* t = DtoDType(type);
2340 2340
2388 Type* elemtype = DtoDType(e1type->next); 2388 Type* elemtype = DtoDType(e1type->next);
2389 Type* e2type = DtoDType(e2->type); 2389 Type* e2type = DtoDType(e2->type);
2390 2390
2391 if (e2type == elemtype) { 2391 if (e2type == elemtype) {
2392 DSliceValue* slice = DtoCatAssignElement(l,e2); 2392 DSliceValue* slice = DtoCatAssignElement(l,e2);
2393 DtoAssign(l, slice); 2393 DtoAssign(loc, l, slice);
2394 } 2394 }
2395 else if (e1type == e2type) { 2395 else if (e1type == e2type) {
2396 DSliceValue* slice = DtoCatAssignArray(l,e2); 2396 DSliceValue* slice = DtoCatAssignArray(l,e2);
2397 DtoAssign(l, slice); 2397 DtoAssign(loc, l, slice);
2398 } 2398 }
2399 else 2399 else
2400 assert(0 && "only one element at a time right now"); 2400 assert(0 && "only one element at a time right now");
2401 2401
2402 return l; 2402 return l;
2479 // emulate assignment 2479 // emulate assignment
2480 DVarValue* vv = new DVarValue(expr->type, elemAddr, true); 2480 DVarValue* vv = new DVarValue(expr->type, elemAddr, true);
2481 DValue* e = expr->toElem(p); 2481 DValue* e = expr->toElem(p);
2482 DImValue* im = e->isIm(); 2482 DImValue* im = e->isIm();
2483 if (!im || !im->inPlace()) { 2483 if (!im || !im->inPlace()) {
2484 DtoAssign(vv, e); 2484 DtoAssign(loc, vv, e);
2485 } 2485 }
2486 } 2486 }
2487 2487
2488 // return storage directly ? 2488 // return storage directly ?
2489 if (!dyn || (dyn && sliceInPlace)) 2489 if (!dyn || (dyn && sliceInPlace))
2564 DValue* darrptr = new DVarValue(vx->type, arrptr, true); 2564 DValue* darrptr = new DVarValue(vx->type, arrptr, true);
2565 2565
2566 DValue* ve = vx->toElem(p); 2566 DValue* ve = vx->toElem(p);
2567 2567
2568 if (!ve->inPlace()) 2568 if (!ve->inPlace())
2569 DtoAssign(darrptr, ve); 2569 DtoAssign(loc, darrptr, ve);
2570 2570
2571 j++; 2571 j++;
2572 } 2572 }
2573 2573
2574 return new DImValue(type, sptr); 2574 return new DImValue(type, sptr);
2604 LOG_SCOPE; 2604 LOG_SCOPE;
2605 2605
2606 DValue* key = e1->toElem(p); 2606 DValue* key = e1->toElem(p);
2607 DValue* aa = e2->toElem(p); 2607 DValue* aa = e2->toElem(p);
2608 2608
2609 return DtoAAIn(type, aa, key); 2609 return DtoAAIn(loc, type, aa, key);
2610 } 2610 }
2611 2611
2612 DValue* RemoveExp::toElem(IRState* p) 2612 DValue* RemoveExp::toElem(IRState* p)
2613 { 2613 {
2614 Logger::print("RemoveExp::toElem: %s\n", toChars()); 2614 Logger::print("RemoveExp::toElem: %s\n", toChars());
2615 LOG_SCOPE; 2615 LOG_SCOPE;
2616 2616
2617 DValue* aa = e1->toElem(p); 2617 DValue* aa = e1->toElem(p);
2618 DValue* key = e2->toElem(p); 2618 DValue* key = e2->toElem(p);
2619 2619
2620 DtoAARemove(aa, key); 2620 DtoAARemove(loc, aa, key);
2621 2621
2622 return NULL; // does not produce anything useful 2622 return NULL; // does not produce anything useful
2623 } 2623 }
2624 2624
2625 ////////////////////////////////////////////////////////////////////////////////////////// 2625 //////////////////////////////////////////////////////////////////////////////////////////
2650 2650
2651 Logger::println("(%u) aa[%s] = %s", i, ekey->toChars(), eval->toChars()); 2651 Logger::println("(%u) aa[%s] = %s", i, ekey->toChars(), eval->toChars());
2652 2652
2653 // index 2653 // index
2654 DValue* key = ekey->toElem(p); 2654 DValue* key = ekey->toElem(p);
2655 DValue* mem = DtoAAIndex(vtype, aa, key); 2655 DValue* mem = DtoAAIndex(loc, vtype, aa, key);
2656 2656
2657 // store 2657 // store
2658 DValue* val = eval->toElem(p); 2658 DValue* val = eval->toElem(p);
2659 DtoAssign(mem, val); 2659 DtoAssign(loc, mem, val);
2660 } 2660 }
2661 2661
2662 return aa; 2662 return aa;
2663 } 2663 }
2664 2664