15 #ifndef LLVM_IR_OPERATOR_H
16 #define LLVM_IR_OPERATOR_H
27 class GetElementPtrInst;
53 return I->getOpcode();
54 return cast<ConstantExpr>(
this)->
getOpcode();
62 return I->getOpcode();
64 return CE->getOpcode();
65 return Instruction::UserOp1;
71 return isa<Instruction>(V) || isa<ConstantExpr>(V);
89 void setHasNoUnsignedWrap(
bool B) {
93 void setHasNoSignedWrap(
bool B) {
112 return I->
getOpcode() == Instruction::Add ||
118 return CE->
getOpcode() == Instruction::Add ||
124 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
125 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
140 void setIsExact(
bool B) {
152 return OpC == Instruction::SDiv ||
153 OpC == Instruction::UDiv ||
154 OpC == Instruction::AShr ||
155 OpC == Instruction::LShr;
164 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
165 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
178 UnsafeAlgebra = (1 << 0),
181 NoSignedZeros = (1 << 3),
182 AllowReciprocal = (1 << 4)
207 Flags |= UnsafeAlgebra;
211 setAllowReciprocal();
222 void setHasUnsafeAlgebra(
bool B) {
231 setHasNoSignedZeros(
true);
232 setHasAllowReciprocal(
true);
235 void setHasNoNaNs(
bool B) {
240 void setHasNoInfs(
bool B) {
245 void setHasNoSignedZeros(
bool B) {
250 void setHasAllowReciprocal(
bool B) {
257 void setFastMathFlags(FastMathFlags FMF) {
300 float getFPAccuracy()
const;
306 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
313 template<
typename SuperClass,
unsigned Opc>
323 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
324 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
360 IsInBounds = (1 << 0)
365 void setIsInBounds(
bool B) {
401 return cast<PointerType>(getPointerOperandType())->getAddressSpace();
430 if (!isa<ConstantInt>(
I))
447 "The offset must have exactly as many bits as our pointer.");
458 if (
StructType *STy = dyn_cast<StructType>(*GTI)) {
static bool classof(const Instruction *I)
static bool classof(const Value *V)
void setNoNaNs()
Flag setters.
static bool classof(const ConstantExpr *)
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getNumOperands() const
bool hasNoSignedWrap() const
static unsigned getOpcode(const Value *V)
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
bool hasNoSignedZeros() const
static bool classof(const Instruction *)
gep_type_iterator gep_type_end(const User *GEP)
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
bool hasAllConstantIndices() const
Type * getPointerOperandType() const
static Value * getPointerOperand(Instruction &Inst)
bool hasAllowReciprocal() const
const StructLayout * getStructLayout(StructType *Ty) const
const APInt & getValue() const
Return the constant's value.
static bool classof(const Value *V)
static bool classof(const Instruction *I)
static bool classof(const Value *V)
bool any()
Whether any flag is set.
static unsigned getPointerOperandIndex()
uint64_t getZExtValue() const
Return the zero extended value.
static bool classof(const ConstantExpr *CE)
static bool classof(const Value *V)
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Accumulate the constant address offset of this GEP if possible.
static bool classof(const Instruction *I)
uint64_t getElementOffset(unsigned Idx) const
const_op_iterator idx_begin() const
unsigned getBitWidth() const
Return the number of bits in the APInt.
Value * getPointerOperand()
Value * getOperand(unsigned i) const
static bool classof(const Value *V)
static bool isPossiblyExactOpcode(unsigned OpC)
bool isFPOrFPVectorTy() const
unsigned char SubclassOptionalData
const Value * getPointerOperand() const
static bool classof(const ConstantExpr *CE)
Class for constant integers.
uint64_t getTypeAllocSize(Type *Ty) const
unsigned getNumIndices() const
void setAllowReciprocal()
bool hasAllZeroIndices() const
#define LLVM_DELETED_FUNCTION
Class for arbitrary precision integers.
bool noNaNs()
Flag queries.
bool hasUnsafeAlgebra() const
static bool classof(const Instruction *I)
void clear()
Set all the flags to false.
unsigned getOpcode() const
const_op_iterator idx_end() const
unsigned getPointerSizeInBits(unsigned AS=0) const
unsigned getPointerAddressSpace() const
static bool classof(const ConstantExpr *CE)
LLVM Value Representation.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT sextOrTrunc(unsigned width) const
Sign extend or truncate to width.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
Convenience struct for specifying and reasoning about fast-math flags.
bool hasNoUnsignedWrap() const
gep_type_iterator gep_type_begin(const User *GEP)