20#ifndef LLVM_IR_CONSTANTS_H
21#define LLVM_IR_CONSTANTS_H
68 void *
operator new(
size_t S) { return ::operator
new(S); }
71 void operator delete(
void *Ptr) { ::operator
delete(Ptr); }
77 static_assert(Value::ConstantDataFirstVal == 0,
78 "V->getValueID() >= Value::ConstantDataFirstVal");
79 return V->getValueID() <= ConstantDataLastVal;
95 void destroyConstantImpl();
117 bool ImplicitTrunc =
false);
126 bool IsSigned =
false,
127 bool ImplicitTrunc =
false);
136 bool ImplicitTrunc =
false) {
137 return get(Ty, V,
true, ImplicitTrunc);
140 return get(Ty, V,
true, ImplicitTrunc);
219 bool isZero()
const {
return Val.isZero(); }
225 bool isOne()
const {
return Val.isOne(); }
240 return Val.isMaxSignedValue();
242 return Val.isMaxValue();
252 return Val.isMinSignedValue();
254 return Val.isMinValue();
270 return Val.getLimitedValue(Limit);
275 return V->getValueID() == ConstantIntVal;
289 void destroyConstantImpl();
304 bool ImplicitTrunc =
false);
314 bool ImplicitTrunc =
false);
323 bool ImplicitTrunc =
false) {
324 return get(Ty, V,
true, ImplicitTrunc);
327 return get(Ty, V,
true, ImplicitTrunc);
373 bool isZero()
const {
return Val.isZero(); }
379 bool isOne()
const {
return Val.isOne(); }
394 return Val.isMaxSignedValue();
396 return Val.isMaxValue();
406 return Val.isMinSignedValue();
408 return Val.isMinValue();
413 return V->getValueID() == ConstantByteVal;
428 void destroyConstantImpl();
454 APInt *Payload =
nullptr);
456 APInt *Payload =
nullptr);
467 bool isZero()
const {
return Val.isZero(); }
482 bool isNaN()
const {
return Val.isNaN(); }
501 return V->getValueID() == ConstantFPVal;
511 explicit ConstantAggregateZero(
Type *Ty)
514 void destroyConstantImpl();
542 return V->getValueID() == ConstantAggregateZeroVal;
568 return V->getValueID() >= ConstantAggregateFirstVal &&
569 V->getValueID() <= ConstantAggregateLastVal;
588 void destroyConstantImpl();
607 return V->getValueID() == ConstantArrayVal;
620 void destroyConstantImpl();
627 template <
typename... Csts>
639 bool Packed =
false) {
646 bool Packed =
false);
650 bool Packed =
false);
659 return V->getValueID() == ConstantStructVal;
672 void destroyConstantImpl();
700 return V->getValueID() == ConstantVectorVal;
711 explicit ConstantPointerNull(
Type *
T)
714 void destroyConstantImpl();
732 return V->getValueID() == ConstantPointerNullVal;
751 const char *DataElements;
757 std::unique_ptr<ConstantDataSequential> Next;
759 void destroyConstantImpl();
831 return Str.drop_back();
841 return V->getValueID() == ConstantDataArrayVal ||
842 V->getValueID() == ConstantDataVectorVal;
846 const char *getElementPointer(
uint64_t Elt)
const;
858 explicit ConstantDataArray(
Type *ty,
const char *
Data)
867 template <
typename ElementTy>
869 const char *
Data =
reinterpret_cast<const char *
>(Elts.
data());
876 template <
typename ArrayTy>
921 bool ByteString =
false);
931 return V->getValueID() == ConstantDataArrayVal;
944 explicit ConstantDataVector(
Type *ty,
const char *
Data)
948 mutable bool IsSplatSet : 1;
949 mutable bool IsSplat : 1;
950 bool isSplatData()
const;
1018 return V->getValueID() == ConstantDataVectorVal;
1031 void destroyConstantImpl();
1041 return V->getValueID() == ConstantTokenNoneVal;
1052 void destroyConstantImpl();
1068 return V->getValueID() == ConstantTargetNoneVal;
1081 void *
operator new(
size_t S) {
return User::operator
new(S, AllocMarker); }
1083 void destroyConstantImpl();
1084 Value *handleOperandChangeImpl(Value *From, Value *To);
1087 void operator delete(
void *Ptr) { User::operator
delete(Ptr, AllocMarker); }
1114 return V->getValueID() == BlockAddressVal;
1134 void *
operator new(
size_t S) {
return User::operator
new(S, AllocMarker); }
1136 void destroyConstantImpl();
1137 Value *handleOperandChangeImpl(Value *From, Value *To);
1140 void operator delete(
void *Ptr) { User::operator
delete(Ptr, AllocMarker); }
1154 return V->getValueID() == DSOLocalEquivalentVal;
1173 void *
operator new(
size_t S) {
return User::operator
new(S, AllocMarker); }
1175 void destroyConstantImpl();
1176 Value *handleOperandChangeImpl(Value *From, Value *To);
1196 return V->getValueID() == NoCFIValueVal;
1216 void *
operator new(
size_t s) {
return User::operator
new(s, AllocMarker); }
1218 void destroyConstantImpl();
1219 Value *handleOperandChangeImpl(Value *From, Value *To);
1223 LLVM_ABI static ConstantPtrAuth *
get(Constant *Ptr, ConstantInt *
Key,
1224 ConstantInt *Disc, Constant *AddrDisc,
1225 Constant *DeactivationSymbol);
1229 LLVM_ABI ConstantPtrAuth *getWithSameSchema(Constant *Pointer)
const;
1278 const Value *Discriminator,
1283 return V->getValueID() == ConstantPtrAuthVal;
1304 void destroyConstantImpl();
1311 setValueSubclassData(Opcode);
1335 bool HasNUW =
false,
bool HasNSW =
false);
1337 bool HasNUW =
false,
bool HasNSW =
false);
1340 bool OnlyIfReduced =
false);
1342 bool OnlyIfReduced =
false);
1344 bool OnlyIfReduced =
false);
1346 bool OnlyIfReduced =
false);
1348 bool OnlyIfReduced =
false);
1350 bool OnlyIfReduced =
false);
1355 return getAdd(C1, C2,
false,
true);
1359 return getAdd(C1, C2,
true,
false);
1363 return getSub(C1, C2,
false,
true);
1367 return getSub(C1, C2,
true,
false);
1384 bool AllowRHSConstant =
false,
1393 bool AllowRHSConstant =
false,
1403 bool AllowLHSConstant =
false);
1415 bool OnlyIfReduced =
false);
1446 Type *OnlyIfReducedTy =
nullptr);
1456 std::optional<ConstantRange>
InRange = std::nullopt,
1457 Type *OnlyIfReducedTy =
nullptr) {
1465 std::optional<ConstantRange>
InRange = std::nullopt,
1466 Type *OnlyIfReducedTy =
nullptr) {
1476 std::optional<ConstantRange>
InRange = std::nullopt,
1477 Type *OnlyIfReducedTy =
nullptr);
1483 std::optional<ConstantRange>
InRange = std::nullopt,
1484 Type *OnlyIfReduced =
nullptr) {
1513 Type *OnlyIfReducedTy =
nullptr);
1516 Type *OnlyIfReducedTy =
nullptr);
1519 Type *OnlyIfReducedTy =
nullptr);
1554 bool OnlyIfReduced =
false,
1555 Type *SrcTy =
nullptr)
const;
1568 LLVM_ABI static bool isDesirableBinOp(
unsigned Opcode);
1572 LLVM_ABI static bool isSupportedBinOp(
unsigned Opcode);
1575 LLVM_ABI static bool isDesirableCastOp(
unsigned Opcode);
1578 LLVM_ABI static bool isSupportedCastOp(
unsigned Opcode);
1588 return V->getValueID() == ConstantExprVal;
1594 void setValueSubclassData(
unsigned short D) {
1620 void destroyConstantImpl();
1651 return V->getValueID() == UndefValueVal ||
1652 V->getValueID() == PoisonValueVal;
1663class PoisonValue final :
public UndefValue {
1666 explicit PoisonValue(
Type *
T) : UndefValue(
T, PoisonValueVal) {}
1668 void destroyConstantImpl();
1693 return V->getValueID() == PoisonValueVal;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static StringRef getOpcodeName(uint8_t Opcode, uint8_t OpcodeBase)
static bool isSigned(unsigned Opcode)
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
static bool InRange(int64_t Value, unsigned short Shift, int LBound, int HBound)
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
static unsigned getNumElements(Type *Ty)
static SymbolRef::Type getType(const Symbol *Sym)
static constexpr roundingMode rmNearestTiesToEven
LLVM_ABI opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
Class for arbitrary precision integers.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
Class to represent array types.
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
This static method is the primary way to construct an ArrayType.
LLVM Basic Block Representation.
const Function * getParent() const
Return the enclosing method, or null if none.
The address of a basic block.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
static LLVM_ABI BlockAddress * lookup(const BasicBlock *BB)
Lookup an existing BlockAddress constant for the given BasicBlock.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
Function * getFunction() const
BasicBlock * getBasicBlock() const
static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
Class to represent byte types.
LLVM_ABI ElementCount getElementCount() const
Return the number of elements in the array, vector, or struct.
ConstantAggregateZero(const ConstantAggregateZero &)=delete
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
LLVM_ABI Constant * getSequentialElement() const
If this CAZ has array or vector type, return a zero with the right element type.
LLVM_ABI Constant * getElementValue(Constant *C) const
Return a zero of the right value for the specified GEP index if we can, otherwise return null (e....
LLVM_ABI Constant * getStructElement(unsigned Elt) const
If this CAZ has struct type, return a zero with the right element type for the specified element.
static LLVM_ABI ConstantAggregateZero * get(Type *Ty)
Base class for aggregate constants (with operands).
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)
Transparently provide more efficient getOperand methods.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
LLVM_ABI ConstantAggregate(Type *T, ValueTy VT, ArrayRef< Constant * > V, AllocInfo AllocInfo)
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
Class for constant bytes.
static bool classof(const Value *V)
Methods to support type inquiry through isa, cast, and dyn_cast.
friend class ConstantVector
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
int64_t getSExtValue() const
Return the constant as a 64-bit byte value after it has been sign extended as appropriate for the typ...
ConstantByte(const ConstantByte &)=delete
uint64_t getZExtValue() const
Return the constant as a 64-bit byte value after it has been zero extended as appropriate for the typ...
ByteType * getByteType() const
Variant of the getType() method to always return a ByteType, which reduces the amount of casting need...
static ConstantByte * getSigned(ByteType *Ty, int64_t V, bool ImplicitTrunc=false)
Return a ConstantByte with the specified value for the specified type.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
const APInt & getValue() const
Return the constant as an APInt value reference.
static Constant * getSigned(Type *Ty, int64_t V, bool ImplicitTrunc=false)
unsigned getBitWidth() const
getBitWidth - Return the scalar bitwidth of this constant.
bool isMinValue(bool IsSigned) const
This function will return true iff this constant represents the smallest value that may be represente...
bool isMaxValue(bool IsSigned) const
This function will return true iff this constant represents the largest value that may be represented...
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
static Constant * get(LLVMContext &Context, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
static LLVM_ABI Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant of array type with a float element type taken from argument ...
friend class ConstantDataSequential
static Constant * get(LLVMContext &Context, ArrayTy &Elts)
get() constructor - ArrayTy needs to be compatible with ArrayRef<ElementTy>.
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true, bool ByteString=false)
This method constructs a CDS and initializes it with a text string.
ConstantDataArray(const ConstantDataArray &)=delete
static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)
getRaw() constructor - Return a constant with array type with an element count and element type match...
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
static LLVM_ABI Constant * getByte(Type *ElementType, ArrayRef< uint8_t > Elts)
getByte() constructors - Return a constant of array type with a byte element type taken from argument...
LLVM_ABI APFloat getElementAsAPFloat(uint64_t i) const
If this is a sequential container of floating point type, return the specified element as an APFloat.
LLVM_ABI uint64_t getElementAsInteger(uint64_t i) const
If this is a sequential container of integers (of any size), return the specified element in the low ...
StringRef getAsString() const
If this array is isString(), then this method returns the array as a StringRef.
LLVM_ABI Constant * getElementAsConstant(uint64_t i) const
Return a Constant for a specified index's element.
LLVM_ABI uint64_t getElementByteSize() const
Return the size (in bytes) of each element in the array/vector.
ConstantDataSequential(const ConstantDataSequential &)=delete
LLVM_ABI float getElementAsFloat(uint64_t i) const
If this is an sequential container of floats, return the specified element as a float.
LLVM_ABI bool isString(unsigned CharSize=8) const
This method returns true if this is an array of CharSize integers or bytes.
LLVM_ABI uint64_t getNumElements() const
Return the number of elements in the array or vector.
StringRef getAsCString() const
If this array is isCString(), then this method returns the array (without the trailing null byte) as ...
LLVM_ABI APInt getElementAsAPInt(uint64_t i) const
If this is a sequential container of integers (of any size), return the specified element as an APInt...
static LLVM_ABI Constant * getImpl(StringRef Bytes, Type *Ty)
This is the underlying implementation of all of the ConstantDataSequential::get methods.
friend class LLVMContextImpl
LLVM_ABI double getElementAsDouble(uint64_t i) const
If this is an sequential container of doubles, return the specified element as a double.
LLVM_ABI Type * getElementType() const
Return the element type of the array/vector.
LLVM_ABI bool isCString() const
This method returns true if the array "isString", ends with a null byte, and does not contains any ot...
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
LLVM_ABI StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
static LLVM_ABI bool isElementTypeCompatible(Type *Ty)
Return true if a ConstantDataSequential can be formed with a vector or array of the specified element...
ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
static Constant * getRaw(StringRef Data, uint64_t NumElements, Type *ElementTy)
getRaw() constructor - Return a constant with vector type with an element count and element type matc...
LLVM_ABI Constant * getSplatValue() const
If this is a splat constant, meaning that all of the elements have the same value,...
static LLVM_ABI Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
LLVM_ABI bool isSplat() const
Returns true if this is a splat constant, meaning that all elements have the same value.
friend class ConstantDataSequential
FixedVectorType * getType() const
Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...
ConstantDataVector(const ConstantDataVector &)=delete
static LLVM_ABI Constant * get(LLVMContext &Context, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with vector type with an element count and element type matchi...
static LLVM_ABI Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant of vector type with a float element type taken from argument...
static LLVM_ABI Constant * getByte(Type *ElementType, ArrayRef< uint8_t > Elts)
getByte() constructors - Return a constant of vector type with a byte element type taken from argumen...
static bool classof(const Value *V)
Methods to support type inquiry through isa, cast, and dyn_cast.
ConstantData(const ConstantData &)=delete
ConstantData(Type *Ty, ValueTy VT)
A constant value that is initialized with an expression using other constant values.
static LLVM_ABI Constant * getIntToPtr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
ConstantExpr(Type *ty, unsigned Opcode, AllocInfo AllocInfo)
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
static LLVM_ABI Constant * getAlignOf(Type *Ty)
getAlignOf constant expr - computes the alignment of a type in a target independent way (Note: the re...
static Constant * getNUWSub(Constant *C1, Constant *C2)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList)
Create an "inbounds" getelementptr.
friend struct ConstantExprKeyType
static LLVM_ABI Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.
static LLVM_ABI Constant * getTruncOrBitCast(Constant *C, Type *Ty)
static LLVM_ABI Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)
Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.
LLVM_ABI bool isCast() const
Return true if this is a convert constant expression.
static Constant * getNSWAdd(Constant *C1, Constant *C2)
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)
Transparently provide more efficient getOperand methods.
static LLVM_ABI Constant * getCast(unsigned ops, Constant *C, Type *Ty, bool OnlyIfReduced=false)
Convenience function for getting a Cast operation.
static LLVM_ABI Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getNot(Constant *C)
static Constant * getPtrAdd(Constant *Ptr, Constant *Offset, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReduced=nullptr)
Create a getelementptr i8, ptr, offset constant expression.
static LLVM_ABI Constant * getPtrToInt(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static Constant * getInBoundsPtrAdd(Constant *Ptr, Constant *Offset)
Create a getelementptr inbounds i8, ptr, offset constant expression.
static LLVM_ABI Constant * getPtrToAddr(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getSizeOf(Type *Ty)
getSizeOf constant expr - computes the (alloc) size of a type (in address-units, not bits) in a targe...
static bool isSupportedGetElementPtr(const Type *SrcElemTy)
Whether creating a constant expression for this getelementptr type is supported.
static Constant * getGetElementPtr(Type *Ty, Constant *C, Constant *Idx, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)
static LLVM_ABI Constant * getXor(Constant *C1, Constant *C2)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, ArrayRef< Value * > IdxList)
static Constant * getNSWNeg(Constant *C)
static Constant * getNSWSub(Constant *C1, Constant *C2)
static Constant * getInBoundsGetElementPtr(Type *Ty, Constant *C, Constant *Idx)
static Constant * getNUWAdd(Constant *C1, Constant *C2)
static LLVM_ABI Constant * getAddrSpaceCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)
Getelementptr form.
static LLVM_ABI Constant * getAdd(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
static LLVM_ABI Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
static LLVM_ABI Constant * getNeg(Constant *C, bool HasNSW=false)
static LLVM_ABI Constant * getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Constant * getWithOperands(ArrayRef< Constant * > Ops) const
This returns the current constant expression with the operands replaced with the specified values.
ConstantFP - Floating Point Values [float, double].
ConstantFP(const ConstantFP &)=delete
const APFloat & getValue() const
friend class ConstantVector
const APFloat & getValueAPF() const
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
bool isInfinity() const
Return true if the value is infinity.
bool isNegative() const
Return true if the sign bit is set.
bool isExactlyValue(double V) const
static ConstantFP * getNegativeZero(Type *Ty)
static LLVM_ABI ConstantFP * getZero(Type *Ty, bool Negative=false)
static LLVM_ABI ConstantFP * getNaN(Type *Ty, bool Negative=false, uint64_t Payload=0)
static LLVM_ABI ConstantFP * getQNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
bool isNaN() const
Return true if the value is a NaN.
LLVM_ABI bool isExactlyValue(const APFloat &V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
bool isPosZero() const
Return true if the value is positive zero.
static LLVM_ABI bool isValueValidForType(Type *Ty, const APFloat &V)
Return true if Ty is big enough to represent V.
static LLVM_ABI ConstantFP * getSNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
bool isNegZero() const
Return true if the value is negative zero.
bool isZero() const
Return true if the value is positive or negative zero.
static LLVM_ABI ConstantFP * getInfinity(Type *Ty, bool Negative=false)
This is the shared class of boolean and integer constants.
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
friend class ConstantVector
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
IntegerType * getIntegerType() const
Variant of the getType() method to always return an IntegerType, which reduces the amount of casting ...
static LLVM_ABI bool isValueValidForType(Type *Ty, uint64_t V)
This static method returns true if the type Ty is big enough to represent the value V.
static bool classof(const Value *V)
Methods to support type inquiry through isa, cast, and dyn_cast.
static Constant * getSigned(Type *Ty, int64_t V, bool ImplicitTrunc=false)
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
ConstantInt(const ConstantInt &)=delete
static ConstantInt * getSigned(IntegerType *Ty, int64_t V, bool ImplicitTrunc=false)
Return a ConstantInt with the specified value for the specified type.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
MaybeAlign getMaybeAlignValue() const
Return the constant as an llvm::MaybeAlign.
bool isMinValue(bool IsSigned) const
This function will return true iff this constant represents the smallest value that may be represente...
static LLVM_ABI ConstantInt * getFalse(LLVMContext &Context)
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
bool isMaxValue(bool IsSigned) const
This function will return true iff this constant represents the largest value that may be represented...
unsigned getBitWidth() const
getBitWidth - Return the scalar bitwidth of this constant.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
Align getAlignValue() const
Return the constant as an llvm::Align, interpreting 0 as Align(1).
bool equalsInt(uint64_t V) const
A helper method that can be used to determine if the constant contained within is equal to a constant...
const APInt & getValue() const
Return the constant as an APInt value reference.
bool uge(uint64_t Num) const
This function will return true iff this constant represents a value with active bits bigger than 64 b...
static LLVM_ABI ConstantInt * getBool(LLVMContext &Context, bool V)
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
PointerType * getPointerType() const
Return the scalar pointer type for this null value.
static LLVM_ABI ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
ConstantPointerNull(const ConstantPointerNull &)=delete
A signed pointer, in the ptrauth sense.
Constant * getAddrDiscriminator() const
The address discriminator if any, or the null constant.
friend struct ConstantPtrAuthKeyType
@ AddrDiscriminator_CtorsDtors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant)
Transparently provide more efficient getOperand methods.
Constant * getPointer() const
The pointer that is signed in this ptrauth signed pointer.
ConstantInt * getKey() const
The Key ID, an i32 constant.
Constant * getDeactivationSymbol() const
bool hasAddressDiscriminator() const
Whether there is any non-null address discriminator.
ConstantInt * getDiscriminator() const
The integer discriminator, an i64 constant, or 0.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
static Constant * getAnon(LLVMContext &Ctx, ArrayRef< Constant * > V, bool Packed=false)
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)
static LLVM_ABI StructType * getTypeForElements(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct type to use for a constant with the specified set of elements.
static std::enable_if_t< are_base_of< Constant, Csts... >::value, Constant * > get(StructType *T, Csts *...Vs)
StructType * getType() const
Specialization - reduce amount of casting.
static Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
static LLVM_ABI ConstantTargetNone * get(TargetExtType *T)
Static factory methods - Return objects of the specified value.
TargetExtType * getType() const
Specialize the getType() method to always return an TargetExtType, which reduces the amount of castin...
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast.
ConstantTargetNone(const ConstantTargetNone &)=delete
ConstantTokenNone(const ConstantTokenNone &)=delete
static LLVM_ABI ConstantTokenNone * get(LLVMContext &Context)
Return the ConstantTokenNone.
static bool classof(const Value *V)
Methods to support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
FixedVectorType * getType() const
Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...
LLVM_ABI Constant * getSplatValue(bool AllowPoison=false) const
If all elements of the vector constant have the same value, return that value.
static LLVM_ABI Constant * getSplat(ElementCount EC, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
Constant(Type *ty, ValueTy vty, AllocInfo AllocInfo)
Wrapper for a function that represents a value that functionally represents the original function.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
GlobalValue * getGlobalValue() const
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
A parsed version of the target data layout string in and methods for querying it.
static constexpr ElementCount getFixed(ScalarTy MinVal)
Class to represent fixed width SIMD vectors.
Represents flags for the getelementptr instruction/expression.
static GEPNoWrapFlags inBounds()
static GEPNoWrapFlags none()
Class to represent integer types.
This is an important class for using LLVM in a threaded context.
Wrapper for a value that won't be replaced with a CFI jump table pointer in LowerTypeTestsModule.
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
PointerType * getType() const
NoCFIValue is always a pointer.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
Transparently provide more efficient getOperand methods.
GlobalValue * getGlobalValue() const
Class to represent pointers.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
PoisonValue(const PoisonValue &)=delete
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
LLVM_ABI PoisonValue * getStructElement(unsigned Elt) const
If this poison has struct type, return a poison with the right element type for the specified element...
LLVM_ABI PoisonValue * getSequentialElement() const
If this poison has array or vector type, return a poison with the right element type.
LLVM_ABI PoisonValue * getElementValue(Constant *C) const
Return an poison of the right value for the specified GEP index if we can, otherwise return null (e....
Represent a constant reference to a string, i.e.
Class to represent struct types.
Class to represent target extensions types, which are generally unintrospectable from target-independ...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
static LLVM_ABI IntegerType * getInt8Ty(LLVMContext &C)
static Type * getScalarTy(LLVMContext &C)
LLVM_ABI UndefValue * getElementValue(Constant *C) const
Return an undef of the right value for the specified GEP index if we can, otherwise return null (e....
LLVM_ABI UndefValue * getStructElement(unsigned Elt) const
If this undef has struct type, return a undef with the right element type for the specified element.
UndefValue(const UndefValue &)=delete
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
UndefValue(Type *T, ValueTy vty)
LLVM_ABI UndefValue * getSequentialElement() const
If this Undef has array or vector type, return a undef with the right element type.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
unsigned short getSubclassDataFromValue() const
LLVMContext & getContext() const
All values hold a context through their type.
void setValueSubclassData(unsigned short D)
ValueTy
Concrete subclass of this.
Base class of all SIMD vector types.
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
FunctionAddr VTableAddr uintptr_t uintptr_t Data
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
std::conjunction< std::is_base_of< T, Ts >... > are_base_of
traits class for checking whether type T is a base class for all the given types in the variadic list...
This struct is a compact representation of a valid (non-zero power of two) alignment.
FixedNumOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
Compile-time customization of User operands.
Information about how a User object was allocated, to be passed into the User constructor.
Indicates this User has operands co-allocated.
VariadicOperandTraits - determine the allocation regime of the Use array when it is a prefix to the U...