LLVM 20.0.0git
|
An integer-like constant. More...
#include "llvm/CodeGen/GlobalISel/Utils.h"
Public Types | |
enum class | GIConstantKind { Scalar , FixedVector , ScalableVector } |
Public Member Functions | |
GIConstant (ArrayRef< APInt > Values) | |
GIConstant (const APInt &Value, GIConstantKind Kind) | |
GIConstantKind | getKind () const |
Returns the kind of of this constant, e.g, Scalar. | |
APInt | getScalarValue () const |
Returns the value, if this constant is a scalar. | |
Static Public Member Functions | |
static std::optional< GIConstant > | getConstant (Register Const, const MachineRegisterInfo &MRI) |
An integer-like constant.
It abstracts over scalar, fixed-length vectors, and scalable vectors. In the common case, it provides a common API and feels like an APInt, while still providing low-level access. It can be used for constant-folding.
bool isZero() abstracts over the kind.
switch(const.getKind()) { } provides low-level access.
|
strong |
|
inline |
|
static |
Definition at line 1974 of file Utils.cpp.
References llvm::getDefIgnoringCopies(), llvm::getIConstantVRegValWithLookThrough(), I, MRI, llvm::SmallVectorTemplateBase< T, bool >::push_back(), ScalableVector, Scalar, and llvm::Splat.
Referenced by llvm::CombinerHelper::matchCanonicalizeICmp().
|
inline |
APInt llvm::GIConstant::getScalarValue | ( | ) | const |