9#ifndef LLVM_SANDBOXIR_CONSTANT_H
10#define LLVM_SANDBOXIR_CONSTANT_H
37 : sandboxir::
User(
ID,
C, SBCtx) {}
48 switch (
From->getSubclassID()) {
49#define DEF_CONST(ID, CLASS) case ClassID::ID:
50#include "llvm/SandboxIR/Values.def"
62 assert(isa<llvm::Constant>(
Val) &&
"Expected Constant!");
74 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
97 bool IsSigned =
false);
124 return cast<llvm::ConstantInt>(
Val)->getValue();
129 return cast<llvm::ConstantInt>(
Val)->getBitWidth();
136 return cast<llvm::ConstantInt>(
Val)->getZExtValue();
144 return cast<llvm::ConstantInt>(
Val)->getSExtValue();
151 return cast<llvm::ConstantInt>(
Val)->getMaybeAlignValue();
158 return cast<llvm::ConstantInt>(
Val)->getAlignValue();
166 return cast<llvm::ConstantInt>(
Val)->equalsInt(V);
185 bool isNegative()
const {
return cast<llvm::ConstantInt>(
Val)->isNegative(); }
190 bool isZero()
const {
return cast<llvm::ConstantInt>(
Val)->isZero(); }
196 bool isOne()
const {
return cast<llvm::ConstantInt>(
Val)->isOne(); }
202 bool isMinusOne()
const {
return cast<llvm::ConstantInt>(
Val)->isMinusOne(); }
210 return cast<llvm::ConstantInt>(
Val)->isMaxValue(IsSigned);
219 return cast<llvm::ConstantInt>(
Val)->isMinValue(IsSigned);
228 return cast<llvm::ConstantInt>(
Val)->uge(Num);
237 return cast<llvm::ConstantInt>(
Val)->getLimitedValue(Limit);
242 return From->getSubclassID() == ClassID::ConstantInt;
249 assert(isa<llvm::ConstantInt>(
Val) &&
"Expected a ConstantInst!");
282 APInt *Payload =
nullptr);
284 APInt *Payload =
nullptr);
294 return cast<llvm::ConstantFP>(
Val)->getValueAPF();
297 return cast<llvm::ConstantFP>(
Val)->getValue();
301 bool isZero()
const {
return cast<llvm::ConstantFP>(
Val)->isZero(); }
304 bool isNegative()
const {
return cast<llvm::ConstantFP>(
Val)->isNegative(); }
307 bool isInfinity()
const {
return cast<llvm::ConstantFP>(
Val)->isInfinity(); }
310 bool isNaN()
const {
return cast<llvm::ConstantFP>(
Val)->isNaN(); }
319 return cast<llvm::ConstantFP>(
Val)->isExactlyValue(V);
323 return cast<llvm::ConstantFP>(
Val)->isExactlyValue(V);
328 return From->getSubclassID() == ClassID::ConstantFP;
337 assert(isa<llvm::ConstantFP>(
Val) &&
"Expected a ConstantFP!");
355 auto ID =
From->getSubclassID();
356 return ID == ClassID::ConstantVector ||
ID == ClassID::ConstantStruct ||
357 ID == ClassID::ConstantArray;
374 return From->getSubclassID() == ClassID::ConstantArray;
386 template <
typename... Csts>
397 bool Packed =
false) {
406 bool Packed =
false) {
408 "ConstantStruct::getTypeForElements cannot be called on empty list");
419 return From->getSubclassID() == ClassID::ConstantStruct;
445 return From->getSubclassID() == ClassID::ConstantVector;
470 return cast<llvm::ConstantAggregateZero>(
Val)->getElementCount();
475 return From->getSubclassID() == ClassID::ConstantAggregateZero;
482 assert(isa<llvm::ConstantAggregateZero>(
Val) &&
"Expected a CAZ!");
515 return cast<llvm::ConstantDataSequential>(
Val)->getElementAsInteger(ElmIdx);
520 return cast<llvm::ConstantDataSequential>(
Val)->getElementAsAPInt(ElmIdx);
525 return cast<llvm::ConstantDataSequential>(
Val)->getElementAsAPFloat(ElmIdx);
530 return cast<llvm::ConstantDataSequential>(
Val)->getElementAsFloat(ElmIdx);
535 return cast<llvm::ConstantDataSequential>(
Val)->getElementAsDouble(ElmIdx);
551 return cast<llvm::ConstantDataSequential>(
Val)->getNumElements();
556 return cast<llvm::ConstantDataSequential>(
Val)->getElementByteSize();
560 return cast<llvm::ConstantDataSequential>(
Val)->isString(CharSize);
565 return cast<llvm::ConstantDataSequential>(
Val)->isCString();
570 return cast<llvm::ConstantDataSequential>(
Val)->getAsString();
575 return cast<llvm::ConstantDataSequential>(
Val)->getAsCString();
581 return cast<llvm::ConstantDataSequential>(
Val)->getRawDataValues();
585 return From->getSubclassID() == ClassID::ConstantDataArray ||
586 From->getSubclassID() == ClassID::ConstantDataVector;
597 return From->getSubclassID() == ClassID::ConstantDataArray;
602 template <
typename ElementTy>
610 template <
typename ArrayTy>
635 return ElementType->getContext().getOrCreateConstant(LLVMC);
639 return ElementType->getContext().getOrCreateConstant(LLVMC);
643 return ElementType->getContext().getOrCreateConstant(LLVMC);
651 bool AddNull =
true) {
677 return From->getSubclassID() == ClassID::ConstantDataVector;
727 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
731 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
735 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
743 NumElts, cast<llvm::Constant>(Elt->
Val));
750 return cast<llvm::ConstantDataVector>(
Val)->isSplat();
780 return From->getSubclassID() == ClassID::ConstantPointerNull;
787 assert(isa<llvm::ConstantPointerNull>(
Val) &&
"Expected a CPNull!");
826 return cast<llvm::UndefValue>(
Val)->getNumElements();
831 return From->getSubclassID() == ClassID::UndefValue ||
832 From->getSubclassID() == ClassID::PoisonValue;
839 assert(isa<llvm::UndefValue>(
Val) &&
"Expected an UndefValue!");
874 return From->getSubclassID() == ClassID::PoisonValue;
878 assert(isa<llvm::PoisonValue>(
Val) &&
"Expected a PoisonValue!");
897 switch (
From->getSubclassID()) {
898 case ClassID::Function:
899 case ClassID::GlobalVariable:
900 case ClassID::GlobalAlias:
901 case ClassID::GlobalIFunc:
909 return cast<llvm::GlobalValue>(
Val)->getAddressSpace();
912 return cast<llvm::GlobalValue>(
Val)->hasGlobalUnnamedAddr();
921 return cast<llvm::GlobalValue>(
Val)->hasAtLeastLocalUnnamedAddr();
927 return cast<llvm::GlobalValue>(
Val)->getUnnamedAddr();
935 bool hasComdat()
const {
return cast<llvm::GlobalValue>(
Val)->hasComdat(); }
940 return cast<llvm::GlobalValue>(
Val)->getVisibility();
943 return cast<llvm::GlobalValue>(
Val)->hasDefaultVisibility();
946 return cast<llvm::GlobalValue>(
Val)->hasHiddenVisibility();
949 return cast<llvm::GlobalValue>(
Val)->hasProtectedVisibility();
971 switch (
From->getSubclassID()) {
972 case ClassID::Function:
973 case ClassID::GlobalVariable:
974 case ClassID::GlobalIFunc:
986 return cast<llvm::GlobalObject>(
Val)->hasSection();
994 return cast<llvm::GlobalObject>(
Val)->getSection();
1003 bool hasComdat()
const {
return cast<llvm::GlobalObject>(
Val)->hasComdat(); }
1013 return cast<llvm::GlobalObject>(
Val)->getVCallVisibility();
1022 return cast<llvm::GlobalObject>(
Val)->canIncreaseAlignment();
1029template <
typename GlobalT,
typename LLVMGlobalT,
typename ParentT,
1030 typename LLVMParentT>
1035 LLVMGVToGV(
Context &Ctx) : Ctx(Ctx) {}
1036 LLVM_ABI GlobalT &operator()(LLVMGlobalT &LLVMGV)
const;
1044 llvm::Module *LLVMM = cast<LLVMGlobalT>(this->Val)->getParent();
1045 return this->Ctx.getModule(LLVMM);
1049 decltype(
static_cast<LLVMGlobalT *
>(
nullptr)->
getIterator()), LLVMGVToGV>;
1054 auto *LLVMGV = cast<LLVMGlobalT>(this->Val);
1055 LLVMGVToGV ToGV(this->Ctx);
1059 auto *LLVMGV = cast<LLVMGlobalT>(this->Val);
1060 LLVMGVToGV ToGV(this->Ctx);
1061 return map_iterator(LLVMGV->getReverseIterator(), ToGV);
1077 llvm::GlobalObject> {
1085 return From->getSubclassID() == ClassID::GlobalIFunc;
1112 assert(isa<llvm::GlobalIFunc>(
Val) &&
"Expected a GlobalIFunc!");
1123 GlobalObject, llvm::GlobalObject> {
1131 LLVMGVToGV(
Context &Ctx) : Ctx(Ctx) {}
1138 return From->getSubclassID() == ClassID::GlobalVariable;
1144 return cast<llvm::GlobalVariable>(
Val)->hasInitializer();
1164 return cast<llvm::GlobalVariable>(
Val)->hasDefinitiveInitializer();
1170 return cast<llvm::GlobalVariable>(
Val)->hasUniqueInitializer();
1190 return cast<llvm::GlobalVariable>(
Val)->isConstant();
1195 return cast<llvm::GlobalVariable>(
Val)->isExternallyInitialized();
1210 return cast<llvm::GlobalVariable>(
Val)->hasAttribute(Kind);
1215 return cast<llvm::GlobalVariable>(
Val)->hasAttribute(Kind);
1220 return cast<llvm::GlobalVariable>(
Val)->hasAttributes();
1225 return cast<llvm::GlobalVariable>(
Val)->getAttribute(Kind);
1230 return cast<llvm::GlobalVariable>(
Val)->getAttribute(Kind);
1235 return cast<llvm::GlobalVariable>(
Val)->getAttributes();
1242 return cast<llvm::GlobalVariable>(
Val)->getAttributesAsList(
Index);
1247 return cast<llvm::GlobalVariable>(
Val)->hasImplicitSection();
1253 return cast<llvm::GlobalVariable>(
Val)->getCodeModelRaw();
1261 return cast<llvm::GlobalVariable>(
Val)->getCodeModel();
1266 return cast<llvm::GlobalVariable>(
Val)->getAlign();
1280 assert(isa<llvm::GlobalVariable>(
Val) &&
"Expected a GlobalVariable!");
1291 llvm::GlobalValue> {
1299 return From->getSubclassID() == ClassID::GlobalAlias;
1326 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
1340 return From->getSubclassID() == ClassID::NoCFIValue;
1349 assert(isa<llvm::NoCFIValue>(
Val) &&
"Expected a NoCFIValue!");
1383 return cast<llvm::ConstantPtrAuth>(
Val)->hasAddressDiscriminator();
1391 return cast<llvm::ConstantPtrAuth>(
Val)->hasSpecialAddressDiscriminator(
1400 return cast<llvm::ConstantPtrAuth>(
Val)->isKnownCompatibleWith(
1401 Key->Val, Discriminator->Val,
DL);
1410 return From->getSubclassID() == ClassID::ConstantPtrAuth;
1422 return From->getSubclassID() == ClassID::ConstantExpr;
1450 return From->getSubclassID() == ClassID::BlockAddress;
1467 return From->getSubclassID() == ClassID::DSOLocalEquivalent;
1476 assert(isa<llvm::DSOLocalEquivalent>(
Val) &&
1477 "Expected a DSOLocalEquivalent!");
1498 return From->getSubclassID() == ClassID::ConstantTokenNone;
1507 assert(isa<llvm::ConstantTokenNone>(
Val) &&
1508 "Expected a ConstantTokenNone!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
BlockVerifier::State From
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_TEMPLATE_ABI
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live value
This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...
MachineInstr unsigned OpIdx
ppc ctr loops PowerPC CTR Loops Verify
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
The address of a basic block.
All zero aggregate value.
ConstantArray - Constant Array Declarations.
An array constant whose element type is a simple 1/2/4/8-byte integer or float/double,...
static LLVM_ABI Constant * getString(LLVMContext &Context, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
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 ...
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...
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
static LLVM_ABI bool isElementTypeCompatible(Type *Ty)
Return true if a ConstantDataSequential can be formed with a vector or array of the specified element...
A vector constant whose element type is a simple 1/2/4/8-byte integer or float/double,...
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...
static LLVM_ABI Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
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...
A constant value that is initialized with an expression using other constant values.
ConstantFP - Floating Point Values [float, double].
This is the shared class of boolean and integer constants.
A constant pointer value that points to null.
A signed pointer, in the ptrauth sense.
A constant token which is empty.
Constant Vector Declarations.
This is an important base class in LLVM.
Wrapper for a function that represents a value that functionally represents the original function.
A parsed version of the target data layout string in and methods for querying it.
static bool isValidLinkage(LinkageTypes L)
static bool isValidLinkage(LinkageTypes L)
static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)
VisibilityTypes
An enumeration for the kinds of visibility of global values.
LinkageTypes
An enumeration for the kinds of linkage for global values.
A Module instance is used to store all the information related to an LLVM module.
Wrapper for a value that won't be replaced with a CFI jump table pointer in LowerTypeTestsModule.
In order to facilitate speculative execution, many instructions do not invoke immediate undefined beh...
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
StringRef - Represent a constant reference to a string, i.e.
'undef' values are things that do not have specified contents.
This class implements an extremely fast bulk output stream that can only output to a stream.
Contains a list of sandboxir::Instruction's.
static LLVM_ABI BlockAddress * lookup(const BasicBlock *BB)
Lookup an existing BlockAddress constant for the given BasicBlock.
LLVM_ABI Function * getFunction() const
LLVM_ABI BasicBlock * getBasicBlock() const
static LLVM_ABI BlockAddress * get(Function *F, BasicBlock *BB)
Return a BlockAddress for the specified function and basic block.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static LLVM_ABI ConstantAggregateZero * get(Type *Ty)
ElementCount getElementCount() const
Return the number of elements in the array, vector, or struct.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
LLVM_ABI Constant * getSequentialElement() const
If this CAZ has array or vector type, return a zero with the right element type.
void verify() const override
Should crash if there is something wrong with the instruction.
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.
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....
void dumpOS(raw_ostream &OS) const override
Base class for aggregate constants (with operands).
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
ConstantAggregate(ClassID ID, llvm::Constant *C, Context &Ctx)
static bool classof(const Value *From)
For isa/dyn_cast.
static LLVM_ABI Constant * get(ArrayType *T, ArrayRef< Constant * > V)
LLVM_ABI ArrayType * getType() const
static Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant of array type with a float element type taken from argument ...
static Constant * getFP(Type *ElementType, ArrayRef< uint64_t > Elts)
static bool classof(const Value *From)
static Constant * getFP(Type *ElementType, ArrayRef< uint32_t > Elts)
ArrayType * getType() const
Specialize the getType() method to always return an ArrayType, which reduces the amount of casting ne...
static Constant * getString(Context &Ctx, StringRef Initializer, bool AddNull=true)
This method constructs a CDS and initializes it with a text string.
static Constant * get(Context &Ctx, ArrayRef< ElementTy > Elts)
get() constructor - Return a constant with array type with an element count and element type matching...
static Constant * get(Context &Ctx, ArrayTy &Elts)
get() constructor - ArrayTy needs to be compatible with ArrayRef<ElementTy>.
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...
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
uint64_t getElementAsInteger(unsigned ElmIdx) const
If this is a sequential container of integers (of any size), return the specified element in the low ...
StringRef getRawDataValues() const
Return the raw, underlying, bytes of this data.
StringRef getAsCString() const
If this array is isCString(), then this method returns the array (without the trailing null byte) as ...
Type * getElementType() const
Return the element type of the array/vector.
static bool isElementTypeCompatible(Type *Ty)
Return true if a ConstantDataSequential can be formed with a vector or array of the specified element...
unsigned getNumElements() const
Return the number of elements in the array or vector.
APFloat getElementAsAPFloat(unsigned ElmIdx) const
If this is a sequential container of floating point type, return the specified element as an APFloat.
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 *From)
StringRef getAsString() const
If this array is isString(), then this method returns the array as a StringRef.
uint64_t getElementByteSize() const
Return the size (in bytes) of each element in the array/vector.
bool isString(unsigned CharSize=8) const
This method returns true if this is an array of CharSize integers.
float getElementAsFloat(unsigned ElmIdx) const
If this is an sequential container of floats, return the specified element as a float.
double getElementAsDouble(unsigned ElmIdx) const
If this is an sequential container of doubles, return the specified element as a double.
Constant * getElementAsConstant(unsigned ElmIdx) const
Return a Constant for a specified index's element.
ConstantDataSequential(ClassID ID, llvm::ConstantDataSequential *C, Context &Ctx)
APInt getElementAsAPInt(unsigned ElmIdx) const
If this is a sequential container of integers (of any size), return the specified element as an APInt...
A vector constant whose element type is a simple 1/2/4/8-byte integer or float/double,...
static Constant * get(Context &Ctx, ArrayRef< uint32_t > Elts)
static Constant * getSplat(unsigned NumElts, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static Constant * getFP(Type *ElementType, ArrayRef< uint16_t > Elts)
getFP() constructors - Return a constant of vector type with a float element type taken from argument...
FixedVectorType * getType() const
Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...
static Constant * get(Context &Ctx, ArrayRef< uint64_t > Elts)
static bool classof(const Value *From)
Methods for support type inquiry through isa, cast, and dyn_cast:
static Constant * get(Context &Ctx, ArrayRef< uint8_t > Elts)
get() constructors - Return a constant with vector type with an element count and element type matchi...
static Constant * get(Context &Ctx, ArrayRef< float > Elts)
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...
static Constant * get(Context &Ctx, ArrayRef< uint16_t > Elts)
static Constant * get(Context &Ctx, ArrayRef< double > Elts)
static Constant * getFP(Type *ElementType, ArrayRef< uint64_t > Elts)
static Constant * getFP(Type *ElementType, ArrayRef< uint32_t > Elts)
bool isSplat() const
Returns true if this is a splat constant, meaning that all elements have the same value.
Constant * getSplatValue() const
If this is a splat constant, meaning that all of the elements have the same value,...
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static LLVM_ABI Constant * getInfinity(Type *Ty, bool Negative=false)
const APFloat & getValue() const
static LLVM_ABI Constant * getNaN(Type *Ty, bool Negative=false, uint64_t Payload=0)
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 isNegative() const
Return true if the sign bit is set.
static LLVM_ABI Constant * getSNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
static LLVM_ABI Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
bool isZero() const
Return true if the value is positive or negative zero.
void verify() const override
Should crash if there is something wrong with the instruction.
void dumpOS(raw_ostream &OS) const override
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
bool isNaN() const
Return true if the value is a NaN.
static LLVM_ABI bool isValueValidForType(Type *Ty, const APFloat &V)
Return true if Ty is big enough to represent V.
static LLVM_ABI Constant * getZero(Type *Ty, bool Negative=false)
const APFloat & getValueAPF() const
static LLVM_ABI Constant * getQNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
bool isInfinity() const
Return true if the value is infinity.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
static LLVM_ABI Constant * getNegativeZero(Type *Ty)
bool isExactlyValue(double V) const
bool isMinusOne() const
This function will return true iff every bit in this constant is set to true.
static LLVM_ABI ConstantInt * getTrue(Context &Ctx)
unsigned getBitWidth() const
getBitWidth - Return the scalar bitwidth of this constant.
MaybeAlign getMaybeAlignValue() const
Return the constant as an llvm::MaybeAlign.
const APInt & getValue() const
Return the constant as an APInt value reference.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
bool isMaxValue(bool IsSigned) const
This function will return true iff this constant represents the largest value that may be represented...
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(Context &Ctx, bool V)
bool isOne() const
This is just a convenience method to make client code smaller for a common case.
void verify() const override
Should crash if there is something wrong with the instruction.
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
static LLVM_ABI ConstantInt * getFalse(Context &Ctx)
bool isMinValue(bool IsSigned) const
This function will return true iff this constant represents the smallest value that may be represente...
LLVM_ABI IntegerType * getIntegerType() const
Variant of the getType() method to always return an IntegerType, which reduces the amount of casting ...
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...
unsigned getUseOperandNo(const Use &Use) const override
\Returns the operand index of Use.
static LLVM_ABI ConstantInt * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
void dumpOS(raw_ostream &OS) const override
static LLVM_ABI ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the l...
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 sandboxir::Value *From)
For isa/dyn_cast.
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).
static LLVM_ABI ConstantPointerNull * get(PointerType *Ty)
void verify() const override
Should crash if there is something wrong with the instruction.
void dumpOS(raw_ostream &OS) const override
LLVM_ABI PointerType * getType() const
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
LLVM_ABI ConstantPtrAuth * getWithSameSchema(Constant *Pointer) const
Produce a new ptrauth expression signing the given value using the same schema as is stored in one.
LLVM_ABI Constant * getPointer() const
The pointer that is signed in this ptrauth signed pointer.
LLVM_ABI Constant * getAddrDiscriminator() const
The address discriminator if any, or the null constant.
LLVM_ABI ConstantInt * getDiscriminator() const
The integer discriminator, an i64 constant, or 0.
bool hasAddressDiscriminator() const
Whether there is any non-null address discriminator.
bool isKnownCompatibleWith(const Value *Key, const Value *Discriminator, const DataLayout &DL) const
Check whether an authentication operation with key Key and (possibly blended) discriminator Discrimin...
LLVM_ABI ConstantInt * getKey() const
The Key ID, an i32 constant.
bool hasSpecialAddressDiscriminator(uint64_t Value) const
Whether the address uses a special address discriminator.
static LLVM_ABI ConstantPtrAuth * get(Constant *Ptr, ConstantInt *Key, ConstantInt *Disc, Constant *AddrDisc)
Return a pointer signed with the specified parameters.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static LLVM_ABI Constant * get(StructType *T, ArrayRef< Constant * > V)
static std::enable_if_t< are_base_of< Constant, Csts... >::value, Constant * > get(StructType *T, Csts *...Vs)
static Constant * getAnon(Context &Ctx, ArrayRef< Constant * > V, bool Packed=false)
static 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 Constant * getAnon(ArrayRef< Constant * > V, bool Packed=false)
Return an anonymous struct that has the specified elements.
StructType * getType() const
Specialization - reduce amount of casting.
static LLVM_ABI StructType * getTypeForElements(Context &Ctx, ArrayRef< Constant * > V, bool Packed=false)
This version of the method allows an empty list.
static bool classof(const Value *From)
For isa/dyn_cast.
void dumpOS(raw_ostream &OS) const override
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
void verify() const override
Should crash if there is something wrong with the instruction.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static LLVM_ABI ConstantTokenNone * get(Context &Ctx)
Return the ConstantTokenNone.
static LLVM_ABI Constant * getSplat(ElementCount EC, Constant *Elt)
Return a ConstantVector with the specified constant in each element.
static bool classof(const Value *From)
For isa/dyn_cast.
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
LLVM_ABI Constant * getSplatValue(bool AllowPoison=false) const
If all elements of the vector constant have the same value, return that value.
FixedVectorType * getType() const
Specialize the getType() method to always return a FixedVectorType, which reduces the amount of casti...
sandboxir::Context & getParent() const
void verify() const override
Should crash if there is something wrong with the instruction.
void dumpOS(raw_ostream &OS) const override
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
Constant(llvm::Constant *C, sandboxir::Context &SBCtx)
Constant(ClassID ID, llvm::Constant *C, sandboxir::Context &SBCtx)
unsigned getUseOperandNo(const Use &Use) const override
\Returns the operand index of Use.
Use getOperandUseInternal(unsigned OpIdx, bool Verify) const override
\Returns the Use for the OpIdx'th operand.
Type * getType(llvm::Type *LLVMTy)
LLVM_ABI Constant * getOrCreateConstant(llvm::Constant *LLVMC)
Get or create a sandboxir::Constant from an existing LLVM IR LLVMC.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static LLVM_ABI DSOLocalEquivalent * get(GlobalValue *GV)
Return a DSOLocalEquivalent for the specified global value.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
void verify() const override
Should crash if there is something wrong with the instruction.
LLVM_ABI GlobalValue * getGlobalValue() const
void dumpOS(raw_ostream &OS) const override
static bool isValidLinkage(LinkageTypes L)
LLVM_ABI Constant * getAliasee() const
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
LLVM_ABI const GlobalObject * getAliaseeObject() const
LLVM_ABI void setAliasee(Constant *Aliasee)
GlobalObject * getAliaseeObject()
void verify() const override
Should crash if there is something wrong with the instruction.
static bool isValidLinkage(LinkageTypes L)
const Function * getResolverFunction() const
LLVM_ABI Constant * getResolver() const
LLVM_ABI void setResolver(Constant *Resolver)
LLVM_ABI Function * getResolverFunction()
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
void dumpOS(raw_ostream &OS) const override
Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final
\Returns the Use for the OpIdx'th operand.
VCallVisibility getVCallVisibility() const
bool hasSection() const
Check if this global has a custom object file section.
StringRef getSection() const
Get the custom section of this global if it has one.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
LLVM_ABI void setSection(StringRef S)
Change the section for this global.
GlobalObject(ClassID ID, llvm::GlobalObject *C, Context &Ctx)
bool canIncreaseAlignment() const
Returns true if the alignment of the value can be unilaterally increased.
UnnamedAddr getUnnamedAddr() const
bool hasDefaultVisibility() const
bool hasAtLeastLocalUnnamedAddr() const
Returns true if this value's address is not significant in this module.
llvm::GlobalValue::UnnamedAddr UnnamedAddr
LLVM_ABI void setUnnamedAddr(UnnamedAddr V)
bool hasHiddenVisibility() const
VisibilityTypes getVisibility() const
unsigned getAddressSpace() const
bool hasGlobalUnnamedAddr() const
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
llvm::GlobalValue::VisibilityTypes VisibilityTypes
static UnnamedAddr getMinUnnamedAddr(UnnamedAddr A, UnnamedAddr B)
bool hasProtectedVisibility() const
GlobalValue(ClassID ID, llvm::GlobalValue *C, Context &Ctx)
LLVM_ABI void setVisibility(VisibilityTypes V)
LLVM_ABI Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
AttributeSet getAttributes() const
Return the attribute set for this global.
bool isExternallyInitialized() const
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
AttributeList getAttributesAsList(unsigned Index) const
Return attribute set as list with index.
unsigned getCodeModelRaw() const
Get the custom code model raw value of this global.
bool hasImplicitSection() const
Check if section name is present.
bool hasDefinitiveInitializer() const
hasDefinitiveInitializer - Whether the global variable has an initializer, and any other instances of...
bool hasInitializer() const
Definitions have initializers, declarations don't.
Attribute getAttribute(StringRef Kind) const
Return the attribute object.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
void verify() const override
Should crash if there is something wrong with the instruction.
LLVM_ABI void setExternallyInitialized(bool Val)
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists.
bool hasAttribute(StringRef Kind) const
Return true if the attribute exists.
LLVM_ABI void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
LLVM_ABI void setAlignment(MaybeAlign Align)
Sets the alignment attribute of the GlobalVariable.
LLVM_ABI void setConstant(bool V)
bool hasAttributes() const
Return true if any attributes exist.
std::optional< CodeModel::Model > getCodeModel() const
Get the custom code model of this global if it has one.
bool isConstant() const
If the value is a global constant, its value is immutable throughout the runtime execution of the pro...
void dumpOS(raw_ostream &OS) const override
MaybeAlign getAlign() const
Returns the alignment of the given variable.
bool hasUniqueInitializer() const
hasUniqueInitializer - Whether the global variable has an initializer, and any changes made to the in...
Provides API functions, like getIterator() and getReverseIterator() to GlobalIFunc,...
GlobalWithNodeAPI(Value::ClassID ID, LLVMParentT *C, Context &Ctx)
iterator getIterator() const
reverse_iterator getReverseIterator() const
Module * getParent() const
Class to represent integer types.
In SandboxIR the Module is mainly used to access the list of global objects.
LLVM_ABI PointerType * getType() const
NoCFIValue is always a pointer.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
void dumpOS(raw_ostream &OS) const override
void verify() const override
Should crash if there is something wrong with the instruction.
LLVM_ABI GlobalValue * getGlobalValue() const
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
static LLVM_ABI NoCFIValue * get(GlobalValue *GV)
Return a NoCFIValue for the specified function.
void dumpOS(raw_ostream &OS) const override
void verify() const override
Should crash if there is something wrong with the instruction.
LLVM_ABI PoisonValue * getSequentialElement() const
If this poison has array or vector type, return a poison with the right element type.
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...
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified 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....
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Context & getContext() const
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
void verify() const override
Should crash if there is something wrong with the instruction.
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....
static LLVM_ABI UndefValue * get(Type *T)
Static factory methods - Return an 'undef' object of the specified type.
void dumpOS(raw_ostream &OS) const override
UndefValue(ClassID ID, llvm::Constant *C, Context &Ctx)
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
UndefValue(llvm::UndefValue *C, Context &Ctx)
unsigned getNumElements() const
Return the number of elements in the array, vector, or struct.
LLVM_ABI UndefValue * getSequentialElement() const
If this Undef has array or vector type, return a undef with the right element type.
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.
Represents a Def-use/Use-def edge in SandboxIR.
A sandboxir::User has operands.
unsigned getUseOperandNoDefault(const Use &Use) const
The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...
Use getOperandUseDefault(unsigned OpIdx, bool Verify) const
\Returns the Use edge that corresponds to OpIdx.
A SandboxIR Value has users. This is the base class.
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
void dumpCommonSuffix(raw_ostream &OS) const
Context & Ctx
All values point to the context.
LLVM_ABI Type * getType() const
Context & getContext() const
void dumpCommonPrefix(raw_ostream &OS) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
@ BasicBlock
Various leaf nodes.
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...
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.