[WinEH] Add cleanupendpad instruction

Summary:
Add a `cleanupendpad` instruction, used to mark exceptional exits out of
cleanups (for languages/targets that can abort a cleanup with another
exception).  The `cleanupendpad` instruction is similar to the `catchendpad`
instruction in that it is an EH pad which is the target of unwind edges in
the handler and which itself has an unwind edge to the next EH action.
The `cleanupendpad` instruction, similar to `cleanupret` has a `cleanuppad`
argument indicating which cleanup it exits.  The unwind successors of a
`cleanuppad`'s `cleanupendpad`s must agree with each other and with its
`cleanupret`s.

Update WinEHPrepare (and docs/tests) to accomodate `cleanupendpad`.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

llvm-svn: 246751
This commit is contained in:
Joseph Tremoulet
2015-09-03 09:09:43 +00:00
parent 0dcd8bcf24
commit 9ce71f76b9
31 changed files with 635 additions and 135 deletions

View File

@@ -1906,6 +1906,14 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Vals.push_back(VE.getValueID(CEPI.getUnwindDest()));
break;
}
case Instruction::CleanupEndPad: {
Code = bitc::FUNC_CODE_INST_CLEANUPENDPAD;
const auto &CEPI = cast<CleanupEndPadInst>(I);
pushValue(CEPI.getCleanupPad(), InstID, Vals, VE);
if (CEPI.hasUnwindDest())
Vals.push_back(VE.getValueID(CEPI.getUnwindDest()));
break;
}
case Instruction::Unreachable:
Code = bitc::FUNC_CODE_INST_UNREACHABLE;
AbbrevToUse = FUNCTION_INST_UNREACHABLE_ABBREV;