aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-10-01 22:29:41 +0000
committerMike Stump <mrs@apple.com>2009-10-01 22:29:41 +0000
commitb289b3f324eb10d416b87080e39b315f6c17a695 (patch)
tree5072d3795ef33801815377e56042a5c5baff1d26 /lib/CodeGen/CGBlocks.cpp
parentf8c3ad7653697ae91634bda56cb0e3d6eac2ef45 (diff)
Implement a FIXME. This improves codegen just a tad.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.cpp')
-rw-r--r--lib/CodeGen/CGBlocks.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index ba14fea36e..79950e8c6b 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -663,20 +663,23 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
StartFunction(BD, ResultType, Fn, Args,
BExpr->getBody()->getLocEnd());
+ CurFuncDecl = OuterFuncDecl;
+ CurCodeDecl = BD;
+
// Save a spot to insert the debug information for all the BlockDeclRefDecls.
llvm::BasicBlock *entry = Builder.GetInsertBlock();
+ llvm::BasicBlock::iterator entry_ptr = Builder.GetInsertPoint();
+ --entry_ptr;
- CurFuncDecl = OuterFuncDecl;
- CurCodeDecl = BD;
- // FIXME: Can we straighten this out not using multiple basic blocks?
- // Set body aside for now.
- llvm::BasicBlock *body = createBasicBlock("body");
- Builder.SetInsertPoint(body);
EmitStmt(BExpr->getBody());
+
// Remember where we were...
llvm::BasicBlock *resume = Builder.GetInsertBlock();
+
// Go back to the entry.
- Builder.SetInsertPoint(entry);
+ ++entry_ptr;
+ Builder.SetInsertPoint(entry, entry_ptr);
+
if (CGDebugInfo *DI = getDebugInfo()) {
// Emit debug information for all the BlockDeclRefDecls.
for (unsigned i=0; i < BlockDeclRefDecls.size(); ++i) {
@@ -691,8 +694,6 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
}
}
}
- // And now go back to the body
- EmitBlock(body);
// And resume where we left off.
if (resume == 0)
Builder.ClearInsertionPoint();