diff options
| author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-09-03 09:09:43 +0000 |
|---|---|---|
| committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-09-03 09:09:43 +0000 |
| commit | 9ce71f76b9497d3b50bc267b2ba9a92de48f13e2 (patch) | |
| tree | 7323a60f5c30c9b8e7ffde38dfb29d19b0de19c5 /llvm/lib/AsmParser/LLParser.cpp | |
| parent | 0dcd8bcf2407caa5c6a9705c8b7d0cdda4824dba (diff) | |
| download | bcm5719-llvm-9ce71f76b9497d3b50bc267b2ba9a92de48f13e2.tar.gz bcm5719-llvm-9ce71f76b9497d3b50bc267b2ba9a92de48f13e2.zip | |
[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
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index c8390d44cca..df34ba8697f 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -4686,6 +4686,7 @@ int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB, case lltok::kw_terminatepad: return ParseTerminatePad(Inst, PFS); case lltok::kw_cleanuppad: return ParseCleanupPad(Inst, PFS); case lltok::kw_catchendpad: return ParseCatchEndPad(Inst, PFS); + case lltok::kw_cleanupendpad: return ParseCleanupEndPad(Inst, PFS); // Binary Operators. case lltok::kw_add: case lltok::kw_sub: @@ -5243,6 +5244,35 @@ bool LLParser::ParseCatchEndPad(Instruction *&Inst, PerFunctionState &PFS) { return false; } +/// ParseCatchEndPad +/// ::= 'cleanupendpad' Value unwind ('to' 'caller' | TypeAndValue) +bool LLParser::ParseCleanupEndPad(Instruction *&Inst, PerFunctionState &PFS) { + Value *CleanupPad = nullptr; + + if (ParseValue(Type::getTokenTy(Context), CleanupPad, PFS, OC_CleanupPad)) + return true; + + if (ParseToken(lltok::kw_unwind, "expected 'unwind' in catchendpad")) + return true; + + BasicBlock *UnwindBB = nullptr; + if (Lex.getKind() == lltok::kw_to) { + Lex.Lex(); + if (Lex.getKind() == lltok::kw_caller) { + Lex.Lex(); + } else { + return true; + } + } else { + if (ParseTypeAndBasicBlock(UnwindBB, PFS)) { + return true; + } + } + + Inst = CleanupEndPadInst::Create(cast<CleanupPadInst>(CleanupPad), UnwindBB); + return false; +} + //===----------------------------------------------------------------------===// // Binary Operators. //===----------------------------------------------------------------------===// |

