LLVM 23.0.0git
llvm::FastMathFlags Class Reference

Convenience struct for specifying and reasoning about fast-math flags. More...

#include "llvm/IR/FMF.h"

Public Types

enum  {
  AllowReassoc = (1 << 0) , NoNaNs = (1 << 1) , NoInfs = (1 << 2) , NoSignedZeros = (1 << 3) ,
  AllowReciprocal = (1 << 4) , AllowContract = (1 << 5) , ApproxFunc = (1 << 6) , FlagEnd = (1 << 7)
}
 Flag bits. More...

Public Member Functions

 FastMathFlags (unsigned F)
 FastMathFlags ()=default
bool any () const
bool none () const
bool all () const
void clear ()
void set ()
bool allowReassoc () const
 Flag queries.
bool noNaNs () const
bool noInfs () const
bool noSignedZeros () const
bool allowReciprocal () const
bool allowContract () const
bool approxFunc () const
bool isFast () const
 'Fast' means all bits are set.
void setAllowReassoc (bool B=true)
 Flag setters.
void setNoNaNs (bool B=true)
void setNoInfs (bool B=true)
void setNoSignedZeros (bool B=true)
void setAllowReciprocal (bool B=true)
void setAllowContract (bool B=true)
void setApproxFunc (bool B=true)
void setFast (bool B=true)
void operator&= (const FastMathFlags &OtherFlags)
void operator|= (const FastMathFlags &OtherFlags)
bool operator!= (const FastMathFlags &OtherFlags) const
bool operator== (const FastMathFlags &OtherFlags) const
LLVM_ABI void print (raw_ostream &O) const
 Print fast-math flags to O.

Static Public Member Functions

static FastMathFlags getFast ()
static FastMathFlags intersectRewrite (FastMathFlags LHS, FastMathFlags RHS)
 Intersect rewrite-based flags.
static FastMathFlags unionValue (FastMathFlags LHS, FastMathFlags RHS)
 Union value flags.

Static Public Attributes

static constexpr unsigned AllFlagsMask = FlagEnd - 1

Friends

class FPMathOperator

Detailed Description

Convenience struct for specifying and reasoning about fast-math flags.

Definition at line 23 of file FMF.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Flag bits.

Enumerator
AllowReassoc 
NoNaNs 
NoInfs 
NoSignedZeros 
AllowReciprocal 
AllowContract 
ApproxFunc 
FlagEnd 

Definition at line 31 of file FMF.h.

Constructor & Destructor Documentation

◆ FastMathFlags() [1/2]

llvm::FastMathFlags::FastMathFlags ( unsigned F)
inline

Definition at line 42 of file FMF.h.

References assert(), and F.

Referenced by getFast(), intersectRewrite(), operator!=(), operator&=(), operator==(), operator|=(), and unionValue().

◆ FastMathFlags() [2/2]

llvm::FastMathFlags::FastMathFlags ( )
default

Referenced by intersectRewrite(), and unionValue().

Member Function Documentation

◆ all()

bool llvm::FastMathFlags::all ( ) const
inline

Definition at line 58 of file FMF.h.

References AllFlagsMask.

Referenced by isFast(), llvm::InstModificationIRStrategy::mutate(), and print().

◆ allowContract()

bool llvm::FastMathFlags::allowContract ( ) const
inline

◆ allowReassoc()

◆ allowReciprocal()

bool llvm::FastMathFlags::allowReciprocal ( ) const
inline

Definition at line 68 of file FMF.h.

References AllowReciprocal.

Referenced by mapToLLVMFastMathFlags(), and print().

◆ any()

bool llvm::FastMathFlags::any ( ) const
inline

Definition at line 56 of file FMF.h.

◆ approxFunc()

bool llvm::FastMathFlags::approxFunc ( ) const
inline

◆ clear()

void llvm::FastMathFlags::clear ( )
inline

Definition at line 60 of file FMF.h.

Referenced by setFast().

◆ getFast()

FastMathFlags llvm::FastMathFlags::getFast ( )
inlinestatic

◆ intersectRewrite()

FastMathFlags llvm::FastMathFlags::intersectRewrite ( FastMathFlags LHS,
FastMathFlags RHS )
inlinestatic

Intersect rewrite-based flags.

Definition at line 116 of file FMF.h.

References AllowContract, AllowReassoc, AllowReciprocal, ApproxFunc, FastMathFlags(), FastMathFlags(), LHS, and RHS.

Referenced by convertFSqrtDivIntoFMul(), foldFNegIntoConstant(), and tryFoldBinaryFMul().

◆ isFast()

bool llvm::FastMathFlags::isFast ( ) const
inline

'Fast' means all bits are set.

Definition at line 72 of file FMF.h.

References all().

◆ noInfs()

◆ noNaNs()

◆ none()

bool llvm::FastMathFlags::none ( ) const
inline

Definition at line 57 of file FMF.h.

Referenced by llvm::AMDGPULibCalls::fold(), and llvm::InstModificationIRStrategy::mutate().

◆ noSignedZeros()

◆ operator!=()

bool llvm::FastMathFlags::operator!= ( const FastMathFlags & OtherFlags) const
inline

Definition at line 104 of file FMF.h.

References FastMathFlags().

◆ operator&=()

void llvm::FastMathFlags::operator&= ( const FastMathFlags & OtherFlags)
inline

Definition at line 98 of file FMF.h.

References FastMathFlags().

◆ operator==()

bool llvm::FastMathFlags::operator== ( const FastMathFlags & OtherFlags) const
inline

Definition at line 108 of file FMF.h.

References FastMathFlags().

◆ operator|=()

void llvm::FastMathFlags::operator|= ( const FastMathFlags & OtherFlags)
inline

Definition at line 101 of file FMF.h.

References FastMathFlags().

◆ print()

void FastMathFlags::print ( raw_ostream & O) const

Print fast-math flags to O.

Definition at line 283 of file Operator.cpp.

References all(), allowContract(), allowReassoc(), allowReciprocal(), approxFunc(), noInfs(), noNaNs(), and noSignedZeros().

Referenced by llvm::operator<<(), and llvm::VPIRFlags::printFlags().

◆ set()

void llvm::FastMathFlags::set ( )
inline

Definition at line 61 of file FMF.h.

References AllFlagsMask.

Referenced by canConvertToFMA(), and setFast().

◆ setAllowContract()

void llvm::FastMathFlags::setAllowContract ( bool B = true)
inline

◆ setAllowReassoc()

void llvm::FastMathFlags::setAllowReassoc ( bool B = true)
inline

Flag setters.

Definition at line 75 of file FMF.h.

References AllowReassoc, and B().

Referenced by getDecodedFastMathFlags(), llvm::VPIRFlags::getFastMathFlags(), and mapFromLLVMFastMathFlags().

◆ setAllowReciprocal()

void llvm::FastMathFlags::setAllowReciprocal ( bool B = true)
inline

◆ setApproxFunc()

void llvm::FastMathFlags::setApproxFunc ( bool B = true)
inline

◆ setFast()

void llvm::FastMathFlags::setFast ( bool B = true)
inline

Definition at line 96 of file FMF.h.

References B(), clear(), and set().

Referenced by getDecodedFastMathFlags(), and getFast().

◆ setNoInfs()

void llvm::FastMathFlags::setNoInfs ( bool B = true)
inline

◆ setNoNaNs()

◆ setNoSignedZeros()

void llvm::FastMathFlags::setNoSignedZeros ( bool B = true)
inline

◆ unionValue()

FastMathFlags llvm::FastMathFlags::unionValue ( FastMathFlags LHS,
FastMathFlags RHS )
inlinestatic

Union value flags.

Definition at line 124 of file FMF.h.

References FastMathFlags(), FastMathFlags(), LHS, NoInfs, NoNaNs, NoSignedZeros, and RHS.

Referenced by convertFSqrtDivIntoFMul(), foldFNegIntoConstant(), and tryFoldBinaryFMul().

◆ FPMathOperator

friend class FPMathOperator
friend

Definition at line 25 of file FMF.h.

References FPMathOperator.

Referenced by FPMathOperator.

Member Data Documentation

◆ AllFlagsMask

unsigned llvm::FastMathFlags::AllFlagsMask = FlagEnd - 1
staticconstexpr

Definition at line 46 of file FMF.h.

Referenced by all(), and set().


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