mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 22:24:28 +00:00
[WinEH] Fill out CatchHigh in the TryBlockMap
Now all fields in the WinEH xdata have been filled out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234067 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -128,7 +128,6 @@ struct WinEHHandlerType {
|
|||||||
struct WinEHTryBlockMapEntry {
|
struct WinEHTryBlockMapEntry {
|
||||||
int TryLow;
|
int TryLow;
|
||||||
int TryHigh;
|
int TryHigh;
|
||||||
int CatchHigh;
|
|
||||||
SmallVector<WinEHHandlerType, 1> HandlerArray;
|
SmallVector<WinEHHandlerType, 1> HandlerArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -136,6 +135,7 @@ struct WinEHFuncInfo {
|
|||||||
DenseMap<const LandingPadInst *, int> LandingPadStateMap;
|
DenseMap<const LandingPadInst *, int> LandingPadStateMap;
|
||||||
DenseMap<const Function *, int> CatchHandlerParentFrameObjIdx;
|
DenseMap<const Function *, int> CatchHandlerParentFrameObjIdx;
|
||||||
DenseMap<const Function *, int> CatchHandlerParentFrameObjOffset;
|
DenseMap<const Function *, int> CatchHandlerParentFrameObjOffset;
|
||||||
|
DenseMap<const Function *, int> CatchHandlerMaxState;
|
||||||
SmallVector<WinEHUnwindMapEntry, 4> UnwindMap;
|
SmallVector<WinEHUnwindMapEntry, 4> UnwindMap;
|
||||||
SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap;
|
SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap;
|
||||||
SmallVector<std::pair<MCSymbol *, int>, 4> IPToStateList;
|
SmallVector<std::pair<MCSymbol *, int>, 4> IPToStateList;
|
||||||
|
@ -421,11 +421,16 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
|
|||||||
|
|
||||||
HandlerMaps.push_back(HandlerMapXData);
|
HandlerMaps.push_back(HandlerMapXData);
|
||||||
|
|
||||||
|
int CatchHigh = -1;
|
||||||
|
for (WinEHHandlerType &HT : TBME.HandlerArray)
|
||||||
|
CatchHigh =
|
||||||
|
std::max(CatchHigh, FuncInfo.CatchHandlerMaxState[HT.Handler]);
|
||||||
|
|
||||||
assert(TBME.TryLow <= TBME.TryHigh);
|
assert(TBME.TryLow <= TBME.TryHigh);
|
||||||
assert(TBME.CatchHigh > TBME.TryHigh);
|
assert(CatchHigh > TBME.TryHigh);
|
||||||
OS.EmitIntValue(TBME.TryLow, 4); // TryLow
|
OS.EmitIntValue(TBME.TryLow, 4); // TryLow
|
||||||
OS.EmitIntValue(TBME.TryHigh, 4); // TryHigh
|
OS.EmitIntValue(TBME.TryHigh, 4); // TryHigh
|
||||||
OS.EmitIntValue(TBME.CatchHigh, 4); // CatchHigh
|
OS.EmitIntValue(CatchHigh, 4); // CatchHigh
|
||||||
OS.EmitIntValue(TBME.HandlerArray.size(), 4); // NumCatches
|
OS.EmitIntValue(TBME.HandlerArray.size(), 4); // NumCatches
|
||||||
OS.EmitValue(createImageRel32(HandlerMapXData), 4); // HandlerArray
|
OS.EmitValue(createImageRel32(HandlerMapXData), 4); // HandlerArray
|
||||||
}
|
}
|
||||||
|
@ -300,11 +300,7 @@ void WinEHNumbering::createTryBlockMapEntry(int TryLow, int TryHigh,
|
|||||||
WinEHTryBlockMapEntry TBME;
|
WinEHTryBlockMapEntry TBME;
|
||||||
TBME.TryLow = TryLow;
|
TBME.TryLow = TryLow;
|
||||||
TBME.TryHigh = TryHigh;
|
TBME.TryHigh = TryHigh;
|
||||||
// FIXME: This should be revisited when we want to throw inside a catch
|
|
||||||
// handler.
|
|
||||||
TBME.CatchHigh = INT_MAX;
|
|
||||||
assert(TBME.TryLow <= TBME.TryHigh);
|
assert(TBME.TryLow <= TBME.TryHigh);
|
||||||
assert(TBME.CatchHigh > TBME.TryHigh);
|
|
||||||
for (CatchHandler *CH : Handlers) {
|
for (CatchHandler *CH : Handlers) {
|
||||||
WinEHHandlerType HT;
|
WinEHHandlerType HT;
|
||||||
if (CH->getSelector()->isNullValue()) {
|
if (CH->getSelector()->isNullValue()) {
|
||||||
@ -444,6 +440,8 @@ void WinEHNumbering::calculateStateNumbers(const Function &F) {
|
|||||||
ActionList.clear();
|
ActionList.clear();
|
||||||
FuncInfo.LandingPadStateMap[LPI] = currentEHNumber();
|
FuncInfo.LandingPadStateMap[LPI] = currentEHNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FuncInfo.CatchHandlerMaxState[&F] = NextState - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// clear - Clear out all the function-specific state. This returns this
|
/// clear - Clear out all the function-specific state. This returns this
|
||||||
|
@ -137,12 +137,12 @@ try.cont8: ; preds = %lpad2, %try.cont
|
|||||||
; CHECK-NEXT:"$tryMap$?f@@YAXXZ":
|
; CHECK-NEXT:"$tryMap$?f@@YAXXZ":
|
||||||
; CHECK-NEXT: .long 1
|
; CHECK-NEXT: .long 1
|
||||||
; CHECK-NEXT: .long 1
|
; CHECK-NEXT: .long 1
|
||||||
; CHECK-NEXT: .long 2147483647
|
; CHECK-NEXT: .long 2
|
||||||
; CHECK-NEXT: .long 1
|
; CHECK-NEXT: .long 1
|
||||||
; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")@IMGREL
|
; CHECK-NEXT: .long ("$handlerMap$0$?f@@YAXXZ")@IMGREL
|
||||||
; CHECK-NEXT: .long 0
|
; CHECK-NEXT: .long 0
|
||||||
; CHECK-NEXT: .long 2
|
; CHECK-NEXT: .long 2
|
||||||
; CHECK-NEXT: .long 2147483647
|
; CHECK-NEXT: .long 3
|
||||||
; CHECK-NEXT: .long 1
|
; CHECK-NEXT: .long 1
|
||||||
; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")@IMGREL
|
; CHECK-NEXT: .long ("$handlerMap$1$?f@@YAXXZ")@IMGREL
|
||||||
; CHECK-NEXT:"$handlerMap$0$?f@@YAXXZ":
|
; CHECK-NEXT:"$handlerMap$0$?f@@YAXXZ":
|
||||||
|
Reference in New Issue
Block a user