clang API Documentation

Enumerations | Functions
CGCleanup.cpp File Reference
#include "CGCleanup.h"
#include "CodeGenFunction.h"
Include dependency graph for CGCleanup.cpp:

Go to the source code of this file.

Enumerations

enum  ForActivation_t { ForActivation, ForDeactivation }

Functions

static void ResolveAllBranchFixups (CodeGenFunction &CGF, llvm::SwitchInst *Switch, llvm::BasicBlock *CleanupEntry)
static llvm::SwitchInst * TransitionToCleanupSwitch (CodeGenFunction &CGF, llvm::BasicBlock *Block)
static llvm::BasicBlock * CreateNormalEntry (CodeGenFunction &CGF, EHCleanupScope &Scope)
static llvm::BasicBlock * SimplifyCleanupEntry (CodeGenFunction &CGF, llvm::BasicBlock *Entry)
 Attempts to reduce a cleanup's entry block to a fallthrough. This is basically llvm::MergeBlockIntoPredecessor, except simplified/optimized for the tighter constraints on cleanup blocks.
static void EmitCleanup (CodeGenFunction &CGF, EHScopeStack::Cleanup *Fn, EHScopeStack::Cleanup::Flags flags, llvm::Value *ActiveFlag)
static void ForwardPrebranchedFallthrough (llvm::BasicBlock *Exit, llvm::BasicBlock *From, llvm::BasicBlock *To)
static void destroyOptimisticNormalEntry (CodeGenFunction &CGF, EHCleanupScope &scope)
 We don't need a normal entry block for the given cleanup. Optimistic fixup branches can cause these blocks to come into existence anyway; if so, destroy it.
static bool IsUsedAsNormalCleanup (EHScopeStack &EHStack, EHScopeStack::stable_iterator C)
static bool IsUsedAsEHCleanup (EHScopeStack &EHStack, EHScopeStack::stable_iterator cleanup)
static void SetupCleanupBlockActivation (CodeGenFunction &CGF, EHScopeStack::stable_iterator C, ForActivation_t kind, llvm::Instruction *dominatingIP)
 The given cleanup block is changing activation state. Configure a cleanup variable if necessary.

Enumeration Type Documentation

Enumerator:
ForActivation 
ForDeactivation 

Definition at line 1032 of file CGCleanup.cpp.


Function Documentation

static llvm::BasicBlock* CreateNormalEntry ( CodeGenFunction CGF,
EHCleanupScope Scope 
) [static]
static void destroyOptimisticNormalEntry ( CodeGenFunction CGF,
EHCleanupScope scope 
) [static]

We don't need a normal entry block for the given cleanup. Optimistic fixup branches can cause these blocks to come into existence anyway; if so, destroy it.

The validity of this transformation is very much specific to the exact ways in which we form branches to cleanup entries.

Definition at line 522 of file CGCleanup.cpp.

References clang::CodeGen::EHCleanupScope::getNormalBlock(), clang::CodeGen::CodeGenFunction::getUnreachableBlock(), and clang::CodeGen::CodeGenFunction::NormalCleanupDest.

Referenced by clang::CodeGen::CodeGenFunction::PopCleanupBlock().

static void EmitCleanup ( CodeGenFunction CGF,
EHScopeStack::Cleanup Fn,
EHScopeStack::Cleanup::Flags  flags,
llvm::Value ActiveFlag 
) [static]
static void ForwardPrebranchedFallthrough ( llvm::BasicBlock *  Exit,
llvm::BasicBlock *  From,
llvm::BasicBlock *  To 
) [static]

Definition at line 498 of file CGCleanup.cpp.

Referenced by clang::CodeGen::CodeGenFunction::PopCleanupBlock().

static bool IsUsedAsEHCleanup ( EHScopeStack EHStack,
EHScopeStack::stable_iterator  cleanup 
) [static]
static bool IsUsedAsNormalCleanup ( EHScopeStack EHStack,
EHScopeStack::stable_iterator  C 
) [static]
static void ResolveAllBranchFixups ( CodeGenFunction CGF,
llvm::SwitchInst *  Switch,
llvm::BasicBlock *  CleanupEntry 
) [static]
static void SetupCleanupBlockActivation ( CodeGenFunction CGF,
EHScopeStack::stable_iterator  C,
ForActivation_t  kind,
llvm::Instruction *  dominatingIP 
) [static]
static llvm::BasicBlock* SimplifyCleanupEntry ( CodeGenFunction CGF,
llvm::BasicBlock *  Entry 
) [static]

Attempts to reduce a cleanup's entry block to a fallthrough. This is basically llvm::MergeBlockIntoPredecessor, except simplified/optimized for the tighter constraints on cleanup blocks.

Returns the new block, whatever it is.

Definition at line 433 of file CGCleanup.cpp.

References clang::CodeGen::CodeGenFunction::Builder.

Referenced by clang::CodeGen::CodeGenFunction::PopCleanupBlock().

static llvm::SwitchInst* TransitionToCleanupSwitch ( CodeGenFunction CGF,
llvm::BasicBlock *  Block 
) [static]

Transitions the terminator of the given exit-block of a cleanup to be a cleanup switch.

Definition at line 315 of file CGCleanup.cpp.

References clang::CodeGen::CodeGenFunction::getNormalCleanupDestSlot().

Referenced by clang::CodeGen::CodeGenFunction::ResolveBranchFixups().