[IR] Cleanup EH instructions a little bit

Just a cosmetic change, no functionality change is intended.

llvm-svn: 245818
This commit is contained in:
David Majnemer 2015-08-23 19:22:31 +00:00
parent f8e09c3bb6
commit b01aa9f794
3 changed files with 6 additions and 20 deletions

View File

@ -3574,9 +3574,9 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ResumeInst, Value)
//===----------------------------------------------------------------------===//
class CatchEndPadInst : public TerminatorInst {
private:
CatchEndPadInst(const CatchEndPadInst &RI);
private:
void init(BasicBlock *UnwindBB);
CatchEndPadInst(LLVMContext &C, BasicBlock *UnwindBB, unsigned Values,
Instruction *InsertBefore = nullptr);
@ -3630,7 +3630,6 @@ private:
unsigned getNumSuccessorsV() const override;
void setSuccessorV(unsigned Idx, BasicBlock *B) override;
private:
// Shadow Instruction::setInstructionSubclassData with a private forwarding
// method so that subclasses cannot accidentally use it.
void setInstructionSubclassData(unsigned short D) {
@ -3928,10 +3927,9 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CleanupPadInst, Value)
class CatchReturnInst : public TerminatorInst {
CatchReturnInst(const CatchReturnInst &RI);
private:
void init(CatchPadInst *CatchPad, BasicBlock *BB);
CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
Instruction *InsertBefore = nullptr);
Instruction *InsertBefore);
CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
BasicBlock *InsertAtEnd);
@ -3996,20 +3994,15 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CatchReturnInst, Value)
//===----------------------------------------------------------------------===//
class CleanupReturnInst : public TerminatorInst {
private:
CleanupReturnInst(const CleanupReturnInst &RI);
private:
void init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB);
CleanupReturnInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
unsigned Values, Instruction *InsertBefore = nullptr);
CleanupReturnInst(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB,
unsigned Values, BasicBlock *InsertAtEnd);
int getUnwindLabelOpIdx() const {
assert(hasUnwindDest());
return 0;
}
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;

View File

@ -3876,8 +3876,7 @@ std::error_code BitcodeReader::parseFunctionBody(Function *F) {
}
break;
}
// CLEANUPRET: [val] or [val,bb#]
case bitc::FUNC_CODE_INST_CLEANUPRET: {
case bitc::FUNC_CODE_INST_CLEANUPRET: { // CLEANUPRET: [val] or [val,bb#]
if (Record.size() != 1 && Record.size() != 2)
return error("Invalid record");
unsigned Idx = 0;

View File

@ -682,7 +682,6 @@ CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI)
OperandTraits<CleanupReturnInst>::op_end(this) -
CRI.getNumOperands(),
CRI.getNumOperands()) {
SubclassOptionalData = CRI.SubclassOptionalData;
setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
Op<-1>() = CRI.Op<-1>();
if (CRI.hasUnwindDest())
@ -690,7 +689,6 @@ CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI)
}
void CleanupReturnInst::init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB) {
SubclassOptionalData = 0;
if (UnwindBB)
setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
@ -740,14 +738,12 @@ CatchEndPadInst::CatchEndPadInst(const CatchEndPadInst &CRI)
OperandTraits<CatchEndPadInst>::op_end(this) -
CRI.getNumOperands(),
CRI.getNumOperands()) {
SubclassOptionalData = CRI.SubclassOptionalData;
setInstructionSubclassData(CRI.getSubclassDataFromInstruction());
if (BasicBlock *UnwindDest = CRI.getUnwindDest())
setUnwindDest(UnwindDest);
}
void CatchEndPadInst::init(BasicBlock *UnwindBB) {
SubclassOptionalData = 0;
if (UnwindBB) {
setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
setUnwindDest(UnwindBB);
@ -814,14 +810,14 @@ CatchReturnInst::CatchReturnInst(CatchPadInst *CatchPad, BasicBlock *BB,
}
BasicBlock *CatchReturnInst::getSuccessorV(unsigned Idx) const {
assert(Idx == 0);
assert(Idx < getNumSuccessors() && "Successor # out of range for catchret!");
return getSuccessor();
}
unsigned CatchReturnInst::getNumSuccessorsV() const {
return getNumSuccessors();
}
void CatchReturnInst::setSuccessorV(unsigned Idx, BasicBlock *B) {
assert(Idx == 0);
assert(Idx < getNumSuccessors() && "Successor # out of range for catchret!");
setSuccessor(B);
}
@ -879,7 +875,6 @@ void CatchPadInst::setSuccessorV(unsigned Idx, BasicBlock *B) {
// TerminatePadInst Implementation
//===----------------------------------------------------------------------===//
void TerminatePadInst::init(BasicBlock *BB, ArrayRef<Value *> Args) {
SubclassOptionalData = 0;
if (BB)
setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
if (BB)
@ -892,7 +887,6 @@ TerminatePadInst::TerminatePadInst(const TerminatePadInst &TPI)
OperandTraits<TerminatePadInst>::op_end(this) -
TPI.getNumOperands(),
TPI.getNumOperands()) {
SubclassOptionalData = TPI.SubclassOptionalData;
setInstructionSubclassData(TPI.getSubclassDataFromInstruction());
std::copy(TPI.op_begin(), TPI.op_end(), op_begin());
}