LLVM 22.0.0git
llvm::GFConstant Class Reference

An floating-point-like constant. More...

#include "llvm/CodeGen/GlobalISel/Utils.h"

Public Types

enum class  GFConstantKind { Scalar , FixedVector , ScalableVector }

Public Member Functions

 GFConstant (ArrayRef< APFloat > Values)
 GFConstant (const APFloat &Value, GFConstantKind Kind)
GFConstantKind getKind () const
 Returns the kind of of this constant, e.g, Scalar.
const_iterator begin () const
const_iterator end () const
size_t size () const
LLVM_ABI APFloat getScalarValue () const
 Returns the value, if this constant is a scalar.

Static Public Member Functions

static LLVM_ABI std::optional< GFConstantgetConstant (Register Const, const MachineRegisterInfo &MRI)

Detailed Description

An floating-point-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 APFloat, 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.

Definition at line 691 of file Utils.h.

Member Enumeration Documentation

◆ GFConstantKind

Enumerator
Scalar 
FixedVector 
ScalableVector 

Definition at line 696 of file Utils.h.

Constructor & Destructor Documentation

◆ GFConstant() [1/2]

llvm::GFConstant::GFConstant ( ArrayRef< APFloat > Values)
inline

Definition at line 703 of file Utils.h.

References FixedVector.

Referenced by getConstant().

◆ GFConstant() [2/2]

llvm::GFConstant::GFConstant ( const APFloat & Value,
GFConstantKind Kind )
inline

Definition at line 705 of file Utils.h.

Member Function Documentation

◆ begin()

const_iterator llvm::GFConstant::begin ( ) const
inline

Definition at line 712 of file Utils.h.

References assert(), and ScalableVector.

◆ end()

const_iterator llvm::GFConstant::end ( ) const
inline

Definition at line 718 of file Utils.h.

References assert(), and ScalableVector.

◆ getConstant()

std::optional< GFConstant > llvm::GFConstant::getConstant ( Register Const,
const MachineRegisterInfo & MRI )
static

◆ getKind()

GFConstantKind llvm::GFConstant::getKind ( ) const
inline

Returns the kind of of this constant, e.g, Scalar.

Definition at line 710 of file Utils.h.

◆ getScalarValue()

APFloat llvm::GFConstant::getScalarValue ( ) const

Returns the value, if this constant is a scalar.

Definition at line 2091 of file Utils.cpp.

References assert(), and Scalar.

◆ size()

size_t llvm::GFConstant::size ( ) const
inline

Definition at line 724 of file Utils.h.

References assert(), and FixedVector.


The documentation for this class was generated from the following files: