LLVM 20.0.0git
|
#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 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)) |
#define DEBUG_TYPE "win-eh-prepare" |
Definition at line 43 of file WinEHPrepare.cpp.
|
static |
Definition at line 636 of file WinEHPrepare.cpp.
References llvm::WinEHFuncInfo::ClrEHUnwindMap.
Referenced by llvm::calculateClrEHStateNumbers().
|
static |
Definition at line 472 of file WinEHPrepare.cpp.
References llvm::Filter, and llvm::WinEHFuncInfo::SEHUnwindMap.
Referenced by calculateSEHStateNumbers().
|
static |
Definition at line 483 of file WinEHPrepare.cpp.
References llvm::WinEHFuncInfo::SEHUnwindMap.
Referenced by calculateSEHStateNumbers().
|
static |
Definition at line 155 of file WinEHPrepare.cpp.
References llvm::WinEHHandlerType::Adjectives, llvm::WinEHHandlerType::Alloca, assert(), llvm::WinEHTryBlockMapEntry::CatchHigh, llvm::WinEHHandlerType::CatchObj, 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().
|
static |
Definition at line 146 of file WinEHPrepare.cpp.
References llvm::CxxUnwindMapEntry::Cleanup, llvm::WinEHFuncInfo::CxxUnwindMap, llvm::WinEHFuncInfo::getLastStateNumber(), and llvm::CxxUnwindMapEntry::ToState.
Referenced by calculateCXXStateNumbers().
|
static |
Definition at line 376 of file WinEHPrepare.cpp.
References addTryBlockMapEntry(), addUnwindMapEntry(), assert(), calculateCXXStateNumbers(), llvm::dbgs(), llvm::WinEHFuncInfo::EHPadStateMap, llvm::WinEHFuncInfo::FuncletBaseStateMap, getCleanupRetUnwindDest(), getEHPadFromPredecessor(), llvm::WinEHFuncInfo::getLastStateNumber(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getParent(), llvm::Triple::isArch64Bit(), llvm::BasicBlock::isEHPad(), LLVM_DEBUG, llvm::Mod, llvm::predecessors(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::report_fatal_error(), and llvm::WinEHFuncInfo::TryBlockMap.
Referenced by calculateCXXStateNumbers(), and llvm::calculateWinCXXEHStateNumbers().
|
static |
Definition at line 497 of file WinEHPrepare.cpp.
References addSEHExcept(), addSEHFinally(), assert(), llvm::calculateSEHStateNumbers(), llvm::dbgs(), llvm::WinEHFuncInfo::EHPadStateMap, llvm::Filter, getCleanupRetUnwindDest(), getEHPadFromPredecessor(), llvm::Value::getName(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getParent(), llvm::BasicBlock::isEHPad(), llvm::Constant::isNullValue(), LLVM_DEBUG, llvm::predecessors(), and llvm::report_fatal_error().
|
static |
Definition at line 189 of file WinEHPrepare.cpp.
References assert(), llvm::colorEHFunclets(), llvm::WinEHFuncInfo::EHPadStateMap, F, llvm::BasicBlock::front(), llvm::WinEHFuncInfo::FuncletBaseStateMap, getCleanupRetUnwindDest(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHI(), II, llvm::WinEHFuncInfo::InvokeStateMap, and llvm_unreachable.
Referenced by llvm::calculateClrEHStateNumbers(), llvm::calculateSEHStateNumbers(), and llvm::calculateWinCXXEHStateNumbers().
|
static |
Definition at line 182 of file WinEHPrepare.cpp.
References llvm::Value::users().
Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), calculateStateNumbersForInvokes(), and isTopLevelPadForMSVC().
|
static |
Definition at line 356 of file WinEHPrepare.cpp.
References assert(), llvm::BasicBlock::getTerminator(), and llvm::Instruction::isEHPad().
Referenced by calculateCXXStateNumbers(), and calculateSEHStateNumbers().
INITIALIZE_PASS | ( | WinEHPrepare | , |
DEBUG_TYPE | , | ||
"Prepare Windows exceptions" | , | ||
false | , | ||
false | |||
) |
Definition at line 124 of file WinEHPrepare.cpp.
|
static |
Definition at line 576 of file WinEHPrepare.cpp.
References getCleanupRetUnwindDest(), and llvm_unreachable.
Referenced by llvm::calculateSEHStateNumbers(), and llvm::calculateWinCXXEHStateNumbers().
|
static |
|
static |