LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
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.
 
APFloat getScalarValue () const
 Returns the value, if this constant is a scalar.
 

Static Public Member Functions

static 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 645 of file Utils.h.

Member Enumeration Documentation

◆ GFConstantKind

Enumerator
Scalar 
FixedVector 
ScalableVector 

Definition at line 647 of file Utils.h.

Constructor & Destructor Documentation

◆ GFConstant() [1/2]

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

Definition at line 654 of file Utils.h.

◆ GFConstant() [2/2]

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

Definition at line 656 of file Utils.h.

References llvm::SmallVectorTemplateBase< T, bool >::push_back().

Member Function Documentation

◆ 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 661 of file Utils.h.

◆ getScalarValue()

APFloat llvm::GFConstant::getScalarValue ( ) const

Returns the value, if this constant is a scalar.

Definition at line 2007 of file Utils.cpp.

References assert(), and Scalar.


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