public:
explicit AllocaInst(const Type *Ty, Value *ArraySize = 0,
const Twine &Name = "", Instruction *InsertBefore = 0);
- AllocaInst(const Type *Ty, Value *ArraySize,
+ AllocaInst(const Type *Ty, Value *ArraySize,
const Twine &Name, BasicBlock *InsertAtEnd);
AllocaInst(const Type *Ty, const Twine &Name, Instruction *InsertBefore = 0);
unsigned getPointerAddressSpace() const {
return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
}
-
-
+
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const LoadInst *) { return true; }
static inline bool classof(const Instruction *I) {
Value *getValueOperand() { return getOperand(0); }
const Value *getValueOperand() const { return getOperand(0); }
-
+
Value *getPointerOperand() { return getOperand(1); }
const Value *getPointerOperand() const { return getOperand(1); }
static unsigned getPointerOperandIndex() { return 1U; }
unsigned getPointerAddressSpace() const {
return cast<PointerType>(getPointerOperand()->getType())->getAddressSpace();
}
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const StoreInst *) { return true; }
static inline bool classof(const Instruction *I) {
static unsigned getPointerOperandIndex() {
return 0U; // get index for modifying correct operand
}
-
+
unsigned getPointerAddressSpace() const {
return cast<PointerType>(getType())->getAddressSpace();
}
class ICmpInst: public CmpInst {
protected:
/// @brief Clone an indentical ICmpInst
- virtual ICmpInst *clone_impl() const;
+ virtual ICmpInst *clone_impl() const;
public:
/// @brief Constructor with insert-before-instruction semantics.
ICmpInst(
assert(getOperand(0)->getType()->isFPOrFPVectorTy() &&
"Invalid operand types for FCmp instruction");
}
-
+
/// @brief Constructor with insert-at-end semantics.
FCmpInst(
BasicBlock &InsertAtEnd, ///< Block to insert into.
unsigned(isTC));
}
- /// @deprecated these "define hacks" will go away soon
- /// @brief coerce out-of-tree code to abandon the low-level interfaces
- /// @detail see below comments and update your code to high-level interfaces
- /// - getOperand(0) ---> getCalledValue(), or possibly getCalledFunction
- /// - setOperand(0, V) ---> setCalledFunction(V)
- ///
- /// in LLVM v2.8-only code
- /// - getOperand(N+1) ---> getArgOperand(N)
- /// - setOperand(N+1, V) ---> setArgOperand(N, V)
- /// - getNumOperands() ---> getNumArgOperands()+1 // note the "+1"!
- ///
- /// in backward compatible code please consult llvm/Support/CallSite.h,
- /// you should create a callsite using the CallInst pointer and call its
- /// methods
- ///
-# define public private
-# define protected private
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-# undef public
-# undef protected
-public:
/// getNumArgOperands - Return the number of call arguments.
///
unsigned getParamAlignment(unsigned i) const {
return AttributeList.getParamAlignment(i);
}
-
+
/// @brief Return true if the call should not be inlined.
bool isNoInline() const { return paramHasAttr(~0, Attribute::NoInline); }
void setIsNoInline(bool Value = true) {
Op<-1>() = Fn;
}
+ /// isInlineAsm - Check if this call is an inline asm statement.
+ bool isInlineAsm() const {
+ return isa<InlineAsm>(Op<-1>());
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const CallInst *) { return true; }
static inline bool classof(const Instruction *I) {
Value *getCondition() { return Op<0>(); }
Value *getTrueValue() { return Op<1>(); }
Value *getFalseValue() { return Op<2>(); }
-
+
/// areInvalidOperands - Return a string if the specified operands are invalid
/// for a select operation, otherwise return null.
static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
setName(NameStr);
}
+ Value *getPointerOperand() { return getOperand(0); }
+ const Value *getPointerOperand() const { return getOperand(0); }
+ static unsigned getPointerOperandIndex() { return 0U; }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const VAArgInst *) { return true; }
static inline bool classof(const Instruction *I) {
Value *getIndexOperand() { return Op<1>(); }
const Value *getVectorOperand() const { return Op<0>(); }
const Value *getIndexOperand() const { return Op<1>(); }
-
+
const VectorType *getVectorOperandType() const {
return reinterpret_cast<const VectorType*>(getVectorOperand()->getType());
}
-
-
+
+
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
BasicBlock *getIncomingBlock(unsigned i) const {
return cast<BasicBlock>(getOperand(i*2+1));
}
-
+
/// getIncomingBlock - Return incoming basic block corresponding
/// to an operand of the PHI.
///
assert(this == U.getUser() && "Iterator doesn't point to PHI's Uses?");
return cast<BasicBlock>((&U + 1)->get());
}
-
+
/// getIncomingBlock - Return incoming basic block corresponding
/// to value use iterator.
///
BasicBlock *getIncomingBlock(value_use_iterator<U> I) const {
return getIncomingBlock(I.getUse());
}
-
-
+
+
void setIncomingBlock(unsigned i, BasicBlock *BB) {
setOperand(i*2+1, (Value*)BB);
}
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
- /// Convenience accessor
- Value *getReturnValue(unsigned n = 0) const {
- return n < getNumOperands()
- ? getOperand(n)
- : 0;
+ /// Convenience accessor. Returns null if there is no return value.
+ Value *getReturnValue() const {
+ return getNumOperands() != 0 ? getOperand(0) : 0;
}
unsigned getNumSuccessors() const { return 0; }
/// here to make memory allocation more efficient. This constructor can also
/// autoinsert before another instruction.
IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
-
+
/// IndirectBrInst ctor - Create a new indirectbr instruction, specifying an
/// Address to jump to. The number of expected destinations can be specified
/// here to make memory allocation more efficient. This constructor also
return new IndirectBrInst(Address, NumDests, InsertAtEnd);
}
~IndirectBrInst();
-
+
/// Provide fast operand accessors.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
+
// Accessor Methods for IndirectBrInst instruction.
Value *getAddress() { return getOperand(0); }
const Value *getAddress() const { return getOperand(0); }
void setAddress(Value *V) { setOperand(0, V); }
-
-
+
+
/// getNumDestinations - return the number of possible destinations in this
/// indirectbr instruction.
unsigned getNumDestinations() const { return getNumOperands()-1; }
-
+
/// getDestination - Return the specified destination.
BasicBlock *getDestination(unsigned i) { return getSuccessor(i); }
const BasicBlock *getDestination(unsigned i) const { return getSuccessor(i); }
-
+
/// addDestination - Add a destination.
///
void addDestination(BasicBlock *Dest);
-
+
/// removeDestination - This method removes the specified successor from the
/// indirectbr instruction.
void removeDestination(unsigned i);
-
+
unsigned getNumSuccessors() const { return getNumOperands()-1; }
BasicBlock *getSuccessor(unsigned i) const {
return cast<BasicBlock>(getOperand(i+1));
void setSuccessor(unsigned i, BasicBlock *NewSucc) {
setOperand(i+1, (Value*)NewSucc);
}
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const IndirectBrInst *) { return true; }
static inline bool classof(const Instruction *I) {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(IndirectBrInst, Value)
-
-
+
+
//===----------------------------------------------------------------------===//
// InvokeInst Class
//===----------------------------------------------------------------------===//