LLVM 22.0.0git
|
#include "llvm/SandboxIR/Constant.h"
Public Member Functions | |
const APInt & | getValue () const |
Return the constant as an APInt value reference. | |
unsigned | getBitWidth () const |
getBitWidth - Return the scalar bitwidth of this constant. | |
uint64_t | getZExtValue () const |
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate for the type of this constant. | |
int64_t | getSExtValue () const |
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the type of this constant. | |
MaybeAlign | getMaybeAlignValue () const |
Return the constant as an llvm::MaybeAlign. | |
Align | getAlignValue () const |
Return the constant as an llvm::Align, interpreting 0 as Align(1). | |
bool | equalsInt (uint64_t V) const |
A helper method that can be used to determine if the constant contained within is equal to a constant. | |
LLVM_ABI IntegerType * | getIntegerType () const |
Variant of the getType() method to always return an IntegerType, which reduces the amount of casting needed in parts of the compiler. | |
bool | isNegative () const |
bool | isZero () const |
This is just a convenience method to make client code smaller for a common code. | |
bool | isOne () const |
This is just a convenience method to make client code smaller for a common case. | |
bool | isMinusOne () const |
This function will return true iff every bit in this constant is set to true. | |
bool | isMaxValue (bool IsSigned) const |
This function will return true iff this constant represents the largest value that may be represented by the constant's type. | |
bool | isMinValue (bool IsSigned) const |
This function will return true iff this constant represents the smallest value that may be represented by this constant's type. | |
bool | uge (uint64_t Num) const |
This function will return true iff this constant represents a value with active bits bigger than 64 bits or a value greater than the given uint64_t value. | |
uint64_t | getLimitedValue (uint64_t Limit=~0ULL) const |
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the limit value. | |
unsigned | getUseOperandNo (const Use &Use) const override |
\Returns the operand index of Use . | |
void | verify () const override |
Should crash if there is something wrong with the instruction. | |
void | dumpOS (raw_ostream &OS) const override |
Public Member Functions inherited from llvm::sandboxir::Constant | |
sandboxir::Context & | getParent () const |
Public Member Functions inherited from llvm::sandboxir::User | |
virtual op_iterator | op_begin () |
virtual op_iterator | op_end () |
virtual const_op_iterator | op_begin () const |
virtual const_op_iterator | op_end () const |
op_range | operands () |
const_op_range | operands () const |
Value * | getOperand (unsigned OpIdx) const |
Use | getOperandUse (unsigned OpIdx) const |
\Returns the operand edge for OpIdx . | |
virtual unsigned | getNumOperands () const |
virtual void | setOperand (unsigned OperandIdx, Value *Operand) |
bool | replaceUsesOfWith (Value *FromV, Value *ToV) |
Replaces any operands that match FromV with ToV . | |
void | verify () const override |
Should crash if there is something wrong with the instruction. | |
void | dumpCommonHeader (raw_ostream &OS) const final |
void | dumpOS (raw_ostream &OS) const override |
Public Member Functions inherited from llvm::sandboxir::Value | |
virtual | ~Value ()=default |
ClassID | getSubclassID () const |
LLVM_ABI use_iterator | use_begin () |
const_use_iterator | use_begin () const |
use_iterator | use_end () |
const_use_iterator | use_end () const |
iterator_range< use_iterator > | uses () |
iterator_range< const_use_iterator > | uses () const |
LLVM_ABI user_iterator | user_begin () |
user_iterator | user_end () |
const_user_iterator | user_begin () const |
const_user_iterator | user_end () const |
iterator_range< user_iterator > | users () |
iterator_range< const_user_iterator > | users () const |
LLVM_ABI unsigned | getNumUses () const |
\Returns the number of user edges (not necessarily to unique users). | |
bool | hasNUsesOrMore (unsigned Num) const |
Return true if this value has N uses or more. | |
bool | hasNUses (unsigned Num) const |
Return true if this Value has exactly N uses. | |
LLVM_ABI Type * | getType () const |
Context & | getContext () const |
LLVM_ABI void | replaceUsesWithIf (Value *OtherV, llvm::function_ref< bool(const Use &)> ShouldReplace) |
LLVM_ABI void | replaceAllUsesWith (Value *Other) |
StringRef | getName () const |
\Returns the LLVM IR name of the bottom-most LLVM value. | |
std::string | getUid () const |
Returns the unique id in the form 'SB<number>.' like 'SB1.'. | |
void | dumpCommonFooter (raw_ostream &OS) const |
void | dumpCommonPrefix (raw_ostream &OS) const |
void | dumpCommonSuffix (raw_ostream &OS) const |
void | printAsOperandCommon (raw_ostream &OS) const |
LLVM_DUMP_METHOD void | dump () const |
Static Public Member Functions | |
static LLVM_ABI ConstantInt * | getTrue (Context &Ctx) |
static LLVM_ABI ConstantInt * | getFalse (Context &Ctx) |
static LLVM_ABI ConstantInt * | getBool (Context &Ctx, bool V) |
static LLVM_ABI Constant * | getTrue (Type *Ty) |
static LLVM_ABI Constant * | getFalse (Type *Ty) |
static LLVM_ABI Constant * | getBool (Type *Ty, bool V) |
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. | |
static LLVM_ABI ConstantInt * | get (IntegerType *Ty, uint64_t V, bool IsSigned=false) |
Return a ConstantInt with the specified integer value for the specified type. | |
static LLVM_ABI ConstantInt * | getSigned (IntegerType *Ty, int64_t V) |
Return a ConstantInt with the specified value for the specified type. | |
static LLVM_ABI Constant * | getSigned (Type *Ty, int64_t V) |
static LLVM_ABI ConstantInt * | get (Context &Ctx, const APInt &V) |
Return a ConstantInt with the specified value and an implied Type. | |
static LLVM_ABI ConstantInt * | get (IntegerType *Ty, StringRef Str, uint8_t Radix) |
Return a ConstantInt constructed from the string strStart with the given radix. | |
static LLVM_ABI Constant * | get (Type *Ty, const APInt &V) |
If Ty is a vector type, return a Constant with a splat of the given value. | |
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 LLVM_ABI bool | isValueValidForType (Type *Ty, int64_t V) |
static bool | classof (const sandboxir::Value *From) |
For isa/dyn_cast. | |
Static Public Member Functions inherited from llvm::sandboxir::Constant | |
static bool | classof (const sandboxir::Value *From) |
For isa/dyn_cast. | |
Static Public Member Functions inherited from llvm::sandboxir::User | |
static bool | classof (const Value *From) |
For isa/dyn_cast. |
Friends | |
class | Context |
Definition at line 69 of file Constant.h.
|
inlinestatic |
For isa/dyn_cast.
Definition at line 241 of file Constant.h.
References llvm::sandboxir::Value::getSubclassID().
|
inlineoverridevirtual |
Reimplemented from llvm::sandboxir::Constant.
Definition at line 251 of file Constant.h.
References llvm::sandboxir::Value::dumpCommonPrefix(), and llvm::sandboxir::Value::dumpCommonSuffix().
A helper method that can be used to determine if the constant contained within is equal to a constant.
This only works for very small values, because this is all that can be represented with all types. Determine if this constant's value is same as an unsigned char.
Definition at line 165 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
static |
Return a ConstantInt with the specified value and an implied Type.
The type is the integer type that corresponds to the bit width of the value.
Definition at line 65 of file Constant.cpp.
References llvm::cast(), Context, and llvm::sandboxir::Value::Ctx.
|
static |
Return a ConstantInt constructed from the string strStart with the given radix.
Definition at line 69 of file Constant.cpp.
References llvm::cast().
|
static |
Return a ConstantInt with the specified integer value for the specified type.
If the type is wider than 64 bits, the value will be zero-extended to fit the type, unless IsSigned is true, in which case the value will be interpreted as a 64-bit signed integer and sign-extended to fit the type. Get a ConstantInt for a specific value.
Definition at line 52 of file Constant.cpp.
References llvm::cast().
If Ty is a vector type, return a Constant with a splat of the given value.
Otherwise return a ConstantInt for the given value.
Definition at line 74 of file Constant.cpp.
References llvm::sandboxir::Constant::Constant().
|
static |
If Ty is a vector type, return a Constant with a splat of the given value.
Otherwise return a ConstantInt for the given value.
Definition at line 48 of file Constant.cpp.
References llvm::cast().
|
inline |
Return the constant as an llvm::Align, interpreting 0 as Align(1).
Note that this method can assert if the value does not fit in 64 bits or is not a power of two.
Definition at line 157 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
getBitWidth - Return the scalar bitwidth of this constant.
Definition at line 128 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
static |
Definition at line 32 of file Constant.cpp.
References llvm::cast(), Context, llvm::sandboxir::Value::Ctx, and llvm::ConstantInt::getBool().
Definition at line 44 of file Constant.cpp.
References llvm::sandboxir::Constant::Constant(), and llvm::ConstantInt::getBool().
|
static |
Definition at line 28 of file Constant.cpp.
References llvm::cast(), Context, llvm::sandboxir::Value::Ctx, and llvm::ConstantInt::getFalse().
Definition at line 40 of file Constant.cpp.
References llvm::sandboxir::Constant::Constant(), and llvm::ConstantInt::getFalse().
IntegerType * llvm::sandboxir::ConstantInt::getIntegerType | ( | ) | const |
Variant of the getType() method to always return an IntegerType, which reduces the amount of casting needed in parts of the compiler.
Definition at line 78 of file Constant.cpp.
References llvm::cast(), llvm::sandboxir::Value::Ctx, and llvm::sandboxir::Value::Val.
getLimitedValue - If the value is smaller than the specified limit, return it, otherwise return the limit value.
This causes the value to saturate to the limit.
Definition at line 236 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
Return the constant as an llvm::MaybeAlign.
Note that this method can assert if the value does not fit in 64 bits or is not a power of two.
Definition at line 150 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the type of this constant.
Note that this method can assert if the value does not fit in 64 bits. Return the sign extended value.
Definition at line 143 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
static |
Return a ConstantInt with the specified value for the specified type.
The value V will be canonicalized to a an unsigned APInt. Accessing it with either getSExtValue() or getZExtValue() will yield a correctly sized and signed value for the type Ty. Get a ConstantInt for a specific signed value.
Definition at line 56 of file Constant.cpp.
References llvm::cast(), and llvm::ConstantInt::getSigned().
Definition at line 61 of file Constant.cpp.
References llvm::sandboxir::Constant::Constant(), and llvm::ConstantInt::getSigned().
|
static |
Definition at line 24 of file Constant.cpp.
References llvm::cast(), Context, llvm::sandboxir::Value::Ctx, and llvm::ConstantInt::getTrue().
Definition at line 36 of file Constant.cpp.
References llvm::sandboxir::Constant::Constant(), and llvm::ConstantInt::getTrue().
|
inlineoverridevirtual |
\Returns the operand index of Use
.
Reimplemented from llvm::sandboxir::Constant.
Definition at line 244 of file Constant.h.
References llvm_unreachable.
Return the constant as an APInt value reference.
This allows clients to obtain a full-precision copy of the value. Return the constant's value.
Definition at line 123 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate for the type of this constant.
Note that this method can assert if the value does not fit in 64 bits. Return the zero extended value.
Definition at line 135 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
This function will return true iff this constant represents the largest value that may be represented by the constant's type.
Definition at line 209 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
This function will return true iff every bit in this constant is set to true.
Definition at line 202 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
This function will return true iff this constant represents the smallest value that may be represented by this constant's type.
Definition at line 218 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
Definition at line 185 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inline |
This is just a convenience method to make client code smaller for a common case.
It also correctly performs the comparison without the potential for an assertion from getZExtValue(). Determine if the value is one.
Definition at line 196 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
Definition at line 86 of file Constant.cpp.
References llvm::ConstantInt::isValueValidForType().
This static method returns true if the type Ty is big enough to represent the value V.
This can be used to avoid having the get method assert when V is larger than Ty can represent. Note that there are two versions of this method, one for unsigned and one for signed integers. Although ConstantInt canonicalizes everything to an unsigned integer, the signed version avoids callers having to convert a signed quantity to the appropriate unsigned type before calling the method.
Definition at line 83 of file Constant.cpp.
References llvm::ConstantInt::isValueValidForType().
|
inline |
This is just a convenience method to make client code smaller for a common code.
It also correctly performs the comparison without the potential for an assertion from getZExtValue().
Definition at line 190 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
This function will return true iff this constant represents a value with active bits bigger than 64 bits or a value greater than the given uint64_t value.
Definition at line 227 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
|
inlineoverridevirtual |
Should crash if there is something wrong with the instruction.
Reimplemented from llvm::sandboxir::Constant.
Definition at line 248 of file Constant.h.
References assert(), llvm::isa(), and llvm::sandboxir::Value::Val.
|
friend |
Definition at line 72 of file Constant.h.
References Context, OpIdx, and Verify.
Referenced by Context, get(), getBool(), getFalse(), and getTrue().