Type *AllocatedType;
protected:
- AllocaInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ AllocaInst *cloneImpl() const;
+
public:
explicit AllocaInst(Type *Ty, Value *ArraySize = nullptr,
const Twine &Name = "",
class LoadInst : public UnaryInstruction {
void AssertOK();
protected:
- LoadInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ LoadInst *cloneImpl() const;
+
public:
LoadInst(Value *Ptr, const Twine &NameStr, Instruction *InsertBefore);
LoadInst(Value *Ptr, const Twine &NameStr, BasicBlock *InsertAtEnd);
void *operator new(size_t, unsigned) = delete;
void AssertOK();
protected:
- StoreInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ StoreInst *cloneImpl() const;
+
public:
// allocate space for exactly two operands
void *operator new(size_t s) {
void *operator new(size_t, unsigned) = delete;
void Init(AtomicOrdering Ordering, SynchronizationScope SynchScope);
protected:
- FenceInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ FenceInst *cloneImpl() const;
+
public:
// allocate space for exactly zero operands
void *operator new(size_t s) {
AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering,
SynchronizationScope SynchScope);
protected:
- AtomicCmpXchgInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ AtomicCmpXchgInst *cloneImpl() const;
+
public:
// allocate space for exactly three operands
void *operator new(size_t s) {
class AtomicRMWInst : public Instruction {
void *operator new(size_t, unsigned) = delete;
protected:
- AtomicRMWInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ AtomicRMWInst *cloneImpl() const;
+
public:
/// This enumeration lists the possible modifications atomicrmw can make. In
/// the descriptions, 'p' is the pointer to the instruction's memory location,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- GetElementPtrInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ GetElementPtrInst *cloneImpl() const;
+
public:
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
ArrayRef<Value *> IdxList,
}
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical ICmpInst
- ICmpInst *clone_impl() const override;
+ ICmpInst *cloneImpl() const;
+
public:
/// \brief Constructor with insert-before-instruction semantics.
ICmpInst(
/// \brief Represents a floating point comparison operator.
class FCmpInst: public CmpInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical FCmpInst
- FCmpInst *clone_impl() const override;
+ FCmpInst *cloneImpl() const;
+
public:
/// \brief Constructor with insert-before-instruction semantics.
FCmpInst(
Instruction *InsertBefore);
CallInst(Value *F, const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- CallInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ CallInst *cloneImpl() const;
+
public:
static CallInst *Create(Value *Func,
ArrayRef<Value *> Args,
setName(NameStr);
}
protected:
- SelectInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ SelectInst *cloneImpl() const;
+
public:
static SelectInst *Create(Value *C, Value *S1, Value *S2,
const Twine &NameStr = "",
///
class VAArgInst : public UnaryInstruction {
protected:
- VAArgInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ VAArgInst *cloneImpl() const;
public:
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr,
BasicBlock *InsertAtEnd);
protected:
- ExtractElementInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ ExtractElementInst *cloneImpl() const;
public:
static ExtractElementInst *Create(Value *Vec, Value *Idx,
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- InsertElementInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ InsertElementInst *cloneImpl() const;
public:
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
///
class ShuffleVectorInst : public Instruction {
protected:
- ShuffleVectorInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ ShuffleVectorInst *cloneImpl() const;
public:
// allocate space for exactly three operands
return User::operator new(s, 1);
}
protected:
- ExtractValueInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ ExtractValueInst *cloneImpl() const;
public:
static ExtractValueInst *Create(Value *Agg,
InsertValueInst(Value *Agg, Value *Val, unsigned Idx,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- InsertValueInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ InsertValueInst *cloneImpl() const;
+
public:
// allocate space for exactly two operands
void *operator new(size_t s) {
User::allocHungoffUses(N, /* IsPhi */ true);
}
- PHINode *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ PHINode *cloneImpl() const;
+
public:
/// Constructors - NumReservedValues is a hint for the number of incoming
/// edges that this phi node will have (use 0 if you really have no idea).
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- LandingPadInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ LandingPadInst *cloneImpl() const;
+
public:
/// Constructors - NumReservedClauses is a hint for the number of incoming
/// clauses that this landingpad will have (use 0 if you really have no idea).
ReturnInst(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd);
explicit ReturnInst(LLVMContext &C, BasicBlock *InsertAtEnd);
protected:
- ReturnInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ ReturnInst *cloneImpl() const;
+
public:
static ReturnInst* Create(LLVMContext &C, Value *retVal = nullptr,
Instruction *InsertBefore = nullptr) {
BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
BasicBlock *InsertAtEnd);
protected:
- BranchInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ BranchInst *cloneImpl() const;
+
public:
static BranchInst *Create(BasicBlock *IfTrue,
Instruction *InsertBefore = nullptr) {
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
BasicBlock *InsertAtEnd);
protected:
- SwitchInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ SwitchInst *cloneImpl() const;
+
public:
// -2
/// autoinserts at the end of the specified BasicBlock.
IndirectBrInst(Value *Address, unsigned NumDests, BasicBlock *InsertAtEnd);
protected:
- IndirectBrInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ IndirectBrInst *cloneImpl() const;
+
public:
static IndirectBrInst *Create(Value *Address, unsigned NumDests,
Instruction *InsertBefore = nullptr) {
ArrayRef<Value *> Args, unsigned Values,
const Twine &NameStr, BasicBlock *InsertAtEnd);
protected:
- InvokeInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ InvokeInst *cloneImpl() const;
+
public:
static InvokeInst *Create(Value *Func,
BasicBlock *IfNormal, BasicBlock *IfException,
explicit ResumeInst(Value *Exn, Instruction *InsertBefore=nullptr);
ResumeInst(Value *Exn, BasicBlock *InsertAtEnd);
protected:
- ResumeInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ ResumeInst *cloneImpl() const;
+
public:
static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = nullptr) {
return new(1) ResumeInst(Exn, InsertBefore);
class UnreachableInst : public TerminatorInst {
void *operator new(size_t, unsigned) = delete;
protected:
- UnreachableInst *clone_impl() const override;
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
+ UnreachableInst *cloneImpl() const;
public:
// allocate space for exactly zero operands
/// \brief This class represents a truncation of integer types.
class TruncInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical TruncInst
- TruncInst *clone_impl() const override;
+ TruncInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents zero extension of integer types.
class ZExtInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical ZExtInst
- ZExtInst *clone_impl() const override;
+ ZExtInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a sign extension of integer types.
class SExtInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical SExtInst
- SExtInst *clone_impl() const override;
+ SExtInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a truncation of floating point types.
class FPTruncInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical FPTruncInst
- FPTruncInst *clone_impl() const override;
+ FPTruncInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents an extension of floating point types.
class FPExtInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical FPExtInst
- FPExtInst *clone_impl() const override;
+ FPExtInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a cast unsigned integer to floating point.
class UIToFPInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical UIToFPInst
- UIToFPInst *clone_impl() const override;
+ UIToFPInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a cast from signed integer to floating point.
class SIToFPInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical SIToFPInst
- SIToFPInst *clone_impl() const override;
+ SIToFPInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a cast from floating point to unsigned integer
class FPToUIInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical FPToUIInst
- FPToUIInst *clone_impl() const override;
+ FPToUIInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a cast from floating point to signed integer.
class FPToSIInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical FPToSIInst
- FPToSIInst *clone_impl() const override;
+ FPToSIInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
);
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical IntToPtrInst
- IntToPtrInst *clone_impl() const override;
+ IntToPtrInst *cloneImpl() const;
/// \brief Returns the address space of this instruction's pointer type.
unsigned getAddressSpace() const {
/// \brief This class represents a cast from a pointer to an integer
class PtrToIntInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical PtrToIntInst
- PtrToIntInst *clone_impl() const override;
+ PtrToIntInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// \brief This class represents a no-op cast from one type to another.
class BitCastInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical BitCastInst
- BitCastInst *clone_impl() const override;
+ BitCastInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
/// one address space to another.
class AddrSpaceCastInst : public CastInst {
protected:
+ // Note: Instruction needs to be a friend here to call cloneImpl.
+ friend class Instruction;
/// \brief Clone an identical AddrSpaceCastInst
- AddrSpaceCastInst *clone_impl() const override;
+ AddrSpaceCastInst *cloneImpl() const;
public:
/// \brief Constructor with insert-before-instruction semantics
}
//===----------------------------------------------------------------------===//
-// clone_impl() implementations
+// cloneImpl() implementations
//===----------------------------------------------------------------------===//
// Define these methods here so vtables don't get emitted into every translation
// unit that uses these classes.
-GetElementPtrInst *GetElementPtrInst::clone_impl() const {
+GetElementPtrInst *GetElementPtrInst::cloneImpl() const {
return new (getNumOperands()) GetElementPtrInst(*this);
}
-BinaryOperator *BinaryOperator::clone_impl() const {
+BinaryOperator *BinaryOperator::cloneImpl() const {
return Create(getOpcode(), Op<0>(), Op<1>());
}
-FCmpInst* FCmpInst::clone_impl() const {
+FCmpInst *FCmpInst::cloneImpl() const {
return new FCmpInst(getPredicate(), Op<0>(), Op<1>());
}
-ICmpInst* ICmpInst::clone_impl() const {
+ICmpInst *ICmpInst::cloneImpl() const {
return new ICmpInst(getPredicate(), Op<0>(), Op<1>());
}
-ExtractValueInst *ExtractValueInst::clone_impl() const {
+ExtractValueInst *ExtractValueInst::cloneImpl() const {
return new ExtractValueInst(*this);
}
-InsertValueInst *InsertValueInst::clone_impl() const {
+InsertValueInst *InsertValueInst::cloneImpl() const {
return new InsertValueInst(*this);
}
-AllocaInst *AllocaInst::clone_impl() const {
+AllocaInst *AllocaInst::cloneImpl() const {
AllocaInst *Result = new AllocaInst(getAllocatedType(),
(Value *)getOperand(0), getAlignment());
Result->setUsedWithInAlloca(isUsedWithInAlloca());
return Result;
}
-LoadInst *LoadInst::clone_impl() const {
+LoadInst *LoadInst::cloneImpl() const {
return new LoadInst(getOperand(0), Twine(), isVolatile(),
getAlignment(), getOrdering(), getSynchScope());
}
-StoreInst *StoreInst::clone_impl() const {
+StoreInst *StoreInst::cloneImpl() const {
return new StoreInst(getOperand(0), getOperand(1), isVolatile(),
getAlignment(), getOrdering(), getSynchScope());
}
-AtomicCmpXchgInst *AtomicCmpXchgInst::clone_impl() const {
+AtomicCmpXchgInst *AtomicCmpXchgInst::cloneImpl() const {
AtomicCmpXchgInst *Result =
new AtomicCmpXchgInst(getOperand(0), getOperand(1), getOperand(2),
getSuccessOrdering(), getFailureOrdering(),
return Result;
}
-AtomicRMWInst *AtomicRMWInst::clone_impl() const {
+AtomicRMWInst *AtomicRMWInst::cloneImpl() const {
AtomicRMWInst *Result =
new AtomicRMWInst(getOperation(),getOperand(0), getOperand(1),
getOrdering(), getSynchScope());
return Result;
}
-FenceInst *FenceInst::clone_impl() const {
+FenceInst *FenceInst::cloneImpl() const {
return new FenceInst(getContext(), getOrdering(), getSynchScope());
}
-TruncInst *TruncInst::clone_impl() const {
+TruncInst *TruncInst::cloneImpl() const {
return new TruncInst(getOperand(0), getType());
}
-ZExtInst *ZExtInst::clone_impl() const {
+ZExtInst *ZExtInst::cloneImpl() const {
return new ZExtInst(getOperand(0), getType());
}
-SExtInst *SExtInst::clone_impl() const {
+SExtInst *SExtInst::cloneImpl() const {
return new SExtInst(getOperand(0), getType());
}
-FPTruncInst *FPTruncInst::clone_impl() const {
+FPTruncInst *FPTruncInst::cloneImpl() const {
return new FPTruncInst(getOperand(0), getType());
}
-FPExtInst *FPExtInst::clone_impl() const {
+FPExtInst *FPExtInst::cloneImpl() const {
return new FPExtInst(getOperand(0), getType());
}
-UIToFPInst *UIToFPInst::clone_impl() const {
+UIToFPInst *UIToFPInst::cloneImpl() const {
return new UIToFPInst(getOperand(0), getType());
}
-SIToFPInst *SIToFPInst::clone_impl() const {
+SIToFPInst *SIToFPInst::cloneImpl() const {
return new SIToFPInst(getOperand(0), getType());
}
-FPToUIInst *FPToUIInst::clone_impl() const {
+FPToUIInst *FPToUIInst::cloneImpl() const {
return new FPToUIInst(getOperand(0), getType());
}
-FPToSIInst *FPToSIInst::clone_impl() const {
+FPToSIInst *FPToSIInst::cloneImpl() const {
return new FPToSIInst(getOperand(0), getType());
}
-PtrToIntInst *PtrToIntInst::clone_impl() const {
+PtrToIntInst *PtrToIntInst::cloneImpl() const {
return new PtrToIntInst(getOperand(0), getType());
}
-IntToPtrInst *IntToPtrInst::clone_impl() const {
+IntToPtrInst *IntToPtrInst::cloneImpl() const {
return new IntToPtrInst(getOperand(0), getType());
}
-BitCastInst *BitCastInst::clone_impl() const {
+BitCastInst *BitCastInst::cloneImpl() const {
return new BitCastInst(getOperand(0), getType());
}
-AddrSpaceCastInst *AddrSpaceCastInst::clone_impl() const {
+AddrSpaceCastInst *AddrSpaceCastInst::cloneImpl() const {
return new AddrSpaceCastInst(getOperand(0), getType());
}
-CallInst *CallInst::clone_impl() const {
+CallInst *CallInst::cloneImpl() const {
return new(getNumOperands()) CallInst(*this);
}
-SelectInst *SelectInst::clone_impl() const {
+SelectInst *SelectInst::cloneImpl() const {
return SelectInst::Create(getOperand(0), getOperand(1), getOperand(2));
}
-VAArgInst *VAArgInst::clone_impl() const {
+VAArgInst *VAArgInst::cloneImpl() const {
return new VAArgInst(getOperand(0), getType());
}
-ExtractElementInst *ExtractElementInst::clone_impl() const {
+ExtractElementInst *ExtractElementInst::cloneImpl() const {
return ExtractElementInst::Create(getOperand(0), getOperand(1));
}
-InsertElementInst *InsertElementInst::clone_impl() const {
+InsertElementInst *InsertElementInst::cloneImpl() const {
return InsertElementInst::Create(getOperand(0), getOperand(1), getOperand(2));
}
-ShuffleVectorInst *ShuffleVectorInst::clone_impl() const {
+ShuffleVectorInst *ShuffleVectorInst::cloneImpl() const {
return new ShuffleVectorInst(getOperand(0), getOperand(1), getOperand(2));
}
-PHINode *PHINode::clone_impl() const {
- return new PHINode(*this);
-}
+PHINode *PHINode::cloneImpl() const { return new PHINode(*this); }
-LandingPadInst *LandingPadInst::clone_impl() const {
+LandingPadInst *LandingPadInst::cloneImpl() const {
return new LandingPadInst(*this);
}
-ReturnInst *ReturnInst::clone_impl() const {
+ReturnInst *ReturnInst::cloneImpl() const {
return new(getNumOperands()) ReturnInst(*this);
}
-BranchInst *BranchInst::clone_impl() const {
+BranchInst *BranchInst::cloneImpl() const {
return new(getNumOperands()) BranchInst(*this);
}
-SwitchInst *SwitchInst::clone_impl() const {
- return new SwitchInst(*this);
-}
+SwitchInst *SwitchInst::cloneImpl() const { return new SwitchInst(*this); }
-IndirectBrInst *IndirectBrInst::clone_impl() const {
+IndirectBrInst *IndirectBrInst::cloneImpl() const {
return new IndirectBrInst(*this);
}
-
-InvokeInst *InvokeInst::clone_impl() const {
+InvokeInst *InvokeInst::cloneImpl() const {
return new(getNumOperands()) InvokeInst(*this);
}
-ResumeInst *ResumeInst::clone_impl() const {
- return new(1) ResumeInst(*this);
-}
+ResumeInst *ResumeInst::cloneImpl() const { return new (1) ResumeInst(*this); }
-UnreachableInst *UnreachableInst::clone_impl() const {
+UnreachableInst *UnreachableInst::cloneImpl() const {
LLVMContext &Context = getContext();
return new UnreachableInst(Context);
}