[llvm] r245818 - [IR] Cleanup EH instructions a little bit
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 23 12:22:31 PDT 2015
Author: majnemer
Date: Sun Aug 23 14:22:31 2015
New Revision: 245818
URL: http://llvm.org/viewvc/llvm-project?rev=245818&view=rev
Log:
[IR] Cleanup EH instructions a little bit
Just a cosmetic change, no functionality change is intended.
Modified:
llvm/trunk/include/llvm/IR/Instructions.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/IR/Instructions.cpp
Modified: llvm/trunk/include/llvm/IR/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Instructions.h?rev=245818&r1=245817&r2=245818&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Instructions.h (original)
+++ llvm/trunk/include/llvm/IR/Instructions.h Sun Aug 23 14:22:31 2015
@@ -3574,9 +3574,9 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(Res
//===----------------------------------------------------------------------===//
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(Cle
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(Cat
//===----------------------------------------------------------------------===//
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;
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=245818&r1=245817&r2=245818&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Aug 23 14:22:31 2015
@@ -3876,8 +3876,7 @@ std::error_code BitcodeReader::parseFunc
}
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;
Modified: llvm/trunk/lib/IR/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=245818&r1=245817&r2=245818&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instructions.cpp (original)
+++ llvm/trunk/lib/IR/Instructions.cpp Sun Aug 23 14:22:31 2015
@@ -682,7 +682,6 @@ CleanupReturnInst::CleanupReturnInst(con
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(con
}
void CleanupReturnInst::init(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB) {
- SubclassOptionalData = 0;
if (UnwindBB)
setInstructionSubclassData(getSubclassDataFromInstruction() | 1);
@@ -740,14 +738,12 @@ CatchEndPadInst::CatchEndPadInst(const C
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(CatchPa
}
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(unsigne
// 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
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());
}
More information about the llvm-commits
mailing list