From a448fb2da03ece39978784793eea68760e8205a1 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 11 Nov 2008 23:11:34 +0000 Subject: Rework IRgen invariant w.r.t. current insert point. - EmitStmt is no longer required to finish with a current insertion point defined (i.e. it does not need to make dummy blocks). Instead, it can clear the insertion point in the builder which indicates that the current insertion point is unreachable. - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint which respectively test if there is an insert point and ensure an insertion point exists (by making a dummy block). - Clearly mark functions in CodeGenFunction which can be called with no insertion point defined. Currently this is a limited set, and EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR. Remove EmitDummyBlock, which is no longer needed. Clients who haven't already cleared the insertion point (typically via EmitBranch) can do so by hand. Remove isDummyBlock, which has effectively been renamed to HaveInsertPoint. The main thrust of this change is that we no longer have create dummy blocks just to destroy them a short time later in EmitBlock in the common case that there is no unreachable code following something like a goto. Additionally, this means that we are not using the hokey condition in isDummyBlock that a block without a name is a dummy block. Guess how well that works when we never emit block names! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59089 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index bcd1e09800..d5e8c8a588 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -156,14 +156,6 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD, } } -/// isDummyBlock - Return true if BB is an empty basic block -/// with no predecessors. -bool CodeGenFunction::isDummyBlock(const llvm::BasicBlock *BB) { - if (BB->empty() && pred_begin(BB) == pred_end(BB) && !BB->hasName()) - return true; - return false; -} - /// ContainsLabel - Return true if the statement contains a label in it. If /// this statement is not executed normally, it not containing a label means /// that we can just remove the code. -- cgit v1.2.3-70-g09d2