15 #ifndef LLVM_IR_OPERATOR_H
16 #define LLVM_IR_OPERATOR_H
45 void *
operator new(size_t,
unsigned) =
delete;
46 void *
operator new(
size_t s) =
delete;
51 return I->getOpcode();
52 return cast<ConstantExpr>(
this)->
getOpcode();
59 return I->getOpcode();
61 return CE->getOpcode();
62 return Instruction::UserOp1;
68 return isa<Instruction>(V) || isa<ConstantExpr>(V);
86 void setHasNoUnsignedWrap(
bool B) {
90 void setHasNoSignedWrap(
bool B) {
121 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
122 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
138 void setIsExact(
bool B) {
149 return OpC == Instruction::SDiv ||
150 OpC == Instruction::UDiv ||
151 OpC == Instruction::AShr ||
152 OpC == Instruction::LShr;
162 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
163 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
178 UnsafeAlgebra = (1 << 0),
181 NoSignedZeros = (1 << 3),
182 AllowReciprocal = (1 << 4)
206 Flags |= UnsafeAlgebra;
210 setAllowReciprocal();
214 Flags &= OtherFlags.Flags;
224 void setHasUnsafeAlgebra(
bool B) {
233 setHasNoSignedZeros(
true);
234 setHasAllowReciprocal(
true);
238 void setHasNoNaNs(
bool B) {
244 void setHasNoInfs(
bool B) {
250 void setHasNoSignedZeros(
bool B) {
256 void setHasAllowReciprocal(
bool B) {
264 void setFastMathFlags(FastMathFlags FMF) {
270 void copyFastMathFlags(FastMathFlags FMF) {
313 float getFPAccuracy()
const;
320 return isa<Instruction>(V) &&
classof(cast<Instruction>(V));
325 template<
typename SuperClass,
unsigned Opc>
335 return (isa<Instruction>(V) &&
classof(cast<Instruction>(V))) ||
336 (isa<ConstantExpr>(V) &&
classof(cast<ConstantExpr>(V)));
374 IsInBounds = (1 << 0),
378 void setIsInBounds(
bool B) {
416 Type *getSourceElementType()
const;
417 Type *getResultElementType()
const;
421 return getPointerOperandType()->getPointerAddressSpace();
450 if (!isa<ConstantInt>(
I))
469 friend class PtrToInt;
491 return cast<PointerType>(getPointerOperandType())->getAddressSpace();
512 #endif // LLVM_IR_OPERATOR_H
A parsed version of the target data layout string in and methods for querying it. ...
static bool classof(const Instruction *I)
static bool classof(const Value *V)
void setNoNaNs()
Flag setters.
static bool classof(const ConstantExpr *)
unsigned getNumOperands() const
bool hasNoSignedWrap() const
Test whether this operation is known to never undergo signed overflow, aka the nsw property...
static unsigned getOpcode(const Value *V)
If V is an Instruction or ConstantExpr, return its opcode.
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags.
bool hasNoSignedZeros() const
Test whether this operation can treat the sign of zero as insignificant, aka the 'S' fast-math proper...
static bool classof(const Instruction *)
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
bool isExact() const
Test whether this division is known to be exact, with zero remainder.
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
bool hasAllConstantIndices() const
Return true if all of the indices of this GEP are constant integers.
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
static Value * getPointerOperand(Instruction &Inst)
bool hasAllowReciprocal() const
Test whether this operation is permitted to use reciprocal instead of division, aka the 'R' fast-math...
bool noSignedZeros() const
struct fuzzer::@269 Flags
static bool classof(const Value *V)
A Use represents the edge between a Value definition and its users.
static bool classof(const Instruction *I)
static bool classof(const Value *V)
Value * getPointerOperand()
static unsigned getPointerOperandIndex()
static bool classof(const ConstantExpr *CE)
A constant value that is initialized with an expression using other constant values.
static bool classof(const Value *V)
This class represents a no-op cast from one type to another.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
static bool classof(const Instruction *I)
bool allowReciprocal() const
void operator&=(const FastMathFlags &OtherFlags)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
bool hasNoNaNs() const
Test whether this operation's arguments and results are to be treated as non-NaN, aka the 'N' fast-ma...
bool unsafeAlgebra() const
Optional< unsigned > getInRangeIndex() const
Returns the offset of the index with an inrange attachment, or None if none.
an instruction for type-safe pointer arithmetic to access elements of arrays and structs ...
The instances of the Type class are immutable: once they are created, they are never changed...
bool hasNoInfs() const
Test whether this operation's arguments and results are to be treated as NoN-Inf, aka the 'I' fast-ma...
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const_op_iterator idx_begin() const
A udiv or sdiv instruction, which can be marked as "exact", indicating that no bits are destroyed...
Utility class for integer arithmetic operators which may exhibit overflow - Add, Sub, and Mul.
Value * getPointerOperand()
Value * getOperand(unsigned i) const
Type * getPointerOperandType() const
Method to return the pointer operand as a PointerType.
static bool classof(const Value *V)
static bool isPossiblyExactOpcode(unsigned OpC)
const Value * getPointerOperand() const
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
unsigned char SubclassOptionalData
Hold subclass data that can be dropped.
const Value * getPointerOperand() const
static bool classof(const ConstantExpr *CE)
This is the shared class of boolean and integer constants.
unsigned getNumIndices() const
A helper template for defining operators for individual opcodes.
void setAllowReciprocal()
Utility class for floating point operations which can have information about relaxed accuracy require...
This is a utility class that provides an abstraction for the common functionality between Instruction...
Type * getType() const
All values are typed, get the type of this value.
bool hasAllZeroIndices() const
Return true if all of the indices of this GEP are zeros.
bool any() const
Whether any flag is set.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Class for arbitrary precision integers.
bool hasUnsafeAlgebra() const
Test whether this operation is permitted to be algebraically transformed, aka the 'A' fast-math prope...
static bool classof(const Instruction *I)
void clear()
Set all the flags to false.
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
const_op_iterator idx_end() const
bool isInBounds() const
Test whether this is an inbounds GEP, as defined by LangRef.html.
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
static unsigned getPointerOperandIndex()
static bool classof(const ConstantExpr *CE)
LLVM Value Representation.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
Convenience struct for specifying and reasoning about fast-math flags.
bool hasNoUnsignedWrap() const
Test whether this operation is known to never undergo unsigned overflow, aka the nuw property...
bool noNaNs() const
Flag queries.