Mercurial > projects > ldc
comparison gen/toir.cpp @ 291:068cb3c60afb trunk
[svn r312] Changed assert codegen to insert an unreachable terminator after the call to the assert function, which currently calls abort().
Changed array comparison runtime support to pass the array typeinfo instead of the element typeinfo. This allows a cleaner and faster implementation.
author | lindquist |
---|---|
date | Sat, 21 Jun 2008 21:16:26 +0200 |
parents | a3b7c19c866c |
children | 895e1b50cf2a |
comparison
equal
deleted
inserted
replaced
290:ebaf65fc4726 | 291:068cb3c60afb |
---|---|
2061 | 2061 |
2062 // call assert runtime functions | 2062 // call assert runtime functions |
2063 p->scope() = IRScope(assertbb,endbb); | 2063 p->scope() = IRScope(assertbb,endbb); |
2064 DtoAssert(&loc, msg ? msg->toElem(p) : NULL); | 2064 DtoAssert(&loc, msg ? msg->toElem(p) : NULL); |
2065 | 2065 |
2066 if (!gIR->scopereturned()) | 2066 // assert inserts unreachable terminator |
2067 llvm::BranchInst::Create(endbb, p->scopebb()); | 2067 // if (!gIR->scopereturned()) |
2068 // llvm::BranchInst::Create(endbb, p->scopebb()); | |
2068 | 2069 |
2069 // rewrite the scope | 2070 // rewrite the scope |
2070 p->scope() = IRScope(endbb,oldend); | 2071 p->scope() = IRScope(endbb,oldend); |
2071 | 2072 |
2072 // no meaningful return value | 2073 // no meaningful return value |
2241 #if 1 | 2242 #if 1 |
2242 DtoAssert(&loc, NULL); | 2243 DtoAssert(&loc, NULL); |
2243 #else | 2244 #else |
2244 // call the new (?) trap intrinsic | 2245 // call the new (?) trap intrinsic |
2245 p->ir->CreateCall(GET_INTRINSIC_DECL(trap),""); | 2246 p->ir->CreateCall(GET_INTRINSIC_DECL(trap),""); |
2247 new llvm::UnreachableInst(p->scopebb()); | |
2246 #endif | 2248 #endif |
2247 | |
2248 new llvm::UnreachableInst(p->scopebb()); | |
2249 | 2249 |
2250 // this terminated the basicblock, start a new one | 2250 // this terminated the basicblock, start a new one |
2251 // this is sensible, since someone might goto behind the assert | 2251 // this is sensible, since someone might goto behind the assert |
2252 // and prevents compiler errors if a terminator follows the assert | 2252 // and prevents compiler errors if a terminator follows the assert |
2253 llvm::BasicBlock* oldend = gIR->scopeend(); | 2253 llvm::BasicBlock* oldend = gIR->scopeend(); |