- static TerminatePadInst *Create(LLVMContext &C, BasicBlock *BB = nullptr,
- ArrayRef<Value *> Args = None,
- Instruction *InsertBefore = nullptr) {
- unsigned Values = unsigned(Args.size());
- if (BB)
- ++Values;
- return new (Values) TerminatePadInst(C, BB, Args, Values, InsertBefore);
- }
- static TerminatePadInst *Create(LLVMContext &C, BasicBlock *BB,
- ArrayRef<Value *> Args,
- BasicBlock *InsertAtEnd) {
- unsigned Values = unsigned(Args.size());
- if (BB)
- ++Values;
- return new (Values) TerminatePadInst(C, BB, Args, Values, InsertAtEnd);
- }
-
- /// Provide fast operand accessors
- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
- bool hasUnwindDest() const { return getSubclassDataFromInstruction() & 1; }
- bool unwindsToCaller() const { return !hasUnwindDest(); }
-
- /// getNumArgOperands - Return the number of terminatepad arguments.
- ///
- unsigned getNumArgOperands() const {
- unsigned NumOperands = getNumOperands();
- if (hasUnwindDest())
- return NumOperands - 1;
- return NumOperands;
- }
-
- /// getArgOperand/setArgOperand - Return/set the i-th terminatepad argument.
- ///
- Value *getArgOperand(unsigned i) const { return getOperand(i); }
- void setArgOperand(unsigned i, Value *v) { setOperand(i, v); }
-
- const_op_iterator arg_end() const {
- if (hasUnwindDest())
- return op_end() - 1;
- return op_end();
- }
-
- op_iterator arg_end() {
- if (hasUnwindDest())
- return op_end() - 1;
- return op_end();
- }
-
- /// arg_operands - iteration adapter for range-for loops.
- iterator_range<op_iterator> arg_operands() {
- return iterator_range<op_iterator>(op_begin(), arg_end());
- }
-
- /// arg_operands - iteration adapter for range-for loops.
- iterator_range<const_op_iterator> arg_operands() const {
- return iterator_range<const_op_iterator>(op_begin(), arg_end());
- }
-
- /// \brief Wrappers for getting the \c Use of a terminatepad argument.
- const Use &getArgOperandUse(unsigned i) const { return getOperandUse(i); }
- Use &getArgOperandUse(unsigned i) { return getOperandUse(i); }
-
- // get*Dest - Return the destination basic blocks...
- BasicBlock *getUnwindDest() const {
- if (!hasUnwindDest())
- return nullptr;
- return cast<BasicBlock>(Op<-1>());
+ static CleanupPadInst *Create(Value *ParentPad, ArrayRef<Value *> Args = None,
+ const Twine &NameStr = "",
+ Instruction *InsertBefore = nullptr) {
+ unsigned Values = 1 + Args.size();
+ return new (Values)
+ CleanupPadInst(ParentPad, Args, Values, NameStr, InsertBefore);