Remove IRScope::end

Specifying the basic block before which to insert the new one
is not mandatory when calling llvm::BasicBlock::Create. This
was the only use of the tracked "end" block. The concept was
phony anyway because there is no single "end" to a scope with
unwinding and so on.

For prettying up the IR, it is possible to change the order
of basic blocks using move{Before, After}().
This commit is contained in:
David Nadlinger 2015-08-16 23:31:24 +02:00
parent f3a79f1215
commit bfc20df4c8
11 changed files with 150 additions and 230 deletions

View file

@ -794,10 +794,9 @@ void DtoDefineFunction(FuncDeclaration* fd)
#endif
llvm::BasicBlock* beginbb = llvm::BasicBlock::Create(gIR->context(), "", func);
llvm::BasicBlock* endbb = llvm::BasicBlock::Create(gIR->context(), "endentry", func);
//assert(gIR->scopes.empty());
gIR->scopes.push_back(IRScope(beginbb, endbb));
gIR->scopes.push_back(IRScope(beginbb));
// create alloca point
// this gets erased when the function is complete, so alignment etc does not matter at all
@ -957,10 +956,6 @@ void DtoDefineFunction(FuncDeclaration* fd)
gIR->scopes.pop_back();
// get rid of the endentry block, it's never used
assert(!func->getBasicBlockList().empty());
func->getBasicBlockList().pop_back();
gIR->functions.pop_back();
}