diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-04-03 23:37:34 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-04-03 23:37:34 +0000 |
commit | 7f5e7144062afcf7b984308f8c540ea22018e228 (patch) | |
tree | 1656f3858c1f652bf5a4586c95c7bda547db74c9 /llvm/lib/CodeGen | |
parent | a2404f898a56c12b1eac51d88725ff14855c66b6 (diff) | |
download | bcm5719-llvm-7f5e7144062afcf7b984308f8c540ea22018e228.tar.gz bcm5719-llvm-7f5e7144062afcf7b984308f8c540ea22018e228.zip |
[WinEH] Fill out CatchHigh in the TryBlockMap
Now all fields in the WinEH xdata have been filled out.
llvm-svn: 234067
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp index 676ce65dedb..3bfcaa96593 100644 --- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -421,11 +421,16 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) { 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.CatchHigh > TBME.TryHigh); + assert(CatchHigh > TBME.TryHigh); OS.EmitIntValue(TBME.TryLow, 4); // TryLow 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.EmitValue(createImageRel32(HandlerMapXData), 4); // HandlerArray } diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index bfaab9e6b6b..4547906c275 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -300,11 +300,7 @@ void WinEHNumbering::createTryBlockMapEntry(int TryLow, int TryHigh, WinEHTryBlockMapEntry TBME; TBME.TryLow = TryLow; 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.CatchHigh > TBME.TryHigh); for (CatchHandler *CH : Handlers) { WinEHHandlerType HT; if (CH->getSelector()->isNullValue()) { @@ -444,6 +440,8 @@ void WinEHNumbering::calculateStateNumbers(const Function &F) { ActionList.clear(); FuncInfo.LandingPadStateMap[LPI] = currentEHNumber(); } + + FuncInfo.CatchHandlerMaxState[&F] = NextState - 1; } /// clear - Clear out all the function-specific state. This returns this |