LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
llvm::PotentialValuesState< MemberTy > Struct Template Reference

A class for a set state. More...

#include "llvm/Transforms/IPO/Attributor.h"

Inheritance diagram for llvm::PotentialValuesState< MemberTy >:
Inheritance graph
[legend]

Public Types

using SetTy = SmallSetVector< MemberTy, 8 >
 

Public Member Functions

 PotentialValuesState ()
 
 PotentialValuesState (bool IsValid)
 
bool isValidState () const override
 See AbstractState::isValidState(...)
 
bool isAtFixpoint () const override
 See AbstractState::isAtFixpoint(...)
 
ChangeStatus indicatePessimisticFixpoint () override
 See AbstractState::indicatePessimisticFixpoint(...)
 
ChangeStatus indicateOptimisticFixpoint () override
 See AbstractState::indicateOptimisticFixpoint(...)
 
PotentialValuesStategetAssumed ()
 Return the assumed state.
 
const PotentialValuesStategetAssumed () const
 
const SetTygetAssumedSet () const
 Return this set.
 
bool undefIsContained () const
 Returns whether this state contains an undef value or not.
 
bool operator== (const PotentialValuesState &RHS) const
 
void unionAssumed (const MemberTy &C)
 Union assumed set with the passed value.
 
void unionAssumed (const PotentialValuesState &PVS)
 Union assumed set with assumed set of the passed state PVS.
 
void unionAssumedWithUndef ()
 Union assumed set with an undef value.
 
PotentialValuesState operator^= (const PotentialValuesState &PVS)
 "Clamp" this state with PVS.
 
PotentialValuesState operator&= (const PotentialValuesState &PVS)
 
bool contains (const MemberTy &V) const
 
- Public Member Functions inherited from llvm::AbstractState
virtual ~AbstractState ()=default
 
virtual bool isValidState () const =0
 Return if this abstract state is in a valid state.
 
virtual bool isAtFixpoint () const =0
 Return if this abstract state is fixed, thus does not need to be updated if information changes as it cannot change itself.
 
virtual ChangeStatus indicateOptimisticFixpoint ()=0
 Indicate that the abstract state should converge to the optimistic state.
 
virtual ChangeStatus indicatePessimisticFixpoint ()=0
 Indicate that the abstract state should converge to the pessimistic state.
 

Static Public Member Functions

static PotentialValuesState getBestState ()
 Return empty set as the best state of potential values.
 
static PotentialValuesState getBestState (const PotentialValuesState &PVS)
 
static PotentialValuesState getWorstState ()
 Return full set as the worst state of potential values.
 

Static Public Attributes

static unsigned MaxPotentialValues = 0
 Maximum number of potential values to be tracked.
 

Protected Member Functions

SetTygetAssumedSet ()
 

Detailed Description

template<typename MemberTy>
struct llvm::PotentialValuesState< MemberTy >

A class for a set state.

The assumed boolean state indicates whether the corresponding set is full set or not. If the assumed state is false, this is the worst state. The worst state (invalid state) of set of potential values is when the set contains every possible value (i.e. we cannot in any way limit the value that the target position can take). That never happens naturally, we only force it. As for the conditions under which we force it, see AAPotentialConstantValues.

Definition at line 4960 of file Attributor.h.

Member Typedef Documentation

◆ SetTy

template<typename MemberTy >
using llvm::PotentialValuesState< MemberTy >::SetTy = SmallSetVector<MemberTy, 8>

Definition at line 4961 of file Attributor.h.

Constructor & Destructor Documentation

◆ PotentialValuesState() [1/2]

template<typename MemberTy >
llvm::PotentialValuesState< MemberTy >::PotentialValuesState ( )
inline

◆ PotentialValuesState() [2/2]

template<typename MemberTy >
llvm::PotentialValuesState< MemberTy >::PotentialValuesState ( bool  IsValid)
inline

Definition at line 4965 of file Attributor.h.

Member Function Documentation

◆ contains()

template<typename MemberTy >
bool llvm::PotentialValuesState< MemberTy >::contains ( const MemberTy V) const
inline

◆ getAssumed() [1/2]

template<typename MemberTy >
PotentialValuesState & llvm::PotentialValuesState< MemberTy >::getAssumed ( )
inline

Return the assumed state.

Definition at line 4985 of file Attributor.h.

◆ getAssumed() [2/2]

template<typename MemberTy >
const PotentialValuesState & llvm::PotentialValuesState< MemberTy >::getAssumed ( ) const
inline

Definition at line 4986 of file Attributor.h.

◆ getAssumedSet() [1/2]

template<typename MemberTy >
SetTy & llvm::PotentialValuesState< MemberTy >::getAssumedSet ( )
inlineprotected

◆ getAssumedSet() [2/2]

template<typename MemberTy >
const SetTy & llvm::PotentialValuesState< MemberTy >::getAssumedSet ( ) const
inline

Return this set.

We should check whether this set is valid or not by isValidState() before calling this function.

Definition at line 4990 of file Attributor.h.

References assert(), and llvm::PotentialValuesState< MemberTy >::isValidState().

Referenced by llvm::AAPotentialConstantValues::getAssumedConstant(), and llvm::operator<<().

◆ getBestState() [1/2]

template<typename MemberTy >
static PotentialValuesState llvm::PotentialValuesState< MemberTy >::getBestState ( )
inlinestatic

Return empty set as the best state of potential values.

Definition at line 5016 of file Attributor.h.

References llvm::PotentialValuesState< MemberTy >::PotentialValuesState().

Referenced by llvm::PotentialValuesState< MemberTy >::getBestState().

◆ getBestState() [2/2]

template<typename MemberTy >
static PotentialValuesState llvm::PotentialValuesState< MemberTy >::getBestState ( const PotentialValuesState< MemberTy > &  PVS)
inlinestatic

◆ getWorstState()

template<typename MemberTy >
static PotentialValuesState llvm::PotentialValuesState< MemberTy >::getWorstState ( )
inlinestatic

Return full set as the worst state of potential values.

Definition at line 5025 of file Attributor.h.

References llvm::PotentialValuesState< MemberTy >::PotentialValuesState().

◆ indicateOptimisticFixpoint()

template<typename MemberTy >
ChangeStatus llvm::PotentialValuesState< MemberTy >::indicateOptimisticFixpoint ( )
inlineoverridevirtual

See AbstractState::indicateOptimisticFixpoint(...)

Implements llvm::AbstractState.

Definition at line 4980 of file Attributor.h.

References llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicateOptimisticFixpoint().

◆ indicatePessimisticFixpoint()

template<typename MemberTy >
ChangeStatus llvm::PotentialValuesState< MemberTy >::indicatePessimisticFixpoint ( )
inlineoverridevirtual

See AbstractState::indicatePessimisticFixpoint(...)

Implements llvm::AbstractState.

Definition at line 4975 of file Attributor.h.

References llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicatePessimisticFixpoint().

◆ isAtFixpoint()

template<typename MemberTy >
bool llvm::PotentialValuesState< MemberTy >::isAtFixpoint ( ) const
inlineoverridevirtual

See AbstractState::isAtFixpoint(...)

Implements llvm::AbstractState.

Definition at line 4972 of file Attributor.h.

References llvm::IntegerStateBase< base_ty, BestState, WorstState >::isAtFixpoint().

◆ isValidState()

template<typename MemberTy >
bool llvm::PotentialValuesState< MemberTy >::isValidState ( ) const
inlineoverridevirtual

◆ operator&=()

template<typename MemberTy >
PotentialValuesState llvm::PotentialValuesState< MemberTy >::operator&= ( const PotentialValuesState< MemberTy > &  PVS)
inline

◆ operator==()

template<typename MemberTy >
bool llvm::PotentialValuesState< MemberTy >::operator== ( const PotentialValuesState< MemberTy > &  RHS) const
inline

◆ operator^=()

template<typename MemberTy >
PotentialValuesState llvm::PotentialValuesState< MemberTy >::operator^= ( const PotentialValuesState< MemberTy > &  PVS)
inline

"Clamp" this state with PVS.

Definition at line 5039 of file Attributor.h.

References llvm::PotentialValuesState< MemberTy >::unionAssumed().

◆ undefIsContained()

template<typename MemberTy >
bool llvm::PotentialValuesState< MemberTy >::undefIsContained ( ) const
inline

◆ unionAssumed() [1/2]

template<typename MemberTy >
void llvm::PotentialValuesState< MemberTy >::unionAssumed ( const MemberTy C)
inline

Union assumed set with the passed value.

Definition at line 5030 of file Attributor.h.

References llvm::CallingConv::C.

Referenced by llvm::PotentialValuesState< MemberTy >::operator&=(), and llvm::PotentialValuesState< MemberTy >::operator^=().

◆ unionAssumed() [2/2]

template<typename MemberTy >
void llvm::PotentialValuesState< MemberTy >::unionAssumed ( const PotentialValuesState< MemberTy > &  PVS)
inline

Union assumed set with assumed set of the passed state PVS.

Definition at line 5033 of file Attributor.h.

◆ unionAssumedWithUndef()

template<typename MemberTy >
void llvm::PotentialValuesState< MemberTy >::unionAssumedWithUndef ( )
inline

Union assumed set with an undef value.

Definition at line 5036 of file Attributor.h.

Member Data Documentation

◆ MaxPotentialValues

unsigned llvm::PotentialLLVMValuesState::MaxPotentialValues = 0
static

Maximum number of potential values to be tracked.

This is set by -attributor-max-potential-values command line option

Definition at line 5013 of file Attributor.h.


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