[WinEH] Update exception numbering to give handlers their own base state.

Differential Revision: http://reviews.llvm.org/D9512



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237014 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Kaylor
2015-05-11 19:41:19 +00:00
parent da4dc2dadc
commit aeeca679f7
7 changed files with 388 additions and 19 deletions

View File

@@ -299,6 +299,17 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
// The parent function and the catch handlers contribute to the 'ip2state'
// table.
// Include ip2state entries for the beginning of the main function and
// for catch handler functions.
if (F == ParentF) {
FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel, -1));
LastEHState = -1;
} else if (FuncInfo.HandlerBaseState.count(F)) {
FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel,
FuncInfo.HandlerBaseState[F]));
LastEHState = FuncInfo.HandlerBaseState[F];
}
for (const auto &MBB : *MF) {
for (const auto &MI : MBB) {
if (!MI.isEHLabel()) {
@@ -323,7 +334,8 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) {
assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] &&
"Inconsistent landing pad map!");
if (SawPotentiallyThrowing) {
// FIXME: Should this be using FuncInfo.HandlerBaseState?
if (SawPotentiallyThrowing && LastEHState != -1) {
FuncInfo.IPToStateList.push_back(std::make_pair(LastLabel, -1));
SawPotentiallyThrowing = false;
LastEHState = -1;