Mercurial > projects > ldc
diff gen/statements.cpp @ 270:d9d5d59873d8 trunk
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
Branch statements now emit a new block after it.
Fixed the _adSort runtime function had a bad signature.
Added a missing dot prefix on compiler generated string tables for string switch.
Fixed, PTRSIZE seems like it was wrong on 64bit, now it definitely gets set properly.
author | lindquist |
---|---|
date | Mon, 16 Jun 2008 16:01:19 +0200 |
parents | 23d0d9855cad |
children | 1e6e2b5d5bfe |
line wrap: on
line diff
--- a/gen/statements.cpp Sun Jun 15 18:57:11 2008 +0200 +++ b/gen/statements.cpp Mon Jun 16 16:01:19 2008 +0200 @@ -440,19 +440,26 @@ targetLoopStatement = tmp->statement; // find the right break block and jump there + bool found = false; IRState::LoopScopeVec::reverse_iterator it; for(it = p->loopbbs.rbegin(); it != p->loopbbs.rend(); ++it) { if(it->s == targetLoopStatement) { llvm::BranchInst::Create(it->end, p->scopebb()); - return; + found = true; + break; } } - assert(0); + assert(found); } else { emit_finallyblocks(p, enclosingtryfinally, p->loopbbs.back().enclosingtryfinally); llvm::BranchInst::Create(p->loopbbs.back().end, p->scopebb()); } + + // the break terminated this basicblock, start a new one + llvm::BasicBlock* oldend = gIR->scopeend(); + llvm::BasicBlock* bb = llvm::BasicBlock::Create("afterbreak", p->topfunc(), oldend); + p->scope() = IRScope(bb,oldend); } ////////////////////////////////////////////////////////////////////////////// @@ -724,7 +731,7 @@ const LLType* elemTy = DtoType(condition->type); const llvm::ArrayType* arrTy = llvm::ArrayType::get(elemTy, inits.size()); LLConstant* arrInit = llvm::ConstantArray::get(arrTy, inits); - llvm::GlobalVariable* arr = new llvm::GlobalVariable(arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, "string_switch_table_data", gIR->module); + llvm::GlobalVariable* arr = new llvm::GlobalVariable(arrTy, true, llvm::GlobalValue::InternalLinkage, arrInit, ".string_switch_table_data", gIR->module); const LLType* elemPtrTy = getPtrToType(elemTy); LLConstant* arrPtr = llvm::ConstantExpr::getBitCast(arr, elemPtrTy); @@ -739,7 +746,7 @@ sinits.push_back(arrPtr); LLConstant* sInit = llvm::ConstantStruct::get(sTy, sinits); - switchTable = new llvm::GlobalVariable(sTy, true, llvm::GlobalValue::InternalLinkage, sInit, "string_switch_table", gIR->module); + switchTable = new llvm::GlobalVariable(sTy, true, llvm::GlobalValue::InternalLinkage, sInit, ".string_switch_table", gIR->module); } // body block