mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
[WinEH] Run cleanup handlers when an exception is thrown
Generate tables in the .xdata section representing what actions to take when an exception is thrown. This currently fills in state for cleanups, catch handlers are still unfinished. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233636 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -58,22 +58,25 @@ class MachineFunction;
|
||||
class Module;
|
||||
class PointerType;
|
||||
class StructType;
|
||||
struct WinEHFuncInfo;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// LandingPadInfo - This structure is used to retain landing pad info for
|
||||
/// the current function.
|
||||
///
|
||||
struct LandingPadInfo {
|
||||
MachineBasicBlock *LandingPadBlock; // Landing pad block.
|
||||
SmallVector<MCSymbol*, 1> BeginLabels; // Labels prior to invoke.
|
||||
SmallVector<MCSymbol*, 1> EndLabels; // Labels after invoke.
|
||||
SmallVector<MCSymbol*, 1> ClauseLabels; // Labels for each clause.
|
||||
MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
|
||||
const Function *Personality; // Personality function.
|
||||
std::vector<int> TypeIds; // List of type ids (filters negative)
|
||||
MachineBasicBlock *LandingPadBlock; // Landing pad block.
|
||||
SmallVector<MCSymbol *, 1> BeginLabels; // Labels prior to invoke.
|
||||
SmallVector<MCSymbol *, 1> EndLabels; // Labels after invoke.
|
||||
SmallVector<MCSymbol *, 1> ClauseLabels; // Labels for each clause.
|
||||
MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
|
||||
const Function *Personality; // Personality function.
|
||||
std::vector<int> TypeIds; // List of type ids (filters negative).
|
||||
int WinEHState; // WinEH specific state number.
|
||||
|
||||
explicit LandingPadInfo(MachineBasicBlock *MBB)
|
||||
: LandingPadBlock(MBB), LandingPadLabel(nullptr), Personality(nullptr) {}
|
||||
: LandingPadBlock(MBB), LandingPadLabel(nullptr), Personality(nullptr),
|
||||
WinEHState(-1) {}
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -172,6 +175,8 @@ class MachineModuleInfo : public ImmutablePass {
|
||||
|
||||
EHPersonality PersonalityTypeCache;
|
||||
|
||||
DenseMap<const Function *, std::unique_ptr<WinEHFuncInfo>> FuncInfoMap;
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
|
||||
@ -207,6 +212,12 @@ public:
|
||||
void setModule(const Module *M) { TheModule = M; }
|
||||
const Module *getModule() const { return TheModule; }
|
||||
|
||||
const Function *getWinEHParent(const Function *F) const;
|
||||
WinEHFuncInfo &getWinEHFuncInfo(const Function *F);
|
||||
bool hasWinEHFuncInfo(const Function *F) const {
|
||||
return FuncInfoMap.count(getWinEHParent(F)) > 0;
|
||||
}
|
||||
|
||||
/// getInfo - Keep track of various per-function pieces of information for
|
||||
/// backends that would like to do so.
|
||||
///
|
||||
@ -304,6 +315,8 @@ public:
|
||||
void addPersonality(MachineBasicBlock *LandingPad,
|
||||
const Function *Personality);
|
||||
|
||||
void addWinEHState(MachineBasicBlock *LandingPad, int State);
|
||||
|
||||
/// getPersonalityIndex - Get index of the current personality function inside
|
||||
/// Personalitites array
|
||||
unsigned getPersonalityIndex() const;
|
||||
|
Reference in New Issue
Block a user