LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::IntegerStateBase< base_ty, BestState, WorstState > Struct Template Referenceabstract

Simple state with integers encoding. More...

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

Inheritance diagram for llvm::IntegerStateBase< base_ty, BestState, WorstState >:
Inheritance graph
[legend]
Collaboration diagram for llvm::IntegerStateBase< base_ty, BestState, WorstState >:
Collaboration graph
[legend]

Public Types

using base_t = base_ty
 

Public Member Functions

 IntegerStateBase ()
 
 IntegerStateBase (base_t Assumed)
 
bool isValidState () const override
 See AbstractState::isValidState() NOTE: For now we simply pretend that the worst possible state is invalid. More...
 
bool isAtFixpoint () const override
 See AbstractState::isAtFixpoint() More...
 
ChangeStatus indicateOptimisticFixpoint () override
 See AbstractState::indicateOptimisticFixpoint(...) More...
 
ChangeStatus indicatePessimisticFixpoint () override
 See AbstractState::indicatePessimisticFixpoint(...) More...
 
base_t getKnown () const
 Return the known state encoding. More...
 
base_t getAssumed () const
 Return the assumed state encoding. More...
 
bool operator== (const IntegerStateBase< base_t, BestState, WorstState > &R) const
 Equality for IntegerStateBase. More...
 
bool operator!= (const IntegerStateBase< base_t, BestState, WorstState > &R) const
 Inequality for IntegerStateBase. More...
 
void operator^= (const IntegerStateBase< base_t, BestState, WorstState > &R)
 "Clamp" this state with R. More...
 
void operator+= (const IntegerStateBase< base_t, BestState, WorstState > &R)
 "Clamp" this state with R. More...
 
void operator|= (const IntegerStateBase< base_t, BestState, WorstState > &R)
 
void operator&= (const IntegerStateBase< base_t, BestState, WorstState > &R)
 
- Public Member Functions inherited from llvm::AbstractState
virtual ~AbstractState ()
 

Static Public Member Functions

static constexpr base_t getBestState ()
 Return the best possible representable state. More...
 
static constexpr base_t getBestState (const IntegerStateBase &)
 
static constexpr base_t getWorstState ()
 Return the worst possible representable state. More...
 
static constexpr base_t getWorstState (const IntegerStateBase &)
 

Protected Member Functions

virtual void handleNewAssumedValue (base_t Value)=0
 Handle a new assumed value Value. Subtype dependent. More...
 
virtual void handleNewKnownValue (base_t Value)=0
 Handle a new known value Value. Subtype dependent. More...
 
virtual void joinOR (base_t AssumedValue, base_t KnownValue)=0
 Handle a value Value. Subtype dependent. More...
 
virtual void joinAND (base_t AssumedValue, base_t KnownValue)=0
 Handle a new assumed value Value. Subtype dependent. More...
 

Protected Attributes

base_t Known = getWorstState()
 The known state encoding in an integer of type base_t. More...
 
base_t Assumed = getBestState()
 The assumed state encoding in an integer of type base_t. More...
 

Detailed Description

template<typename base_ty, base_ty BestState, base_ty WorstState>
struct llvm::IntegerStateBase< base_ty, BestState, WorstState >

Simple state with integers encoding.

The interface ensures that the assumed bits are always a subset of the known bits. Users can only add known bits and, except through adding known bits, they can only remove assumed bits. This should guarantee monotoniticy and thereby the existence of a fixpoint (if used corretly). The fixpoint is reached when the assumed and known state/bits are equal. Users can force/inidicate a fixpoint. If an optimistic one is indicated, the known state will catch up with the assumed one, for a pessimistic fixpoint it is the other way around.

Definition at line 2114 of file Attributor.h.

Member Typedef Documentation

◆ base_t

template<typename base_ty , base_ty BestState, base_ty WorstState>
using llvm::IntegerStateBase< base_ty, BestState, WorstState >::base_t = base_ty

Definition at line 2115 of file Attributor.h.

Constructor & Destructor Documentation

◆ IntegerStateBase() [1/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
llvm::IntegerStateBase< base_ty, BestState, WorstState >::IntegerStateBase ( )
inline

Definition at line 2117 of file Attributor.h.

◆ IntegerStateBase() [2/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
llvm::IntegerStateBase< base_ty, BestState, WorstState >::IntegerStateBase ( base_t  Assumed)
inline

Definition at line 2118 of file Attributor.h.

Member Function Documentation

◆ getAssumed()

template<typename base_ty , base_ty BestState, base_ty WorstState>
base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getAssumed ( ) const
inline

◆ getBestState() [1/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
static constexpr base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getBestState ( )
inlinestaticconstexpr

Return the best possible representable state.

Definition at line 2121 of file Attributor.h.

Referenced by llvm::IntegerStateBase< uint8_t, BestState, WorstState >::getBestState().

◆ getBestState() [2/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
static constexpr base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getBestState ( const IntegerStateBase< base_ty, BestState, WorstState > &  )
inlinestaticconstexpr

Definition at line 2122 of file Attributor.h.

◆ getKnown()

template<typename base_ty , base_ty BestState, base_ty WorstState>
base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getKnown ( ) const
inline

◆ getWorstState() [1/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
static constexpr base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getWorstState ( )
inlinestaticconstexpr

◆ getWorstState() [2/2]

template<typename base_ty , base_ty BestState, base_ty WorstState>
static constexpr base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::getWorstState ( const IntegerStateBase< base_ty, BestState, WorstState > &  )
inlinestaticconstexpr

Definition at line 2128 of file Attributor.h.

◆ handleNewAssumedValue()

template<typename base_ty , base_ty BestState, base_ty WorstState>
virtual void llvm::IntegerStateBase< base_ty, BestState, WorstState >::handleNewAssumedValue ( base_t  Value)
protectedpure virtual

Handle a new assumed value Value. Subtype dependent.

Referenced by llvm::IntegerStateBase< uint8_t, BestState, WorstState >::operator^=().

◆ handleNewKnownValue()

template<typename base_ty , base_ty BestState, base_ty WorstState>
virtual void llvm::IntegerStateBase< base_ty, BestState, WorstState >::handleNewKnownValue ( base_t  Value)
protectedpure virtual

Handle a new known value Value. Subtype dependent.

Referenced by llvm::IntegerStateBase< uint8_t, BestState, WorstState >::operator+=().

◆ indicateOptimisticFixpoint()

template<typename base_ty , base_ty BestState, base_ty WorstState>
ChangeStatus llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicateOptimisticFixpoint ( )
inlineoverridevirtual

See AbstractState::indicateOptimisticFixpoint(...)

Implements llvm::AbstractState.

Definition at line 2140 of file Attributor.h.

Referenced by llvm::ValueSimplifyStateType::indicateOptimisticFixpoint(), and llvm::PotentialValuesState< MemberTy, KeyInfo >::indicateOptimisticFixpoint().

◆ indicatePessimisticFixpoint()

template<typename base_ty , base_ty BestState, base_ty WorstState>
ChangeStatus llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicatePessimisticFixpoint ( )
inlineoverridevirtual

See AbstractState::indicatePessimisticFixpoint(...)

Implements llvm::AbstractState.

Definition at line 2146 of file Attributor.h.

Referenced by llvm::ValueSimplifyStateType::indicatePessimisticFixpoint(), and llvm::PotentialValuesState< MemberTy, KeyInfo >::indicatePessimisticFixpoint().

◆ isAtFixpoint()

template<typename base_ty , base_ty BestState, base_ty WorstState>
bool llvm::IntegerStateBase< base_ty, BestState, WorstState >::isAtFixpoint ( ) const
inlineoverridevirtual

◆ isValidState()

template<typename base_ty , base_ty BestState, base_ty WorstState>
bool llvm::IntegerStateBase< base_ty, BestState, WorstState >::isValidState ( ) const
inlineoverridevirtual

See AbstractState::isValidState() NOTE: For now we simply pretend that the worst possible state is invalid.

Implements llvm::AbstractState.

Definition at line 2134 of file Attributor.h.

Referenced by llvm::ValueSimplifyStateType::isValidState(), and llvm::PotentialValuesState< MemberTy, KeyInfo >::isValidState().

◆ joinAND()

template<typename base_ty , base_ty BestState, base_ty WorstState>
virtual void llvm::IntegerStateBase< base_ty, BestState, WorstState >::joinAND ( base_t  AssumedValue,
base_t  KnownValue 
)
protectedpure virtual

Handle a new assumed value Value. Subtype dependent.

Referenced by llvm::IntegerStateBase< uint8_t, BestState, WorstState >::operator&=().

◆ joinOR()

template<typename base_ty , base_ty BestState, base_ty WorstState>
virtual void llvm::IntegerStateBase< base_ty, BestState, WorstState >::joinOR ( base_t  AssumedValue,
base_t  KnownValue 
)
protectedpure virtual

Handle a value Value. Subtype dependent.

Referenced by llvm::IntegerStateBase< uint8_t, BestState, WorstState >::operator|=().

◆ operator!=()

template<typename base_ty , base_ty BestState, base_ty WorstState>
bool llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator!= ( const IntegerStateBase< base_t, BestState, WorstState > &  R) const
inline

Inequality for IntegerStateBase.

Definition at line 2166 of file Attributor.h.

◆ operator&=()

template<typename base_ty , base_ty BestState, base_ty WorstState>
void llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator&= ( const IntegerStateBase< base_t, BestState, WorstState > &  R)
inline

Definition at line 2188 of file Attributor.h.

◆ operator+=()

template<typename base_ty , base_ty BestState, base_ty WorstState>
void llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator+= ( const IntegerStateBase< base_t, BestState, WorstState > &  R)
inline

"Clamp" this state with R.

The result is subtype dependent but it is intended that information known in either state will be known in this one afterwards.

Definition at line 2180 of file Attributor.h.

◆ operator==()

template<typename base_ty , base_ty BestState, base_ty WorstState>
bool llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator== ( const IntegerStateBase< base_t, BestState, WorstState > &  R) const
inline

Equality for IntegerStateBase.

Definition at line 2159 of file Attributor.h.

◆ operator^=()

template<typename base_ty , base_ty BestState, base_ty WorstState>
void llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator^= ( const IntegerStateBase< base_t, BestState, WorstState > &  R)
inline

"Clamp" this state with R.

The result is subtype dependent but it is intended that only information assumed in both states will be assumed in this one afterwards.

Definition at line 2173 of file Attributor.h.

◆ operator|=()

template<typename base_ty , base_ty BestState, base_ty WorstState>
void llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator|= ( const IntegerStateBase< base_t, BestState, WorstState > &  R)
inline

Definition at line 2184 of file Attributor.h.

Member Data Documentation

◆ Assumed

template<typename base_ty , base_ty BestState, base_ty WorstState>
base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed = getBestState()
protected

◆ Known

template<typename base_ty , base_ty BestState, base_ty WorstState>
base_t llvm::IntegerStateBase< base_ty, BestState, WorstState >::Known = getWorstState()
protected

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