LLVM 20.0.0git
Classes | Macros | Functions | Variables
WinEHPrepare.cpp File Reference
#include "llvm/CodeGen/WinEHPrepare.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/EHPersonalities.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/SSAUpdater.h"

Go to the source code of this file.

Classes

struct  WorkItem
 

Macros

#define DEBUG_TYPE   "win-eh-prepare"
 

Functions

 INITIALIZE_PASS (WinEHPrepare, DEBUG_TYPE, "Prepare Windows exceptions", false, false) FunctionPass *llvm
 
static int addUnwindMapEntry (WinEHFuncInfo &FuncInfo, int ToState, const BasicBlock *BB)
 
static void addTryBlockMapEntry (WinEHFuncInfo &FuncInfo, int TryLow, int TryHigh, int CatchHigh, ArrayRef< const CatchPadInst * > Handlers)
 
static BasicBlockgetCleanupRetUnwindDest (const CleanupPadInst *CleanupPad)
 
static void calculateStateNumbersForInvokes (const Function *Fn, WinEHFuncInfo &FuncInfo)
 
static const BasicBlockgetEHPadFromPredecessor (const BasicBlock *BB, Value *ParentPad)
 
static void calculateCXXStateNumbers (WinEHFuncInfo &FuncInfo, const Instruction *FirstNonPHI, int ParentState)
 
static int addSEHExcept (WinEHFuncInfo &FuncInfo, int ParentState, const Function *Filter, const BasicBlock *Handler)
 
static int addSEHFinally (WinEHFuncInfo &FuncInfo, int ParentState, const BasicBlock *Handler)
 
static void calculateSEHStateNumbers (WinEHFuncInfo &FuncInfo, const Instruction *FirstNonPHI, int ParentState)
 
static bool isTopLevelPadForMSVC (const Instruction *EHPad)
 
static int addClrEHHandler (WinEHFuncInfo &FuncInfo, int HandlerParentState, int TryParentState, ClrHandlerType HandlerType, uint32_t TypeToken, const BasicBlock *Handler)
 

Variables

static cl::opt< boolDisableDemotion ("disable-demotion", cl::Hidden, cl::desc("Clone multicolor basic blocks but do not demote cross scopes"), cl::init(false))
 
static cl::opt< boolDisableCleanups ("disable-cleanups", cl::Hidden, cl::desc("Do not remove implausible terminators or other similar cleanups"), cl::init(false))
 
static cl::opt< boolDemoteCatchSwitchPHIOnlyOpt ("demote-catchswitch-only", cl::Hidden, cl::desc("Demote catchswitch BBs only (for wasm EH)"), cl::init(false))
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "win-eh-prepare"

Definition at line 43 of file WinEHPrepare.cpp.

Function Documentation

◆ addClrEHHandler()

static int addClrEHHandler ( WinEHFuncInfo FuncInfo,
int  HandlerParentState,
int  TryParentState,
ClrHandlerType  HandlerType,
uint32_t  TypeToken,
const BasicBlock Handler 
)
static

Definition at line 636 of file WinEHPrepare.cpp.

References llvm::WinEHFuncInfo::ClrEHUnwindMap.

Referenced by llvm::calculateClrEHStateNumbers().

◆ addSEHExcept()

static int addSEHExcept ( WinEHFuncInfo FuncInfo,
int  ParentState,
const Function Filter,
const BasicBlock Handler 
)
static

Definition at line 472 of file WinEHPrepare.cpp.

References llvm::Filter, and llvm::WinEHFuncInfo::SEHUnwindMap.

Referenced by calculateSEHStateNumbers().

◆ addSEHFinally()

static int addSEHFinally ( WinEHFuncInfo FuncInfo,
int  ParentState,
const BasicBlock Handler 
)
static

Definition at line 483 of file WinEHPrepare.cpp.

References llvm::WinEHFuncInfo::SEHUnwindMap.

Referenced by calculateSEHStateNumbers().

◆ addTryBlockMapEntry()

static void addTryBlockMapEntry ( WinEHFuncInfo FuncInfo,
int  TryLow,
int  TryHigh,
int  CatchHigh,
ArrayRef< const CatchPadInst * >  Handlers 
)
static

◆ addUnwindMapEntry()

static int addUnwindMapEntry ( WinEHFuncInfo FuncInfo,
int  ToState,
const BasicBlock BB 
)
static

◆ calculateCXXStateNumbers()

static void calculateCXXStateNumbers ( WinEHFuncInfo FuncInfo,
const Instruction FirstNonPHI,
int  ParentState 
)
static

◆ calculateSEHStateNumbers()

static void calculateSEHStateNumbers ( WinEHFuncInfo FuncInfo,
const Instruction FirstNonPHI,
int  ParentState 
)
static

◆ calculateStateNumbersForInvokes()

static void calculateStateNumbersForInvokes ( const Function Fn,
WinEHFuncInfo FuncInfo 
)
static

◆ getCleanupRetUnwindDest()

static BasicBlock * getCleanupRetUnwindDest ( const CleanupPadInst CleanupPad)
static

◆ getEHPadFromPredecessor()

static const BasicBlock * getEHPadFromPredecessor ( const BasicBlock BB,
Value ParentPad 
)
static

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( WinEHPrepare  ,
DEBUG_TYPE  ,
"Prepare Windows exceptions"  ,
false  ,
false   
)

Definition at line 124 of file WinEHPrepare.cpp.

◆ isTopLevelPadForMSVC()

static bool isTopLevelPadForMSVC ( const Instruction EHPad)
static

Variable Documentation

◆ DemoteCatchSwitchPHIOnlyOpt

cl::opt< bool > DemoteCatchSwitchPHIOnlyOpt("demote-catchswitch-only", cl::Hidden, cl::desc("Demote catchswitch BBs only (for wasm EH)"), cl::init(false)) ( "demote-catchswitch-only"  ,
cl::Hidden  ,
cl::desc("Demote catchswitch BBs only (for wasm EH)")  ,
cl::init(false)   
)
static

◆ DisableCleanups

cl::opt< bool > DisableCleanups("disable-cleanups", cl::Hidden, cl::desc("Do not remove implausible terminators or other similar cleanups"), cl::init(false)) ( "disable-cleanups"  ,
cl::Hidden  ,
cl::desc("Do not remove implausible terminators or other similar cleanups")  ,
cl::init(false)   
)
static

◆ DisableDemotion

cl::opt< bool > DisableDemotion("disable-demotion", cl::Hidden, cl::desc( "Clone multicolor basic blocks but do not demote cross scopes"), cl::init(false)) ( "disable-demotion"  ,
cl::Hidden  ,
cl::desc( "Clone multicolor basic blocks but do not demote cross scopes")  ,
cl::init(false)   
)
static