diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 06:58:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 06:58:07 +0000 |
commit | d286f05f1234bac289173f0eed88d7ecbaea0099 (patch) | |
tree | 5c3ce8caaaffe3b6b1e698e4346b372baaeaf84f /lib/CodeGen/CodeGenFunction.h | |
parent | 75cc2c484873dfbc53a026f5cc50095fd67510ac (diff) |
Avoid generation of dead code in a few more situations.
- Emit variable declarations as "simple", we want to avoid forcing the creation
of a dummy basic block, but still need to make the variable available for
later use.
- With that, we can now skip IRgen for other unreachable statements (which
don't define a label).
- Anders, I added two fixmes on calls to EmitVLASize, can you check them?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76361 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index ffea5023fc..f2de3f6acb 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -147,7 +147,11 @@ public: ~CleanupScope() { CGF.PushCleanupBlock(CleanupBB); - CGF.Builder.SetInsertPoint(CurBB); + // FIXME: This is silly, move this into the builder. + if (CurBB) + CGF.Builder.SetInsertPoint(CurBB); + else + CGF.Builder.ClearInsertionPoint(); } }; @@ -510,6 +514,8 @@ public: // EmitVLASize - Generate code for any VLA size expressions that might occur // in a variably modified type. If Ty is a VLA, will return the value that // corresponds to the size in bytes of the VLA type. Will return 0 otherwise. + /// + /// This function can be called with a null (unreachable) insert point. llvm::Value *EmitVLASize(QualType Ty); // GetVLASize - Returns an LLVM value that corresponds to the size in bytes @@ -537,9 +543,21 @@ public: // Declaration Emission //===--------------------------------------------------------------------===// + /// EmitDecl - Emit a declaration. + /// + /// This function can be called with a null (unreachable) insert point. void EmitDecl(const Decl &D); + + /// EmitBlockVarDecl - Emit a block variable declaration. + /// + /// This function can be called with a null (unreachable) insert point. void EmitBlockVarDecl(const VarDecl &D); + + /// EmitLocalBlockVarDecl - Emit a local block variable declaration. + /// + /// This function can be called with a null (unreachable) insert point. void EmitLocalBlockVarDecl(const VarDecl &D); + void EmitStaticBlockVarDecl(const VarDecl &D); /// EmitParmDecl - Emit a ParmVarDecl or an ImplicitParamDecl. |