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 {
122 return cast<llvm::ConstantInt>(
Val)->getValue();
127 return cast<llvm::ConstantInt>(
Val)->getBitWidth();
134 return cast<llvm::ConstantInt>(
Val)->getZExtValue();
142 return cast<llvm::ConstantInt>(
Val)->getSExtValue();
149 return cast<llvm::ConstantInt>(
Val)->getMaybeAlignValue();
156 return cast<llvm::ConstantInt>(
Val)->getAlignValue();
164 return cast<llvm::ConstantInt>(
Val)->equalsInt(V);
183 bool isNegative()
const {
return cast<llvm::ConstantInt>(
Val)->isNegative(); }
188 bool isZero()
const {
return cast<llvm::ConstantInt>(
Val)->isZero(); }
194 bool isOne()
const {
return cast<llvm::ConstantInt>(
Val)->isOne(); }
200 bool isMinusOne()
const {
return cast<llvm::ConstantInt>(
Val)->isMinusOne(); }
208 return cast<llvm::ConstantInt>(
Val)->isMaxValue(IsSigned);
217 return cast<llvm::ConstantInt>(
Val)->isMinValue(IsSigned);
226 return cast<llvm::ConstantInt>(
Val)->uge(Num);
235 return cast<llvm::ConstantInt>(
Val)->getLimitedValue(Limit);
240 return From->getSubclassID() == ClassID::ConstantInt;
247 assert(isa<llvm::ConstantInt>(
Val) &&
"Expected a ConstantInst!");
280 APInt *Payload =
nullptr);
282 APInt *Payload =
nullptr);
292 return cast<llvm::ConstantFP>(
Val)->getValueAPF();
295 return cast<llvm::ConstantFP>(
Val)->getValue();
299 bool isZero()
const {
return cast<llvm::ConstantFP>(
Val)->isZero(); }
302 bool isNegative()
const {
return cast<llvm::ConstantFP>(
Val)->isNegative(); }
305 bool isInfinity()
const {
return cast<llvm::ConstantFP>(
Val)->isInfinity(); }
308 bool isNaN()
const {
return cast<llvm::ConstantFP>(
Val)->isNaN(); }
317 return cast<llvm::ConstantFP>(
Val)->isExactlyValue(V);
321 return cast<llvm::ConstantFP>(
Val)->isExactlyValue(V);
326 return From->getSubclassID() == ClassID::ConstantFP;
335 assert(isa<llvm::ConstantFP>(
Val) &&
"Expected a ConstantFP!");
353 auto ID =
From->getSubclassID();
354 return ID == ClassID::ConstantVector ||
ID == ClassID::ConstantStruct ||
355 ID == ClassID::ConstantArray;
372 return From->getSubclassID() == ClassID::ConstantArray;
384 template <
typename... Csts>
395 bool Packed =
false) {
400 bool Packed =
false);
404 bool Packed =
false) {
406 "ConstantStruct::getTypeForElements cannot be called on empty list");
417 return From->getSubclassID() == ClassID::ConstantStruct;
431 return From->getSubclassID() == ClassID::ConstantVector;
456 return cast<llvm::ConstantAggregateZero>(
Val)->getElementCount();
461 return From->getSubclassID() == ClassID::ConstantAggregateZero;
468 assert(isa<llvm::ConstantAggregateZero>(
Val) &&
"Expected a CAZ!");
490 return From->getSubclassID() == ClassID::ConstantPointerNull;
497 assert(isa<llvm::ConstantPointerNull>(
Val) &&
"Expected a CPNull!");
536 return cast<llvm::UndefValue>(
Val)->getNumElements();
541 return From->getSubclassID() == ClassID::UndefValue ||
542 From->getSubclassID() == ClassID::PoisonValue;
549 assert(isa<llvm::UndefValue>(
Val) &&
"Expected an UndefValue!");
584 return From->getSubclassID() == ClassID::PoisonValue;
588 assert(isa<llvm::PoisonValue>(
Val) &&
"Expected a PoisonValue!");
607 switch (
From->getSubclassID()) {
608 case ClassID::Function:
609 case ClassID::GlobalVariable:
610 case ClassID::GlobalAlias:
611 case ClassID::GlobalIFunc:
619 return cast<llvm::GlobalValue>(
Val)->getAddressSpace();
622 return cast<llvm::GlobalValue>(
Val)->hasGlobalUnnamedAddr();
631 return cast<llvm::GlobalValue>(
Val)->hasAtLeastLocalUnnamedAddr();
637 return cast<llvm::GlobalValue>(
Val)->getUnnamedAddr();
645 bool hasComdat()
const {
return cast<llvm::GlobalValue>(
Val)->hasComdat(); }
650 return cast<llvm::GlobalValue>(
Val)->getVisibility();
653 return cast<llvm::GlobalValue>(
Val)->hasDefaultVisibility();
656 return cast<llvm::GlobalValue>(
Val)->hasHiddenVisibility();
659 return cast<llvm::GlobalValue>(
Val)->hasProtectedVisibility();
681 switch (
From->getSubclassID()) {
682 case ClassID::Function:
683 case ClassID::GlobalVariable:
684 case ClassID::GlobalIFunc:
693 return cast<llvm::GlobalObject>(
Val)->getAlignment();
701 return cast<llvm::GlobalObject>(
Val)->getAlign();
712 return cast<llvm::GlobalObject>(
Val)->getGlobalObjectSubClassData();
722 return cast<llvm::GlobalObject>(
Val)->hasSection();
730 return cast<llvm::GlobalObject>(
Val)->getSection();
739 bool hasComdat()
const {
return cast<llvm::GlobalObject>(
Val)->hasComdat(); }
749 return cast<llvm::GlobalObject>(
Val)->getVCallVisibility();
758 return cast<llvm::GlobalObject>(
Val)->canIncreaseAlignment();
765template <
typename GlobalT,
typename LLVMGlobalT,
typename ParentT,
766 typename LLVMParentT>
771 LLVMGVToGV(
Context &Ctx) : Ctx(Ctx) {}
772 GlobalT &operator()(LLVMGlobalT &LLVMGV)
const;
780 llvm::Module *LLVMM = cast<LLVMGlobalT>(this->Val)->getParent();
781 return this->Ctx.getModule(LLVMM);
785 decltype(
static_cast<LLVMGlobalT *
>(
nullptr)->
getIterator()), LLVMGVToGV>;
790 auto *LLVMGV = cast<LLVMGlobalT>(this->Val);
791 LLVMGVToGV ToGV(this->Ctx);
795 auto *LLVMGV = cast<LLVMGlobalT>(this->Val);
796 LLVMGVToGV ToGV(this->Ctx);
797 return map_iterator(LLVMGV->getReverseIterator(), ToGV);
807extern template LLVM_TEMPLATE_ABI
Function &
808GlobalWithNodeAPI<Function, llvm::Function, GlobalObject, llvm::GlobalObject>::
811extern template LLVM_TEMPLATE_ABI
GlobalVariable &GlobalWithNodeAPI<
822 llvm::GlobalObject> {
830 return From->getSubclassID() == ClassID::GlobalIFunc;
857 assert(isa<llvm::GlobalIFunc>(
Val) &&
"Expected a GlobalIFunc!");
868 GlobalObject, llvm::GlobalObject> {
876 LLVMGVToGV(
Context &Ctx) : Ctx(Ctx) {}
883 return From->getSubclassID() == ClassID::GlobalVariable;
889 return cast<llvm::GlobalVariable>(
Val)->hasInitializer();
909 return cast<llvm::GlobalVariable>(
Val)->hasDefinitiveInitializer();
915 return cast<llvm::GlobalVariable>(
Val)->hasUniqueInitializer();
935 return cast<llvm::GlobalVariable>(
Val)->isConstant();
940 return cast<llvm::GlobalVariable>(
Val)->isExternallyInitialized();
955 return cast<llvm::GlobalVariable>(
Val)->hasAttribute(Kind);
960 return cast<llvm::GlobalVariable>(
Val)->hasAttribute(Kind);
965 return cast<llvm::GlobalVariable>(
Val)->hasAttributes();
970 return cast<llvm::GlobalVariable>(
Val)->getAttribute(Kind);
975 return cast<llvm::GlobalVariable>(
Val)->getAttribute(Kind);
980 return cast<llvm::GlobalVariable>(
Val)->getAttributes();
987 return cast<llvm::GlobalVariable>(
Val)->getAttributesAsList(
Index);
992 return cast<llvm::GlobalVariable>(
Val)->hasImplicitSection();
998 return cast<llvm::GlobalVariable>(
Val)->getCodeModelRaw();
1006 return cast<llvm::GlobalVariable>(
Val)->getCodeModel();
1013 assert(isa<llvm::GlobalVariable>(
Val) &&
"Expected a GlobalVariable!");
1024 llvm::GlobalValue> {
1032 return From->getSubclassID() == ClassID::GlobalAlias;
1059 Use getOperandUseInternal(
unsigned OpIdx,
bool Verify)
const final {
1073 return From->getSubclassID() == ClassID::NoCFIValue;
1082 assert(isa<llvm::NoCFIValue>(
Val) &&
"Expected a NoCFIValue!");
1116 return cast<llvm::ConstantPtrAuth>(
Val)->hasAddressDiscriminator();
1124 return cast<llvm::ConstantPtrAuth>(
Val)->hasSpecialAddressDiscriminator(
1133 return cast<llvm::ConstantPtrAuth>(
Val)->isKnownCompatibleWith(
1134 Key->Val, Discriminator->Val,
DL);
1143 return From->getSubclassID() == ClassID::ConstantPtrAuth;
1155 return From->getSubclassID() == ClassID::ConstantExpr;
1183 return From->getSubclassID() == ClassID::BlockAddress;
1200 return From->getSubclassID() == ClassID::DSOLocalEquivalent;
1209 assert(isa<llvm::DSOLocalEquivalent>(
Val) &&
1210 "Expected a DSOLocalEquivalent!");
1231 return From->getSubclassID() == ClassID::ConstantTokenNone;
1240 assert(isa<llvm::ConstantTokenNone>(
Val) &&
1241 "Expected a ConstantTokenNone!");
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")
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...
ppc ctr loops PowerPC CTR Loops Verify
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
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 BlockAddress * lookup(const BasicBlock *BB)
Lookup an existing BlockAddress constant for the given BasicBlock.
Function * getFunction() const
BasicBlock * getBasicBlock() const
static 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 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.
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.
Constant * getStructElement(unsigned Elt) const
If this CAZ has struct type, return a zero with the right element type for the specified element.
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 Constant * get(ArrayType *T, ArrayRef< Constant * > V)
ArrayType * getType() const
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static Constant * getInfinity(Type *Ty, bool Negative=false)
const APFloat & getValue() const
static 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 Constant * getSNaN(Type *Ty, bool Negative=false, APInt *Payload=nullptr)
static 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 bool isValueValidForType(Type *Ty, const APFloat &V)
Return true if Ty is big enough to represent V.
static Constant * getZero(Type *Ty, bool Negative=false)
const APFloat & getValueAPF() const
static 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 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 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 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 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...
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 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 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 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 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
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.
ConstantPtrAuth * getWithSameSchema(Constant *Pointer) const
Produce a new ptrauth expression signing the given value using the same schema as is stored in one.
Constant * getPointer() const
The pointer that is signed in this ptrauth signed pointer.
Constant * getAddrDiscriminator() const
The address discriminator if any, or the null constant.
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...
ConstantInt * getKey() const
The Key ID, an i32 constant.
bool hasSpecialAddressDiscriminator(uint64_t Value) const
Whether the address uses a special address discriminator.
static 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 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 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 ConstantTokenNone * get(Context &Ctx)
Return the ConstantTokenNone.
static bool classof(const Value *From)
For isa/dyn_cast.
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.
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
static 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.
GlobalValue * getGlobalValue() const
void dumpOS(raw_ostream &OS) const override
static bool isValidLinkage(LinkageTypes L)
Constant * getAliasee() const
static bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
const GlobalObject * getAliaseeObject() const
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
Constant * getResolver() const
void setResolver(Constant *Resolver)
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.
unsigned getGlobalObjectSubClassData() const
MaybeAlign getAlign() const
Returns the alignment of the given variable or function.
void setAlignment(MaybeAlign Align)
Sets the alignment attribute of the GlobalObject.
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.
void setGlobalObjectSubClassData(unsigned V)
uint64_t getAlignment() const
FIXME: Remove this function once transition to Align is over.
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
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)
void setVisibility(VisibilityTypes V)
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.
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.
void setInitializer(Constant *InitVal)
setInitializer - Sets the initializer for this global variable, removing any existing initializer if ...
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
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.
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.
GlobalValue * getGlobalValue() const
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
static 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.
PoisonValue * getSequentialElement() const
If this poison has array or vector type, return a poison with the right element type.
PoisonValue * getStructElement(unsigned Elt) const
If this poison has struct type, return a poison with the right element type for the specified element...
static PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
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 ...
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.
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 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.
UndefValue * getSequentialElement() const
If this Undef has array or vector type, return a undef with the right element type.
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.
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.