diff options
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 321 |
1 files changed, 0 insertions, 321 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 02cb1205da9..86c921aeda8 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -671,303 +671,6 @@ BasicBlock *ResumeInst::getSuccessorV(unsigned idx) const { } //===----------------------------------------------------------------------===// -// CleanupReturnInst Implementation -//===----------------------------------------------------------------------===// - -CleanupReturnInst::CleanupReturnInst(const CleanupReturnInst &CRI) - : TerminatorInst(CRI.getType(), Instruction::CleanupRet, - OperandTraits<CleanupReturnInst>::op_end(this) - - CRI.getNumOperands(), - CRI.getNumOperands()) { - SubclassOptionalData = CRI.SubclassOptionalData; - if (Value *RetVal = CRI.getReturnValue()) - setReturnValue(RetVal); - if (BasicBlock *UnwindDest = CRI.getUnwindDest()) - setUnwindDest(UnwindDest); -} - -void CleanupReturnInst::init(Value *RetVal, BasicBlock *UnwindBB) { - SubclassOptionalData = 0; - if (UnwindBB) - setInstructionSubclassData(getSubclassDataFromInstruction() | 1); - if (RetVal) - setInstructionSubclassData(getSubclassDataFromInstruction() | 2); - - if (UnwindBB) - setUnwindDest(UnwindBB); - if (RetVal) - setReturnValue(RetVal); -} - -CleanupReturnInst::CleanupReturnInst(LLVMContext &C, Value *RetVal, - BasicBlock *UnwindBB, unsigned Values, - Instruction *InsertBefore) - : TerminatorInst(Type::getVoidTy(C), Instruction::CleanupRet, - OperandTraits<CleanupReturnInst>::op_end(this) - Values, - Values, InsertBefore) { - init(RetVal, UnwindBB); -} - -CleanupReturnInst::CleanupReturnInst(LLVMContext &C, Value *RetVal, - BasicBlock *UnwindBB, unsigned Values, - BasicBlock *InsertAtEnd) - : TerminatorInst(Type::getVoidTy(C), Instruction::CleanupRet, - OperandTraits<CleanupReturnInst>::op_end(this) - Values, - Values, InsertAtEnd) { - init(RetVal, UnwindBB); -} - -BasicBlock *CleanupReturnInst::getUnwindDest() const { - if (hasUnwindDest()) - return cast<BasicBlock>(getOperand(getUnwindLabelOpIdx())); - return nullptr; -} -void CleanupReturnInst::setUnwindDest(BasicBlock *NewDest) { - assert(NewDest); - setOperand(getUnwindLabelOpIdx(), NewDest); -} - -BasicBlock *CleanupReturnInst::getSuccessorV(unsigned Idx) const { - assert(Idx == 0); - return getUnwindDest(); -} -unsigned CleanupReturnInst::getNumSuccessorsV() const { - return getNumSuccessors(); -} -void CleanupReturnInst::setSuccessorV(unsigned Idx, BasicBlock *B) { - assert(Idx == 0); - setUnwindDest(B); -} - -//===----------------------------------------------------------------------===// -// CatchEndBlockInst Implementation -//===----------------------------------------------------------------------===// - -CatchEndBlockInst::CatchEndBlockInst(const CatchEndBlockInst &CRI) - : TerminatorInst(CRI.getType(), Instruction::CatchEndBlock, - OperandTraits<CatchEndBlockInst>::op_end(this) - - CRI.getNumOperands(), - CRI.getNumOperands()) { - SubclassOptionalData = CRI.SubclassOptionalData; - if (BasicBlock *UnwindDest = CRI.getUnwindDest()) - setUnwindDest(UnwindDest); -} - -void CatchEndBlockInst::init(BasicBlock *UnwindBB) { - SubclassOptionalData = 0; - if (UnwindBB) { - setInstructionSubclassData(getSubclassDataFromInstruction() | 1); - setUnwindDest(UnwindBB); - } -} - -CatchEndBlockInst::CatchEndBlockInst(LLVMContext &C, BasicBlock *UnwindBB, - unsigned Values, Instruction *InsertBefore) - : TerminatorInst(Type::getVoidTy(C), Instruction::CatchEndBlock, - OperandTraits<CatchEndBlockInst>::op_end(this) - Values, - Values, InsertBefore) { - init(UnwindBB); -} - -CatchEndBlockInst::CatchEndBlockInst(LLVMContext &C, BasicBlock *UnwindBB, - unsigned Values, BasicBlock *InsertAtEnd) - : TerminatorInst(Type::getVoidTy(C), Instruction::CatchEndBlock, - OperandTraits<CatchEndBlockInst>::op_end(this) - Values, - Values, InsertAtEnd) { - init(UnwindBB); -} - -BasicBlock *CatchEndBlockInst::getSuccessorV(unsigned Idx) const { - assert(Idx == 0); - return getUnwindDest(); -} -unsigned CatchEndBlockInst::getNumSuccessorsV() const { - return getNumSuccessors(); -} -void CatchEndBlockInst::setSuccessorV(unsigned Idx, BasicBlock *B) { - assert(Idx == 0); - setUnwindDest(B); -} - -//===----------------------------------------------------------------------===// -// CatchReturnInst Implementation -//===----------------------------------------------------------------------===// - -CatchReturnInst::CatchReturnInst(const CatchReturnInst &CRI) - : TerminatorInst(Type::getVoidTy(CRI.getContext()), Instruction::CatchRet, - OperandTraits<CatchReturnInst>::op_end(this) - - CRI.getNumOperands(), - CRI.getNumOperands()) { - Op<0>() = CRI.Op<0>(); -} - -CatchReturnInst::CatchReturnInst(BasicBlock *BB, Instruction *InsertBefore) - : TerminatorInst(Type::getVoidTy(BB->getContext()), Instruction::CatchRet, - OperandTraits<CatchReturnInst>::op_begin(this), 1, - InsertBefore) { - Op<0>() = BB; -} - -CatchReturnInst::CatchReturnInst(BasicBlock *BB, BasicBlock *InsertAtEnd) - : TerminatorInst(Type::getVoidTy(BB->getContext()), Instruction::CatchRet, - OperandTraits<CatchReturnInst>::op_begin(this), 1, - InsertAtEnd) { - Op<0>() = BB; -} - -BasicBlock *CatchReturnInst::getSuccessorV(unsigned Idx) const { - assert(Idx == 0); - return getSuccessor(); -} -unsigned CatchReturnInst::getNumSuccessorsV() const { - return getNumSuccessors(); -} -void CatchReturnInst::setSuccessorV(unsigned Idx, BasicBlock *B) { - assert(Idx == 0); - setSuccessor(B); -} - -//===----------------------------------------------------------------------===// -// CatchBlockInst Implementation -//===----------------------------------------------------------------------===// -void CatchBlockInst::init(BasicBlock *IfNormal, BasicBlock *IfException, - ArrayRef<Value *> Args, const Twine &NameStr) { - assert(getNumOperands() == 2 + Args.size() && "NumOperands not set up?"); - Op<-2>() = IfNormal; - Op<-1>() = IfException; - std::copy(Args.begin(), Args.end(), op_begin()); - setName(NameStr); -} - -CatchBlockInst::CatchBlockInst(const CatchBlockInst &CBI) - : TerminatorInst(CBI.getType(), Instruction::CatchBlock, - OperandTraits<CatchBlockInst>::op_end(this) - - CBI.getNumOperands(), - CBI.getNumOperands()) { - std::copy(CBI.op_begin(), CBI.op_end(), op_begin()); -} - -CatchBlockInst::CatchBlockInst(Type *RetTy, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef<Value *> Args, - unsigned Values, const Twine &NameStr, - Instruction *InsertBefore) - : TerminatorInst(RetTy, Instruction::CatchBlock, - OperandTraits<CatchBlockInst>::op_end(this) - Values, - Values, InsertBefore) { - init(IfNormal, IfException, Args, NameStr); -} - -CatchBlockInst::CatchBlockInst(Type *RetTy, BasicBlock *IfNormal, - BasicBlock *IfException, ArrayRef<Value *> Args, - unsigned Values, const Twine &NameStr, - BasicBlock *InsertAtEnd) - : TerminatorInst(RetTy, Instruction::CatchBlock, - OperandTraits<CatchBlockInst>::op_end(this) - Values, - Values, InsertAtEnd) { - init(IfNormal, IfException, Args, NameStr); -} - -BasicBlock *CatchBlockInst::getSuccessorV(unsigned Idx) const { - return getSuccessor(Idx); -} -unsigned CatchBlockInst::getNumSuccessorsV() const { - return getNumSuccessors(); -} -void CatchBlockInst::setSuccessorV(unsigned Idx, BasicBlock *B) { - return setSuccessor(Idx, B); -} - -//===----------------------------------------------------------------------===// -// TerminateBlockInst Implementation -//===----------------------------------------------------------------------===// -void TerminateBlockInst::init(BasicBlock *BB, ArrayRef<Value *> Args, - const Twine &NameStr) { - SubclassOptionalData = 0; - if (BB) - setInstructionSubclassData(getSubclassDataFromInstruction() | 1); - if (BB) - Op<-1>() = BB; - std::copy(Args.begin(), Args.end(), op_begin()); - setName(NameStr); -} - -TerminateBlockInst::TerminateBlockInst(const TerminateBlockInst &TBI) - : TerminatorInst(TBI.getType(), Instruction::TerminateBlock, - OperandTraits<TerminateBlockInst>::op_end(this) - - TBI.getNumOperands(), - TBI.getNumOperands()) { - SubclassOptionalData = TBI.SubclassOptionalData; - std::copy(TBI.op_begin(), TBI.op_end(), op_begin()); -} - -TerminateBlockInst::TerminateBlockInst(LLVMContext &C, BasicBlock *BB, - ArrayRef<Value *> Args, unsigned Values, - const Twine &NameStr, - Instruction *InsertBefore) - : TerminatorInst(Type::getVoidTy(C), Instruction::TerminateBlock, - OperandTraits<TerminateBlockInst>::op_end(this) - Values, - Values, InsertBefore) { - init(BB, Args, NameStr); -} - -TerminateBlockInst::TerminateBlockInst(LLVMContext &C, BasicBlock *BB, - ArrayRef<Value *> Args, unsigned Values, - const Twine &NameStr, - BasicBlock *InsertAtEnd) - : TerminatorInst(Type::getVoidTy(C), Instruction::TerminateBlock, - OperandTraits<TerminateBlockInst>::op_end(this) - Values, - Values, InsertAtEnd) { - init(BB, Args, NameStr); -} - -BasicBlock *TerminateBlockInst::getSuccessorV(unsigned Idx) const { - assert(Idx == 0); - return getUnwindDest(); -} -unsigned TerminateBlockInst::getNumSuccessorsV() const { - return getNumSuccessors(); -} -void TerminateBlockInst::setSuccessorV(unsigned Idx, BasicBlock *B) { - assert(Idx == 0); - return setUnwindDest(B); -} - -//===----------------------------------------------------------------------===// -// CleanupBlockInst Implementation -//===----------------------------------------------------------------------===// -void CleanupBlockInst::init(ArrayRef<Value *> Args, const Twine &NameStr) { - assert(getNumOperands() == Args.size() && "NumOperands not set up?"); - std::copy(Args.begin(), Args.end(), op_begin()); - setName(NameStr); -} - -CleanupBlockInst::CleanupBlockInst(const CleanupBlockInst &CBI) - : Instruction(CBI.getType(), Instruction::CleanupBlock, - OperandTraits<CleanupBlockInst>::op_end(this) - - CBI.getNumOperands(), - CBI.getNumOperands()) { - std::copy(CBI.op_begin(), CBI.op_end(), op_begin()); -} - -CleanupBlockInst::CleanupBlockInst(Type *RetTy, ArrayRef<Value *> Args, - const Twine &NameStr, - Instruction *InsertBefore) - : Instruction(RetTy, Instruction::CleanupBlock, - OperandTraits<CleanupBlockInst>::op_end(this) - Args.size(), - Args.size(), InsertBefore) { - init(Args, NameStr); -} - -CleanupBlockInst::CleanupBlockInst(Type *RetTy, ArrayRef<Value *> Args, - const Twine &NameStr, - BasicBlock *InsertAtEnd) - : Instruction(RetTy, Instruction::CleanupBlock, - OperandTraits<CleanupBlockInst>::op_end(this) - Args.size(), - Args.size(), InsertAtEnd) { - init(Args, NameStr); -} - -//===----------------------------------------------------------------------===// // UnreachableInst Implementation //===----------------------------------------------------------------------===// @@ -3915,30 +3618,6 @@ InvokeInst *InvokeInst::cloneImpl() const { ResumeInst *ResumeInst::cloneImpl() const { return new (1) ResumeInst(*this); } -CleanupReturnInst *CleanupReturnInst::cloneImpl() const { - return new (getNumOperands()) CleanupReturnInst(*this); -} - -CatchEndBlockInst *CatchEndBlockInst::cloneImpl() const { - return new (getNumOperands()) CatchEndBlockInst(*this); -} - -CatchReturnInst *CatchReturnInst::cloneImpl() const { - return new (1) CatchReturnInst(*this); -} - -CatchBlockInst *CatchBlockInst::cloneImpl() const { - return new (getNumOperands()) CatchBlockInst(*this); -} - -TerminateBlockInst *TerminateBlockInst::cloneImpl() const { - return new (getNumOperands()) TerminateBlockInst(*this); -} - -CleanupBlockInst *CleanupBlockInst::cloneImpl() const { - return new (getNumOperands()) CleanupBlockInst(*this); -} - UnreachableInst *UnreachableInst::cloneImpl() const { LLVMContext &Context = getContext(); return new UnreachableInst(Context); |