9#ifndef LLVM_SANDBOXIR_CONSTANT_H
10#define LLVM_SANDBOXIR_CONSTANT_H
49#define DEF_CONST(ID, CLASS) case ClassID::ID:
50#include "llvm/SandboxIR/Values.def"
74 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
97 bool IsSigned =
false);
282 APInt *Payload =
nullptr);
284 APInt *Payload =
nullptr);
356 return ID == ClassID::ConstantVector ||
ID == ClassID::ConstantStruct ||
357 ID == ClassID::ConstantArray;
386 template <
typename... Csts>
397 bool Packed =
false) {
406 bool Packed =
false) {
408 "ConstantStruct::getTypeForElements cannot be called on empty list");
450class ConstantAggregateZero final :
public Constant {
475 return From->
getSubclassID() == ClassID::ConstantAggregateZero;
541 return Ctx.getOrCreateConstant(
585 return From->
getSubclassID() == ClassID::ConstantDataArray ||
602 template <
typename ElementTy>
605 return Ctx.getOrCreateConstant(NewLLVMC);
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) {
654 return Ctx.getOrCreateConstant(LLVMC);
684 return Ctx.getOrCreateConstant(NewLLVMC);
688 return Ctx.getOrCreateConstant(NewLLVMC);
692 return Ctx.getOrCreateConstant(NewLLVMC);
696 return Ctx.getOrCreateConstant(NewLLVMC);
700 return Ctx.getOrCreateConstant(NewLLVMC);
704 return Ctx.getOrCreateConstant(NewLLVMC);
727 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
731 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
735 return ElementType->getContext().getOrCreateConstant(NewLLVMC);
756 return Ctx.getOrCreateConstant(
780 return From->
getSubclassID() == ClassID::ConstantPointerNull;
898 case ClassID::Function:
899 case ClassID::GlobalVariable:
900 case ClassID::GlobalAlias:
901 case ClassID::GlobalIFunc:
972 case ClassID::Function:
973 case ClassID::GlobalVariable:
974 case ClassID::GlobalIFunc:
1029template <
typename GlobalT,
typename LLVMGlobalT,
typename ParentT,
1030 typename LLVMParentT>
1035 LLVMGVToGV(
Context &Ctx) : Ctx(Ctx) {}
1036 LLVM_ABI GlobalT &operator()(LLVMGlobalT &LLVMGV)
const;
1045 return this->Ctx.getModule(LLVMM);
1049 decltype(
static_cast<LLVMGlobalT *
>(
nullptr)->getIterator()), LLVMGVToGV>;
1051 decltype(
static_cast<LLVMGlobalT *
>(
nullptr)->getReverseIterator()),
1055 LLVMGVToGV ToGV(this->Ctx);
1060 LLVMGVToGV ToGV(this->Ctx);
1061 return map_iterator(LLVMGV->getReverseIterator(), ToGV);
1075class GlobalIFunc final
1077 llvm::GlobalObject> {
1121class GlobalVariable final
1123 GlobalObject, llvm::GlobalObject> {
1289class GlobalAlias final
1291 llvm::GlobalValue> {
1313 static_cast<const GlobalAlias *
>(
this)->getAliaseeObject());
1326 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
1401 Key->Val, Discriminator->Val,
DL);
1467 return From->
getSubclassID() == ClassID::DSOLocalEquivalent;
1477 "Expected a DSOLocalEquivalent!");
1508 "Expected a ConstantTokenNone!");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_TEMPLATE_ABI
This file contains the declarations for the subclasses of Constant, which represent the different fla...
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),...
This class holds the attributes for a particular argument, parameter, function, or return value.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
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.
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
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...
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...
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.
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::GlobalObject::VCallVisibility VCallVisibility
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)
llvm::GlobalValue::LinkageTypes LinkageTypes
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...
GlobalWithNodeAPI(Value::ClassID ID, LLVMParentT *C, Context &Ctx)
iterator getIterator() const
mapped_iterator< decltype(static_cast< LLVMGlobalT * >(nullptr) ->getReverseIterator()), LLVMGVToGV > reverse_iterator
reverse_iterator getReverseIterator() const
Module * getParent() const
mapped_iterator< decltype(static_cast< LLVMGlobalT * >(nullptr) ->getIterator()), LLVMGVToGV > iterator
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.
User(ClassID ID, llvm::Value *V, Context &Ctx)
A SandboxIR Value has users. This is the base class.
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
friend class ConstantStruct
friend class ConstantVector
ClassID getSubclassID() const
friend class ConstantDataVector
void dumpCommonSuffix(raw_ostream &OS) const
Context & Ctx
All values point to the context.
friend class ConstantPointerNull
friend class ConstantPtrAuth
LLVM_ABI Type * getType() const
friend class ConstantExpr
Context & getContext() const
friend class GlobalVariable
friend class BlockAddress
friend class ConstantArray
friend class ConstantDataArray
void dumpCommonPrefix(raw_ostream &OS) const
friend class ConstantAggregateZero
friend class DSOLocalEquivalent
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
Context & getContext() const
BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
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
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.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.