diff options
author | Joseph Tremoulet <jotrem@microsoft.com> | 2015-08-23 00:26:33 +0000 |
---|---|---|
committer | Joseph Tremoulet <jotrem@microsoft.com> | 2015-08-23 00:26:33 +0000 |
commit | 8220bcc5700305452e823ad2d37d769f8f15a497 (patch) | |
tree | 3498781194fdabe5977d69f40bb8bb28514a6271 /llvm/lib/Bitcode/Writer | |
parent | 0732e16e690e251e92463d25b0de16c4a71a41b9 (diff) | |
download | bcm5719-llvm-8220bcc5700305452e823ad2d37d769f8f15a497.tar.gz bcm5719-llvm-8220bcc5700305452e823ad2d37d769f8f15a497.zip |
[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
llvm-svn: 245797
Diffstat (limited to 'llvm/lib/Bitcode/Writer')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 87b02e3dca4..c0eb5d497bc 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1855,10 +1855,7 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, case Instruction::CleanupRet: { Code = bitc::FUNC_CODE_INST_CLEANUPRET; const auto &CRI = cast<CleanupReturnInst>(I); - Vals.push_back(CRI.hasReturnValue()); - Vals.push_back(CRI.hasUnwindDest()); - if (CRI.hasReturnValue()) - PushValueAndType(CRI.getReturnValue(), InstID, Vals, VE); + pushValue(CRI.getCleanupPad(), InstID, Vals, VE); if (CRI.hasUnwindDest()) Vals.push_back(VE.getValueID(CRI.getUnwindDest())); break; @@ -1866,15 +1863,13 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, case Instruction::CatchRet: { Code = bitc::FUNC_CODE_INST_CATCHRET; const auto &CRI = cast<CatchReturnInst>(I); + pushValue(CRI.getCatchPad(), InstID, Vals, VE); Vals.push_back(VE.getValueID(CRI.getSuccessor())); - if (CRI.hasReturnValue()) - PushValueAndType(CRI.getReturnValue(), InstID, Vals, VE); break; } case Instruction::CatchPad: { Code = bitc::FUNC_CODE_INST_CATCHPAD; const auto &CPI = cast<CatchPadInst>(I); - Vals.push_back(VE.getTypeID(CPI.getType())); Vals.push_back(VE.getValueID(CPI.getNormalDest())); Vals.push_back(VE.getValueID(CPI.getUnwindDest())); unsigned NumArgOperands = CPI.getNumArgOperands(); @@ -1898,7 +1893,6 @@ static void WriteInstruction(const Instruction &I, unsigned InstID, case Instruction::CleanupPad: { Code = bitc::FUNC_CODE_INST_CLEANUPPAD; const auto &CPI = cast<CleanupPadInst>(I); - Vals.push_back(VE.getTypeID(CPI.getType())); unsigned NumOperands = CPI.getNumOperands(); Vals.push_back(NumOperands); for (unsigned Op = 0; Op != NumOperands; ++Op) |