diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2015-07-10 07:00:44 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2015-07-10 07:00:44 +0000 |
| commit | ae2ffc8a8c825acf46f58f20dc7d0ae5fecbdd0b (patch) | |
| tree | bba694cd7ab6a7a5eb4aca757ebfc3b38b1e949d /llvm/lib/IR/AsmWriter.cpp | |
| parent | 83505347724a3eeb42f66a0b58fb8ff5c4c9ea4c (diff) | |
| download | bcm5719-llvm-ae2ffc8a8c825acf46f58f20dc7d0ae5fecbdd0b.tar.gz bcm5719-llvm-ae2ffc8a8c825acf46f58f20dc7d0ae5fecbdd0b.zip | |
New EH representation for MSVC compatibility
Summary:
This introduces new instructions neccessary to implement MSVC-compatible
exception handling support. Most of the middle-end and none of the
back-end haven't been audited or updated to take them into account.
Reviewers: rnk, JosephTremoulet, reames, nlewycky, rjmccall
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11041
llvm-svn: 241888
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
| -rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index adc620db897..a866828c31b 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -2848,8 +2848,66 @@ void AssemblyWriter::printInstruction(const Instruction &I) { writeOperand(LPI->getClause(i), true); } + } else if (const auto *CBI = dyn_cast<CatchBlockInst>(&I)) { + Out << ' '; + TypePrinter.print(I.getType(), Out); + + Out << " ["; + for (unsigned Op = 0, NumOps = CBI->getNumArgOperands(); Op < NumOps; + ++Op) { + if (Op > 0) + Out << ", "; + writeOperand(CBI->getArgOperand(Op), /*PrintType=*/true); + } + Out << "] to "; + writeOperand(CBI->getNormalDest(), /*PrintType=*/true); + Out << " unwind "; + writeOperand(CBI->getUnwindDest(), /*PrintType=*/true); + } else if (const auto *TBI = dyn_cast<TerminateBlockInst>(&I)) { + Out << " ["; + for (unsigned Op = 0, NumOps = TBI->getNumArgOperands(); Op < NumOps; + ++Op) { + if (Op > 0) + Out << ", "; + writeOperand(TBI->getArgOperand(Op), /*PrintType=*/true); + } + Out << "] unwind "; + if (TBI->hasUnwindDest()) + writeOperand(TBI->getUnwindDest(), /*PrintType=*/true); + else + Out << "to caller"; + } else if (const auto *CBI = dyn_cast<CleanupBlockInst>(&I)) { + Out << ' '; + TypePrinter.print(I.getType(), Out); + + Out << " ["; + for (unsigned Op = 0, NumOps = CBI->getNumOperands(); Op < NumOps; ++Op) { + if (Op > 0) + Out << ", "; + writeOperand(CBI->getOperand(Op), /*PrintType=*/true); + } + Out << "]"; } else if (isa<ReturnInst>(I) && !Operand) { Out << " void"; + } else if (const auto *CRI = dyn_cast<CleanupReturnInst>(&I)) { + if (CRI->hasReturnValue()) { + Out << ' '; + writeOperand(CRI->getReturnValue(), /*PrintType=*/true); + } else { + Out << " void"; + } + + Out << " unwind "; + if (CRI->hasUnwindDest()) + writeOperand(CRI->getUnwindDest(), /*PrintType=*/true); + else + Out << "to caller"; + } else if (const auto *CEBI = dyn_cast<CatchEndBlockInst>(&I)) { + Out << " unwind "; + if (CEBI->hasUnwindDest()) + writeOperand(CEBI->getUnwindDest(), /*PrintType=*/true); + else + Out << "to caller"; } else if (const CallInst *CI = dyn_cast<CallInst>(&I)) { // Print the calling convention being used. if (CI->getCallingConv() != CallingConv::C) { |

