diff options
author | Anders Carlsson <andersca@mac.com> | 2009-02-08 07:46:24 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-02-08 07:46:24 +0000 |
commit | bb66f9f2e454135b86462d121629275b6ac38e96 (patch) | |
tree | 33dc29f9cb6721a2f76b457ab5ea2b47d3aec5f2 /lib/CodeGen/CodeGenFunction.h | |
parent | 300e1d6b577268440f1ac90f5062f35c4e86f038 (diff) |
More cleanup stack work, PopCleanupBlock now returns a struct with the switch block and end block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index fa23308176..836a36f952 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -131,6 +131,28 @@ public: /// PushCleanupBlock - Push a new cleanup entry on the stack and set the /// passed in block as the cleanup block. void PushCleanupBlock(llvm::BasicBlock *CleanupBlock); + + /// CleanupBlockInfo - A struct representing a popped cleanup block + struct CleanupBlockInfo { + /// CleanupBlock - the cleanup block + llvm::BasicBlock *CleanupBlock; + + /// SwitchBlock - the block (if any) containing the switch instruction + /// used for jumping to the final destination. + llvm::BasicBlock *SwitchBlock; + + /// EndBlock - the default destination for the switch instruction. + llvm::BasicBlock *EndBlock; + + CleanupBlockInfo(llvm::BasicBlock *cb, llvm::BasicBlock *sb, + llvm::BasicBlock *eb) + : CleanupBlock(cb), SwitchBlock(sb), EndBlock(eb) {} + }; + + /// PopCleanupBlock - Will pop the cleanup entry on the stack, process all + /// branch fixups and return a block info struct with the switch block and + /// end block. + CleanupBlockInfo PopCleanupBlock(); /// CleanupScope - RAII object that will create a cleanup block and /// set the insert point to that block. When destructed, it sets the insert @@ -249,19 +271,16 @@ private: /// label. void EmitStackUpdate(const LabelStmt &S); - typedef std::vector<llvm::BasicBlock *> BlockVector; - typedef std::vector<llvm::BranchInst *> BranchFixupsVector; - struct CleanupEntry { /// CleanupBlock - The block of code that does the actual cleanup. llvm::BasicBlock *CleanupBlock; /// Blocks - Basic blocks that were emitted in the current cleanup scope. - BlockVector Blocks; + std::vector<llvm::BasicBlock *> Blocks; /// BranchFixups - Branch instructions to basic blocks that haven't been /// inserted into the current function yet. - BranchFixupsVector BranchFixups; + std::vector<llvm::BranchInst *> BranchFixups; explicit CleanupEntry(llvm::BasicBlock *cb) : CleanupBlock(cb) {} @@ -791,13 +810,6 @@ private: /// EmitCleanupBlock - emits a single cleanup block. void EmitCleanupBlock(); - llvm::BasicBlock *PopCleanupBlock(BlockVector& Blocks, - BranchFixupsVector& BranchFixups); - - void FixupBranches(llvm::BasicBlock *CleanupBlock, - const BlockVector& Blocks, - BranchFixupsVector& BranchFixups); - /// AddBranchFixup - adds a branch instruction to the list of fixups for the /// current cleanup scope. void AddBranchFixup(llvm::BranchInst *BI); |