mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 20:29:30 +00:00
[WinEHPrepare] Don't rely on the order of IR
The IPToState table must be emitted after we have generated labels for all functions in the table. Don't rely on the order of the list of globals. Instead, utilize WinEHFuncInfo to tell us how many catch handlers we expect to outline. Once we know we've visited all the catch handlers, emit the cppxdata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234566 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
36f934a207
commit
d480d308b0
@ -142,7 +142,11 @@ struct WinEHFuncInfo {
|
||||
int UnwindHelpFrameIdx;
|
||||
int UnwindHelpFrameOffset;
|
||||
|
||||
WinEHFuncInfo() : UnwindHelpFrameIdx(INT_MAX), UnwindHelpFrameOffset(-1) {}
|
||||
unsigned NumIPToStateFuncsVisited;
|
||||
|
||||
WinEHFuncInfo()
|
||||
: UnwindHelpFrameIdx(INT_MAX), UnwindHelpFrameOffset(-1),
|
||||
NumIPToStateFuncsVisited(0) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -343,7 +343,11 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ParentF != F)
|
||||
// Defer emission until we've visited the parent function and all the catch
|
||||
// handlers.
|
||||
if (ParentF == F || FuncInfo.CatchHandlerMaxState.count(F))
|
||||
++FuncInfo.NumIPToStateFuncsVisited;
|
||||
if (FuncInfo.NumIPToStateFuncsVisited != FuncInfo.CatchHandlerMaxState.size())
|
||||
return;
|
||||
|
||||
MCSymbol *UnwindMapXData = nullptr;
|
||||
|
@ -275,11 +275,15 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf,
|
||||
MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad();
|
||||
|
||||
// Calculate EH numbers for WinEH.
|
||||
if (fn.getFnAttribute("wineh-parent").getValueAsString() == fn.getName()) {
|
||||
WinEHNumbering Num(MMI.getWinEHFuncInfo(&fn));
|
||||
Num.calculateStateNumbers(fn);
|
||||
// Pop everything on the handler stack.
|
||||
Num.processCallSite(None, ImmutableCallSite());
|
||||
if (fn.hasFnAttribute("wineh-parent")) {
|
||||
const Function *WinEHParentFn = MMI.getWinEHParent(&fn);
|
||||
WinEHFuncInfo &FI = MMI.getWinEHFuncInfo(WinEHParentFn);
|
||||
if (FI.LandingPadStateMap.empty()) {
|
||||
WinEHNumbering Num(FI);
|
||||
Num.calculateStateNumbers(*WinEHParentFn);
|
||||
// Pop everything on the handler stack.
|
||||
Num.processCallSite(None, ImmutableCallSite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user