Mercurial > projects > ldc
comparison gen/toir.cpp @ 344:e20ce6d8d374 trunk
[svn r365] Implemented raw struct equality comparison, uses C memcmp.
Renamed DtoDelegateCompare to DtoDelegateEquals, for consistency with the other equality helpers.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 04:11:08 +0200 |
parents | 351c0077d0b3 |
children | 5320fe65a65d |
comparison
equal
deleted
inserted
replaced
343:15eb8f5f2441 | 344:e20ce6d8d374 |
---|---|
1745 eval = DtoArrayEquals(op,l,r); | 1745 eval = DtoArrayEquals(op,l,r); |
1746 } | 1746 } |
1747 else if (t->ty == Tdelegate) | 1747 else if (t->ty == Tdelegate) |
1748 { | 1748 { |
1749 Logger::println("delegate"); | 1749 Logger::println("delegate"); |
1750 eval = DtoDelegateCompare(op,l->getRVal(),r->getRVal()); | 1750 eval = DtoDelegateEquals(op,l->getRVal(),r->getRVal()); |
1751 } | |
1752 else if (t->ty == Tstruct) | |
1753 { | |
1754 Logger::println("struct"); | |
1755 // when this is reached it means there is no opEquals overload. | |
1756 eval = DtoStructEquals(op,l,r); | |
1751 } | 1757 } |
1752 else | 1758 else |
1753 { | 1759 { |
1754 assert(0 && "Unsupported EqualExp type"); | 1760 assert(0 && "Unsupported EqualExp type"); |
1755 } | 1761 } |
2264 r = NULL; | 2270 r = NULL; |
2265 } | 2271 } |
2266 else { | 2272 else { |
2267 assert(l->getType() == r->getType()); | 2273 assert(l->getType() == r->getType()); |
2268 } | 2274 } |
2269 eval = DtoDelegateCompare(op,l,r); | 2275 eval = DtoDelegateEquals(op,l,r); |
2270 } | 2276 } |
2271 else if (t1->isfloating()) | 2277 else if (t1->isfloating()) |
2272 { | 2278 { |
2273 llvm::FCmpInst::Predicate pred = (op == TOKidentity) ? llvm::FCmpInst::FCMP_OEQ : llvm::FCmpInst::FCMP_ONE; | 2279 llvm::FCmpInst::Predicate pred = (op == TOKidentity) ? llvm::FCmpInst::FCMP_OEQ : llvm::FCmpInst::FCMP_ONE; |
2274 eval = new llvm::FCmpInst(pred, l, r, "tmp", p->scopebb()); | 2280 eval = new llvm::FCmpInst(pred, l, r, "tmp", p->scopebb()); |