LLVM 17.0.0git
|
Simple state with integers encoding. More...
#include "llvm/Transforms/IPO/Attributor.h"
Public Types | |
using | base_t = base_ty |
Public Member Functions | |
IntegerStateBase ()=default | |
IntegerStateBase (base_t Assumed) | |
bool | isValidState () const override |
See AbstractState::isValidState() NOTE: For now we simply pretend that the worst possible state is invalid. | |
bool | isAtFixpoint () const override |
See AbstractState::isAtFixpoint() | |
ChangeStatus | indicateOptimisticFixpoint () override |
See AbstractState::indicateOptimisticFixpoint(...) | |
ChangeStatus | indicatePessimisticFixpoint () override |
See AbstractState::indicatePessimisticFixpoint(...) | |
base_t | getKnown () const |
Return the known state encoding. | |
base_t | getAssumed () const |
Return the assumed state encoding. | |
bool | operator== (const IntegerStateBase< base_t, BestState, WorstState > &R) const |
Equality for IntegerStateBase. | |
bool | operator!= (const IntegerStateBase< base_t, BestState, WorstState > &R) const |
Inequality for IntegerStateBase. | |
void | operator^= (const IntegerStateBase< base_t, BestState, WorstState > &R) |
"Clamp" this state with R . | |
void | operator+= (const IntegerStateBase< base_t, BestState, WorstState > &R) |
"Clamp" this state with R . | |
void | operator|= (const IntegerStateBase< base_t, BestState, WorstState > &R) |
void | operator&= (const IntegerStateBase< base_t, BestState, WorstState > &R) |
![]() | |
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 constexpr base_t | getBestState () |
Return the best possible representable state. | |
static constexpr base_t | getBestState (const IntegerStateBase &) |
static constexpr base_t | getWorstState () |
Return the worst possible representable state. | |
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. | |
virtual void | handleNewKnownValue (base_t Value)=0 |
Handle a new known value Value . Subtype dependent. | |
virtual void | joinOR (base_t AssumedValue, base_t KnownValue)=0 |
Handle a value Value . Subtype dependent. | |
virtual void | joinAND (base_t AssumedValue, base_t KnownValue)=0 |
Handle a new assumed value Value . Subtype dependent. | |
Protected Attributes | |
base_t | Known = getWorstState() |
The known state encoding in an integer of type base_t. | |
base_t | Assumed = getBestState() |
The assumed state encoding in an integer of type base_t. | |
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 2464 of file Attributor.h.
using llvm::IntegerStateBase< base_ty, BestState, WorstState >::base_t = base_ty |
Definition at line 2465 of file Attributor.h.
|
default |
|
inline |
Definition at line 2468 of file Attributor.h.
|
inline |
Return the assumed state encoding.
Definition at line 2505 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed.
Referenced by llvm::AAAlign::getAssumedAlign(), llvm::AADereferenceable::getAssumedDereferenceableBytes(), llvm::AAMemoryLocation::getAssumedNotAccessedLocation(), llvm::AADereferenceable::isAssumedGlobal(), llvm::operator<<(), and llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator==().
|
inlinestaticconstexpr |
Return the best possible representable state.
Definition at line 2471 of file Attributor.h.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::getBestState().
|
inlinestaticconstexpr |
Definition at line 2472 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::getBestState().
|
inline |
Return the known state encoding.
Definition at line 2502 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Known.
Referenced by llvm::AAAlign::getKnownAlign(), llvm::AADereferenceable::getKnownDereferenceableBytes(), llvm::AADereferenceable::isKnownGlobal(), llvm::operator<<(), and llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator==().
|
inlinestaticconstexpr |
Return the worst possible representable state.
Definition at line 2477 of file Attributor.h.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::getWorstState(), and llvm::IntegerStateBase< base_ty, BestState, WorstState >::isValidState().
|
inlinestaticconstexpr |
Definition at line 2478 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::getWorstState().
|
protectedpure virtual |
Handle a new assumed value Value
. Subtype dependent.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator^=().
|
protectedpure virtual |
Handle a new known value Value
. Subtype dependent.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator+=().
|
inlineoverridevirtual |
See AbstractState::indicateOptimisticFixpoint(...)
Implements llvm::AbstractState.
Definition at line 2490 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed, llvm::IntegerStateBase< base_ty, BestState, WorstState >::Known, and llvm::UNCHANGED.
Referenced by llvm::ValueSimplifyStateType::indicateOptimisticFixpoint(), llvm::PotentialValuesState< MemberTy >::indicateOptimisticFixpoint(), and llvm::AA::PointerInfo::State::indicateOptimisticFixpoint().
|
inlineoverridevirtual |
See AbstractState::indicatePessimisticFixpoint(...)
Implements llvm::AbstractState.
Definition at line 2496 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed, llvm::CHANGED, and llvm::IntegerStateBase< base_ty, BestState, WorstState >::Known.
Referenced by llvm::ValueSimplifyStateType::indicatePessimisticFixpoint(), llvm::PotentialValuesState< MemberTy >::indicatePessimisticFixpoint(), and llvm::AA::PointerInfo::State::indicatePessimisticFixpoint().
|
inlineoverridevirtual |
See AbstractState::isAtFixpoint()
Implements llvm::AbstractState.
Definition at line 2487 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed, and llvm::IntegerStateBase< base_ty, BestState, WorstState >::Known.
Referenced by llvm::ValueSimplifyStateType::isAtFixpoint(), llvm::PotentialValuesState< MemberTy >::isAtFixpoint(), and llvm::AA::PointerInfo::State::isAtFixpoint().
|
inlineoverridevirtual |
See AbstractState::isValidState() NOTE: For now we simply pretend that the worst possible state is invalid.
Implements llvm::AbstractState.
Definition at line 2484 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::Assumed, and llvm::IntegerStateBase< base_ty, BestState, WorstState >::getWorstState().
Referenced by llvm::ValueSimplifyStateType::isValidState(), llvm::PotentialValuesState< MemberTy >::isValidState(), and llvm::AA::PointerInfo::State::isValidState().
|
protectedpure virtual |
Handle a new assumed value Value
. Subtype dependent.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator&=().
|
protectedpure virtual |
Handle a value Value
. Subtype dependent.
Referenced by llvm::IntegerStateBase< base_ty, BestState, WorstState >::operator|=().
|
inline |
Inequality for IntegerStateBase.
Definition at line 2516 of file Attributor.h.
|
inline |
Definition at line 2538 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::joinAND().
|
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 2530 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::handleNewKnownValue().
|
inline |
Equality for IntegerStateBase.
Definition at line 2509 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::getAssumed(), and llvm::IntegerStateBase< base_ty, BestState, WorstState >::getKnown().
|
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 2523 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::handleNewAssumedValue().
|
inline |
Definition at line 2534 of file Attributor.h.
References llvm::IntegerStateBase< base_ty, BestState, WorstState >::joinOR().
|
protected |
The assumed state encoding in an integer of type base_t.
Definition at line 2559 of file Attributor.h.
Referenced by llvm::BitIntegerState< base_ty, BestState, WorstState >::addKnownBits(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::getAssumed(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicateOptimisticFixpoint(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicatePessimisticFixpoint(), llvm::BitIntegerState< base_ty, BestState, WorstState >::intersectAssumedBits(), llvm::BitIntegerState< base_ty, BestState, WorstState >::isAssumed(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::isAtFixpoint(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::isValidState(), llvm::DecIntegerState< base_ty >::takeAssumedMaximum(), llvm::IncIntegerState< base_ty, BestState, WorstState >::takeAssumedMinimum(), llvm::IncIntegerState< base_ty, BestState, WorstState >::takeKnownMaximum(), and llvm::DecIntegerState< base_ty >::takeKnownMinimum().
|
protected |
The known state encoding in an integer of type base_t.
Definition at line 2556 of file Attributor.h.
Referenced by llvm::BitIntegerState< base_ty, BestState, WorstState >::addKnownBits(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::getKnown(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicateOptimisticFixpoint(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::indicatePessimisticFixpoint(), llvm::BitIntegerState< base_ty, BestState, WorstState >::intersectAssumedBits(), llvm::IntegerStateBase< base_ty, BestState, WorstState >::isAtFixpoint(), llvm::BitIntegerState< base_ty, BestState, WorstState >::isKnown(), llvm::BitIntegerState< base_ty, BestState, WorstState >::removeKnownBits(), llvm::DecIntegerState< base_ty >::takeAssumedMaximum(), llvm::IncIntegerState< base_ty, BestState, WorstState >::takeAssumedMinimum(), llvm::IncIntegerState< base_ty, BestState, WorstState >::takeKnownMaximum(), and llvm::DecIntegerState< base_ty >::takeKnownMinimum().