Mercurial > projects > ldc
comparison gen/arrays.cpp @ 365:bfb9d28f045a trunk
[svn r386] Fixed broken DtoBoolean.
Some code cleanup.
author | lindquist |
---|---|
date | Tue, 15 Jul 2008 00:17:03 +0200 |
parents | 8014dbd24605 |
children | 811f82dfddbd |
comparison
equal
deleted
inserted
replaced
364:8014dbd24605 | 365:bfb9d28f045a |
---|---|
756 | 756 |
757 ////////////////////////////////////////////////////////////////////////////////////////// | 757 ////////////////////////////////////////////////////////////////////////////////////////// |
758 LLValue* DtoArrayEquals(TOK op, DValue* l, DValue* r) | 758 LLValue* DtoArrayEquals(TOK op, DValue* l, DValue* r) |
759 { | 759 { |
760 LLValue* res = DtoArrayEqCmp_impl("_adEq", l, r, true); | 760 LLValue* res = DtoArrayEqCmp_impl("_adEq", l, r, true); |
761 res = new llvm::ICmpInst(llvm::ICmpInst::ICMP_NE, res, DtoConstInt(0), "tmp", gIR->scopebb()); | 761 res = gIR->ir->CreateICmpNE(res, DtoConstInt(0), "tmp"); |
762 if (op == TOKnotequal) | 762 if (op == TOKnotequal) |
763 res = gIR->ir->CreateNot(res, "tmp"); | 763 res = gIR->ir->CreateNot(res, "tmp"); |
764 | 764 |
765 return res; | 765 return res; |
766 } | 766 } |
815 Type* t = DtoDType(DtoDType(l->getType())->next); | 815 Type* t = DtoDType(DtoDType(l->getType())->next); |
816 if (t->ty == Tchar) | 816 if (t->ty == Tchar) |
817 res = DtoArrayEqCmp_impl("_adCmpChar", l, r, false); | 817 res = DtoArrayEqCmp_impl("_adCmpChar", l, r, false); |
818 else | 818 else |
819 res = DtoArrayEqCmp_impl("_adCmp", l, r, true); | 819 res = DtoArrayEqCmp_impl("_adCmp", l, r, true); |
820 res = new llvm::ICmpInst(cmpop, res, DtoConstInt(0), "tmp", gIR->scopebb()); | 820 res = gIR->ir->CreateICmp(cmpop, res, DtoConstInt(0), "tmp"); |
821 } | 821 } |
822 | 822 |
823 assert(res); | 823 assert(res); |
824 return res; | 824 return res; |
825 } | 825 } |
857 assert(r); | 857 assert(r); |
858 | 858 |
859 // compare lengths | 859 // compare lengths |
860 len1 = DtoArrayLen(l); | 860 len1 = DtoArrayLen(l); |
861 len2 = DtoArrayLen(r); | 861 len2 = DtoArrayLen(r); |
862 LLValue* b1 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,len1,len2,"tmp"); | 862 LLValue* b1 = gIR->ir->CreateICmpEQ(len1,len2,"tmp"); |
863 | 863 |
864 // compare pointers | 864 // compare pointers |
865 ptr1 = DtoArrayPtr(l); | 865 ptr1 = DtoArrayPtr(l); |
866 ptr2 = DtoArrayPtr(r); | 866 ptr2 = DtoArrayPtr(r); |
867 LLValue* b2 = gIR->ir->CreateICmp(llvm::ICmpInst::ICMP_EQ,ptr1,ptr2,"tmp"); | 867 LLValue* b2 = gIR->ir->CreateICmpEQ(ptr1,ptr2,"tmp"); |
868 | 868 |
869 // combine | 869 // combine |
870 LLValue* res = gIR->ir->CreateAnd(b1,b2,"tmp"); | 870 LLValue* res = gIR->ir->CreateAnd(b1,b2,"tmp"); |
871 | 871 |
872 // return result | 872 // return result |