clang 19.0.0git
Enumerations | Functions
CGCleanup.cpp File Reference
#include "CGCleanup.h"
#include "CodeGenFunction.h"
#include "llvm/Support/SaveAndRestore.h"

Go to the source code of this file.


enum  ForActivation_t { ForActivation , ForDeactivation }


static void createStoreInstBefore (llvm::Value *value, Address addr, llvm::Instruction *beforeInst, CodeGenFunction &CGF)
static llvm::LoadInst * createLoadInstBefore (Address addr, const Twine &name, llvm::Instruction *beforeInst, CodeGenFunction &CGF)
static void ResolveAllBranchFixups (CodeGenFunction &CGF, llvm::SwitchInst *Switch, llvm::BasicBlock *CleanupEntry)
 All the branch fixups on the EH stack have propagated out past the outermost normal cleanup; resolve them all by adding cases to the given switch instruction.
static llvm::SwitchInst * TransitionToCleanupSwitch (CodeGenFunction &CGF, llvm::BasicBlock *Block)
 Transitions the terminator of the given exit-block of a cleanup to be a cleanup switch.
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.
static void EmitCleanup (CodeGenFunction &CGF, EHScopeStack::Cleanup *Fn, EHScopeStack::Cleanup::Flags flags, Address 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.
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.
static void EmitSehScope (CodeGenFunction &CGF, llvm::FunctionCallee &SehCppScope)

Enumeration Type Documentation

◆ ForActivation_t


Definition at line 1193 of file CGCleanup.cpp.

Function Documentation

◆ createLoadInstBefore()

static llvm::LoadInst * createLoadInstBefore ( Address  addr,
const Twine &  name,
llvm::Instruction *  beforeInst,
CodeGenFunction CGF 

◆ CreateNormalEntry()

static llvm::BasicBlock * CreateNormalEntry ( CodeGenFunction CGF,
EHCleanupScope Scope 

◆ createStoreInstBefore()

static void createStoreInstBefore ( llvm::Value value,
Address  addr,
llvm::Instruction *  beforeInst,
CodeGenFunction CGF 

◆ destroyOptimisticNormalEntry()

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.

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

Definition at line 597 of file CGCleanup.cpp.

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

◆ EmitCleanup()

static void EmitCleanup ( CodeGenFunction CGF,
EHScopeStack::Cleanup Fn,
EHScopeStack::Cleanup::Flags  flags,
Address  ActiveFlag 

◆ EmitSehScope()

static void EmitSehScope ( CodeGenFunction CGF,
llvm::FunctionCallee &  SehCppScope 

◆ ForwardPrebranchedFallthrough()

static void ForwardPrebranchedFallthrough ( llvm::BasicBlock *  Exit,
llvm::BasicBlock *  From,
llvm::BasicBlock *  To 

Definition at line 573 of file CGCleanup.cpp.

References clang::Switch.

◆ IsUsedAsEHCleanup()

static bool IsUsedAsEHCleanup ( EHScopeStack EHStack,
EHScopeStack::stable_iterator  cleanup 

◆ ResolveAllBranchFixups()

static void ResolveAllBranchFixups ( CodeGenFunction CGF,
llvm::SwitchInst *  Switch,
llvm::BasicBlock *  CleanupEntry 

◆ SetupCleanupBlockActivation()

static void SetupCleanupBlockActivation ( CodeGenFunction CGF,
EHScopeStack::stable_iterator  C,
ForActivation_t  kind,
llvm::Instruction *  dominatingIP 

◆ SimplifyCleanupEntry()

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.

Returns the new block, whatever it is.

Definition at line 514 of file CGCleanup.cpp.

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

◆ TransitionToCleanupSwitch()

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

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

Definition at line 351 of file CGCleanup.cpp.

References clang::Block, createLoadInstBefore(), clang::CodeGen::CodeGenFunction::getNormalCleanupDestSlot(), and clang::Switch.