[WinEH] Require token linkage in EH pad/ret signatures
authorJoseph Tremoulet <jotrem@microsoft.com>
Sun, 23 Aug 2015 00:26:33 +0000 (00:26 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Sun, 23 Aug 2015 00:26:33 +0000 (00:26 +0000)
commitd4a765f88a484e8d91af957bc2c63fe35395f5ac
tree584bd8dd8689a71548ad5c9127898691a22a346a
parent8647351e06ac5e6f2be850210b47c017fd2e54a0
[WinEH] Require token linkage in EH pad/ret signatures

Summary:
WinEHPrepare is going to require that cleanuppad and catchpad produce values
of token type which are consumed by any cleanupret or catchret exiting the
pad.  This change updates the signatures of those operators to require/enforce
that the type produced by the pads is token type and that the rets have an
appropriate argument.

The catchpad argument of a `CatchReturnInst` must be a `CatchPadInst` (and
similarly for `CleanupReturnInst`/`CleanupPadInst`).  To accommodate that
restriction, this change adds a notion of an operator constraint to both
LLParser and BitcodeReader, allowing appropriate sentinels to be constructed
for forward references and appropriate error messages to be emitted for
illegal inputs.

Also add a verifier rule (noted in LangRef) that a catchpad with a catchpad
predecessor must have no other predecessors; this ensures that WinEHPrepare
will see the expected linear relationship between sibling catches on the
same try.

Lastly, remove some superfluous/vestigial casts from instruction operand
setters operating on BasicBlocks.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245797 91177308-0d34-0410-b5e6-96231b3b80d8
21 files changed:
docs/ExceptionHandling.rst
docs/LangRef.rst
include/llvm/Bitcode/LLVMBitCodes.h
include/llvm/IR/IRBuilder.h
include/llvm/IR/Instructions.h
lib/Analysis/InlineCost.cpp
lib/AsmParser/LLParser.cpp
lib/AsmParser/LLParser.h
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/CodeGen/WinEHPrepare.cpp
lib/IR/AsmWriter.cpp
lib/IR/Instruction.cpp
lib/IR/Instructions.cpp
lib/IR/Verifier.cpp
lib/Transforms/Instrumentation/MemorySanitizer.cpp
lib/Transforms/Utils/InlineFunction.cpp
test/Assembler/invalid-OperatorConstraint.ll [new file with mode: 0644]
test/CodeGen/WinEH/wineh-demotion.ll
test/CodeGen/WinEH/wineh-statenumbering.ll
test/Feature/exception.ll