mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-08 18:30:26 +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:
@@ -14,6 +14,7 @@
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/WinEHFuncInfo.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/GlobalVariable.h"
|
||||
@@ -425,6 +426,12 @@ void MachineModuleInfo::addPersonality(MachineBasicBlock *LandingPad,
|
||||
Personalities.push_back(Personality);
|
||||
}
|
||||
|
||||
void MachineModuleInfo::addWinEHState(MachineBasicBlock *LandingPad,
|
||||
int State) {
|
||||
LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
|
||||
LP.WinEHState = State;
|
||||
}
|
||||
|
||||
/// addCatchTypeInfo - Provide the catch typeinfo for a landing pad.
|
||||
///
|
||||
void MachineModuleInfo::
|
||||
@@ -588,3 +595,18 @@ unsigned MachineModuleInfo::getPersonalityIndex() const {
|
||||
// in the zero index.
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Function *MachineModuleInfo::getWinEHParent(const Function *F) const {
|
||||
StringRef WinEHParentName =
|
||||
F->getFnAttribute("wineh-parent").getValueAsString();
|
||||
if (WinEHParentName.empty() || WinEHParentName == F->getName())
|
||||
return F;
|
||||
return F->getParent()->getFunction(WinEHParentName);
|
||||
}
|
||||
|
||||
WinEHFuncInfo &MachineModuleInfo::getWinEHFuncInfo(const Function *F) {
|
||||
auto &Ptr = FuncInfoMap[getWinEHParent(F)];
|
||||
if (!Ptr)
|
||||
Ptr.reset(new WinEHFuncInfo);
|
||||
return *Ptr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user