[cfe-commits] r59022 - in /cfe/trunk/lib/CodeGen: CGObjCMac.cpp CGStmt.cpp CodeGenFunction.h
Daniel Dunbar
daniel at zuster.org
Mon Nov 10 20:34:24 PST 2008
Author: ddunbar
Date: Mon Nov 10 22:34:23 2008
New Revision: 59022
URL: http://llvm.org/viewvc/llvm-project?rev=59022&view=rev
Log:
Add CodeGenFunction::EmitDummyBlock for marking places where we make
"dummy" blocks (blocks just used to make sure we have a place to dump
code to).
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=59022&r1=59021&r2=59022&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon Nov 10 22:34:23 2008
@@ -1717,7 +1717,7 @@
CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
CGF.Builder.CreateUnreachable();
- CGF.EmitBlock(CGF.createBasicBlock("bb"));
+ CGF.EmitDummyBlock();
}
void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E,
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=59022&r1=59021&r2=59022&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Nov 10 22:34:23 2008
@@ -167,6 +167,10 @@
Builder.SetInsertPoint(BB);
}
+void CodeGenFunction::EmitDummyBlock() {
+ EmitBlock(createBasicBlock());
+}
+
void CodeGenFunction::EmitLabel(const LabelStmt &S) {
llvm::BasicBlock *NextBB = getBasicBlockForLabel(&S);
EmitBlock(NextBB);
@@ -189,7 +193,7 @@
// Emit a block after the branch so that dead code after a goto has some place
// to go.
- Builder.SetInsertPoint(createBasicBlock("", CurFn));
+ EmitDummyBlock();
}
void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
@@ -210,7 +214,7 @@
// Emit a block after the branch so that dead code after a goto has some place
// to go.
- Builder.SetInsertPoint(createBasicBlock("", CurFn));
+ EmitDummyBlock();
}
void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
@@ -433,7 +437,7 @@
// Emit a block after the branch so that dead code after a return has some
// place to go.
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
/// EmitReturnStmt - Note that due to GCC extensions, this can have an operand
@@ -473,7 +477,7 @@
// Emit a block after the branch so that dead code after a return has some
// place to go.
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
@@ -487,7 +491,7 @@
llvm::BasicBlock *Block = BreakContinueStack.back().BreakBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
void CodeGenFunction::EmitContinueStmt() {
@@ -495,7 +499,7 @@
llvm::BasicBlock *Block = BreakContinueStack.back().ContinueBlock;
Builder.CreateBr(Block);
- EmitBlock(createBasicBlock());
+ EmitDummyBlock();
}
/// EmitCaseStmtRange - If case statement range is not too big then
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=59022&r1=59021&r2=59022&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Nov 10 22:34:23 2008
@@ -225,6 +225,11 @@
llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
void EmitBlock(llvm::BasicBlock *BB);
+
+ /// EmitDummyBlock - Emit a new block which will never be branched
+ /// to. This is used to satisfy the invariant that codegen always
+ /// has an active unterminated block to dump code into.
+ void EmitDummyBlock();
/// ErrorUnsupported - Print out an error that codegen doesn't support the
/// specified stmt yet.
More information about the cfe-commits
mailing list