LLVM: llvm::sandboxir::ConstantInt Class Reference (original) (raw)
#include "[llvm/SandboxIR/Constant.h](SandboxIR%5F2Constant%5F8h%5Fsource.html)"
| 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.' 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. |
Definition at line 69 of file Constant.h.
◆ classof()
◆ dumpOS()
| void llvm::sandboxir::ConstantInt::dumpOS ( raw_ostream & OS) const | inlineoverridevirtual |
|---|
◆ equalsInt()
| bool llvm::sandboxir::ConstantInt::equalsInt ( uint64_t V) const | inline |
|---|
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.
◆ get() [1/5]
◆ get() [2/5]
◆ get() [3/5]
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().
◆ get() [4/5]
◆ get() [5/5]
◆ getAlignValue()
| Align llvm::sandboxir::ConstantInt::getAlignValue ( ) const | inline |
|---|
◆ getBitWidth()
| unsigned llvm::sandboxir::ConstantInt::getBitWidth ( ) const | inline |
|---|
◆ getBool() [1/2]
◆ getBool() [2/2]
◆ getFalse() [1/2]
◆ getFalse() [2/2]
| Constant * llvm::sandboxir::ConstantInt::getFalse ( Type * Ty) | static |
|---|
◆ getIntegerType()
| IntegerType * llvm::sandboxir::ConstantInt::getIntegerType | ( | ) | const |
|---|
◆ getLimitedValue()
| uint64_t llvm::sandboxir::ConstantInt::getLimitedValue ( uint64_t Limit = ~0ULL) const | inline |
|---|
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.
Returns
the min of the value of the constant and the specified value Get the constant's value with a saturation limit
Definition at line 236 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
◆ getMaybeAlignValue()
| MaybeAlign llvm::sandboxir::ConstantInt::getMaybeAlignValue ( ) const | inline |
|---|
◆ getSExtValue()
| int64_t llvm::sandboxir::ConstantInt::getSExtValue ( ) const | 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.
◆ getSigned() [1/2]
◆ getSigned() [2/2]
| Constant * llvm::sandboxir::ConstantInt::getSigned ( Type * Ty, int64_t V ) | static |
|---|
◆ getTrue() [1/2]
◆ getTrue() [2/2]
| Constant * llvm::sandboxir::ConstantInt::getTrue ( Type * Ty) | static |
|---|
◆ getUseOperandNo()
| unsigned llvm::sandboxir::ConstantInt::getUseOperandNo ( const Use & Use) const | inlineoverridevirtual |
|---|
◆ getValue()
| const APInt & llvm::sandboxir::ConstantInt::getValue ( ) const | inline |
|---|
◆ getZExtValue()
| uint64_t llvm::sandboxir::ConstantInt::getZExtValue ( ) const | 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.
◆ isMaxValue()
| bool llvm::sandboxir::ConstantInt::isMaxValue ( bool IsSigned) const | inline |
|---|
This function will return true iff this constant represents the largest value that may be represented by the constant's type.
Returns
true iff this is the largest value that may be represented by this type. Determine if the value is maximal.
Definition at line 209 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
◆ isMinusOne()
| bool llvm::sandboxir::ConstantInt::isMinusOne ( ) const | inline |
|---|
This function will return true iff every bit in this constant is set to true.
Returns
true iff this constant's bits are all set to true. Determine if the value is all ones.
Definition at line 202 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
◆ isMinValue()
| bool llvm::sandboxir::ConstantInt::isMinValue ( bool IsSigned) const | inline |
|---|
This function will return true iff this constant represents the smallest value that may be represented by this constant's type.
Returns
true if this is the smallest value that may be represented by this type. Determine if the value is minimal.
Definition at line 218 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
◆ isNegative()
| bool llvm::sandboxir::ConstantInt::isNegative ( ) const | inline |
|---|
◆ isOne()
| bool llvm::sandboxir::ConstantInt::isOne ( ) const | 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.
◆ isValueValidForType() [1/2]
| bool llvm::sandboxir::ConstantInt::isValueValidForType ( Type * Ty, int64_t V ) | static |
|---|
◆ isValueValidForType() [2/2]
| bool llvm::sandboxir::ConstantInt::isValueValidForType ( Type * Ty, uint64_t V ) | static |
|---|
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.
Returns
true if V is a valid value for type Ty Determine if the value is in range for the given type.
Definition at line 83 of file Constant.cpp.
References llvm::ConstantInt::isValueValidForType().
◆ isZero()
| bool llvm::sandboxir::ConstantInt::isZero ( ) const | 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.
◆ uge()
| bool llvm::sandboxir::ConstantInt::uge ( uint64_t Num) const | inline |
|---|
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.
Returns
true iff this constant is greater or equal to the given number. Determine if the value is greater or equal to the given number.
Definition at line 227 of file Constant.h.
References llvm::cast(), and llvm::sandboxir::Value::Val.
◆ verify()
| void llvm::sandboxir::ConstantInt::verify ( ) const | inlineoverridevirtual |
|---|
◆ Context
The documentation for this class was generated from the following files:
- include/llvm/SandboxIR/Constant.h
- lib/SandboxIR/Constant.cpp