LLVM: lib/CodeGen/WinEHPrepare.cpp File Reference (original) (raw)

Go to the source code of this file.

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 BasicBlock * getCleanupRetUnwindDest (const CleanupPadInst *CleanupPad)
static void calculateStateNumbersForInvokes (const Function *Fn, WinEHFuncInfo &FuncInfo)
static const BasicBlock * getEHPadFromPredecessor (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< bool > DisableDemotion ("disable-demotion", cl::Hidden, cl::desc("Clone multicolor basic blocks but do not demote cross scopes"), cl::init(false))
static cl::opt< bool > DisableCleanups ("disable-cleanups", cl::Hidden, cl::desc("Do not remove implausible terminators or other similar cleanups"), cl::init(false))
static cl::opt< bool > DemoteCatchSwitchPHIOnlyOpt ("demote-catchswitch-only", cl::Hidden, cl::desc("Demote catchswitch BBs only (for wasm EH)"), cl::init(false))

DEBUG_TYPE

#define DEBUG_TYPE "win-eh-prepare"

addClrEHHandler()

addSEHExcept()

addSEHFinally()

addTryBlockMapEntry()

Definition at line 155 of file WinEHPrepare.cpp.

References llvm::WinEHHandlerType::Adjectives, llvm::WinEHHandlerType::Alloca, assert(), llvm::cast(), llvm::WinEHTryBlockMapEntry::CatchHigh, llvm::WinEHHandlerType::CatchObj, llvm::dyn_cast(), llvm::WinEHHandlerType::Handler, llvm::WinEHTryBlockMapEntry::HandlerArray, llvm::Constant::isNullValue(), llvm::Constant::stripPointerCasts(), llvm::WinEHFuncInfo::TryBlockMap, llvm::WinEHTryBlockMapEntry::TryHigh, llvm::WinEHTryBlockMapEntry::TryLow, and llvm::WinEHHandlerType::TypeDescriptor.

Referenced by calculateCXXStateNumbers().

addUnwindMapEntry()

calculateCXXStateNumbers()

Definition at line 378 of file WinEHPrepare.cpp.

References addTryBlockMapEntry(), addUnwindMapEntry(), assert(), calculateCXXStateNumbers(), llvm::cast(), llvm::dbgs(), llvm::dyn_cast(), llvm::WinEHFuncInfo::EHPadStateMap, llvm::WinEHFuncInfo::FuncletBaseStateMap, getCleanupRetUnwindDest(), getEHPadFromPredecessor(), llvm::WinEHFuncInfo::getLastStateNumber(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::isEHPad(), LLVM_DEBUG, Mod, llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::report_fatal_error(), llvm::WinEHFuncInfo::TryBlockMap, and llvm::Value::users().

Referenced by calculateCXXStateNumbers(), and llvm::calculateWinCXXEHStateNumbers().

calculateSEHStateNumbers()

Definition at line 500 of file WinEHPrepare.cpp.

References addSEHExcept(), addSEHFinally(), assert(), llvm::calculateSEHStateNumbers(), llvm::cast(), llvm::dbgs(), llvm::dyn_cast(), llvm::WinEHFuncInfo::EHPadStateMap, llvm::Filter, getCleanupRetUnwindDest(), getEHPadFromPredecessor(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::isEHPad(), llvm::Constant::isNullValue(), LLVM_DEBUG, llvm::predecessors(), llvm::report_fatal_error(), and llvm::Value::users().

calculateStateNumbersForInvokes()

Definition at line 189 of file WinEHPrepare.cpp.

References assert(), llvm::colorEHFunclets(), llvm::dyn_cast(), llvm::WinEHFuncInfo::EHPadStateMap, F, llvm::BasicBlock::front(), llvm::WinEHFuncInfo::FuncletBaseStateMap, getCleanupRetUnwindDest(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHIIt(), II, llvm::WinEHFuncInfo::InvokeStateMap, and llvm_unreachable.

Referenced by llvm::calculateClrEHStateNumbers(), llvm::calculateSEHStateNumbers(), and llvm::calculateWinCXXEHStateNumbers().

getCleanupRetUnwindDest()

getEHPadFromPredecessor()

INITIALIZE_PASS()

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

isTopLevelPadForMSVC()

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