Jlm
Public Member Functions | Private Attributes | List of all members
jlm::llvm::aa::DifferencePropagation Class Reference

#include <DifferencePropagation.hpp>

Collaboration diagram for jlm::llvm::aa::DifferencePropagation:
Collaboration graph
[legend]

Public Member Functions

 DifferencePropagation (PointerObjectSet &set)
 
void Initialize ()
 
bool IsInitialized () const noexcept
 
void ClearNewPointees (PointerObjectIndex index)
 
bool AddToPointsToSet (PointerObjectIndex pointer, PointerObjectIndex pointee)
 
bool MakePointsToSetSuperset (PointerObjectIndex superset, PointerObjectIndex subset)
 
const util::HashSet< PointerObjectIndex > & GetNewPointees (PointerObjectIndex index) const
 
void OnRemoveAllPointees (PointerObjectIndex index)
 
bool PointsToExternalIsNew (PointerObjectIndex index)
 
void MarkPointsToExternalAsHandled (PointerObjectIndex index)
 
bool PointeesEscapeIsNew (PointerObjectIndex index)
 
void MarkPointeesEscapeAsHandled (PointerObjectIndex index)
 
void OnPointerObjectsUnified (PointerObjectIndex root, PointerObjectIndex nonRoot)
 

Private Attributes

PointerObjectSetSet_
 
std::vector< util::HashSet< PointerObjectIndex > > NewPointees_
 
std::vector< bool > NewPointeesTracked_
 
std::vector< bool > PointsToExternalFlagSeen_
 
std::vector< bool > PointeesEscapeFlagSeen_
 

Detailed Description

Definition at line 16 of file DifferencePropagation.hpp.

Constructor & Destructor Documentation

◆ DifferencePropagation()

jlm::llvm::aa::DifferencePropagation::DifferencePropagation ( PointerObjectSet set)
inlineexplicit

Definition at line 20 of file DifferencePropagation.hpp.

Member Function Documentation

◆ AddToPointsToSet()

bool jlm::llvm::aa::DifferencePropagation::AddToPointsToSet ( PointerObjectIndex  pointer,
PointerObjectIndex  pointee 
)
inline

Makes P(pointer) contain pointee

Parameters
pointerthe PointerObject which should contain pointee in its points-to set. Must be a unification root.
pointeethe PointerObject which should be pointed to by pointer
Returns
true if this operation added a new pointee to P(pointer)

Definition at line 64 of file DifferencePropagation.hpp.

◆ ClearNewPointees()

void jlm::llvm::aa::DifferencePropagation::ClearNewPointees ( PointerObjectIndex  index)
inline

Starts tracking any pointees added to index from this point onwards.

Parameters
indexthe index of the PointerObject, must be a unification root.

Definition at line 47 of file DifferencePropagation.hpp.

◆ GetNewPointees()

const util::HashSet<PointerObjectIndex>& jlm::llvm::aa::DifferencePropagation::GetNewPointees ( PointerObjectIndex  index) const
inline

Gets the pointees of a PointerObject that have been added since the last time ClearNewPointees(index) was called. If new pointees of index are not being tracked, all pointees are returned.

Parameters
indexthe index of the PointerObject, must be a unification root.
Returns
a reference to either all new pointees, or all pointees of index.

Definition at line 105 of file DifferencePropagation.hpp.

◆ Initialize()

void jlm::llvm::aa::DifferencePropagation::Initialize ( )
inline

Must be called before using any other methods.

Definition at line 28 of file DifferencePropagation.hpp.

◆ IsInitialized()

bool jlm::llvm::aa::DifferencePropagation::IsInitialized ( ) const
inlinenoexcept

Definition at line 37 of file DifferencePropagation.hpp.

◆ MakePointsToSetSuperset()

bool jlm::llvm::aa::DifferencePropagation::MakePointsToSetSuperset ( PointerObjectIndex  superset,
PointerObjectIndex  subset 
)
inline

Makes P(superset) a superset of P(subset), and propagates the PointsToExternal flag if set.

Parameters
supersetthe PointerObject which should point to everything the subset points to Must be a unification root.
subseta PointerObject which should have all its pointees also be pointees of superset.
Returns
true if this operation adds any pointees or flags to superset.

Definition at line 85 of file DifferencePropagation.hpp.

◆ MarkPointeesEscapeAsHandled()

void jlm::llvm::aa::DifferencePropagation::MarkPointeesEscapeAsHandled ( PointerObjectIndex  index)
inline

Call once the addition of the new flag PointeesEscape has been handled. After this call, PointeesEscapeIsNew(index) will return false (unless new unifications).

Parameters
indexthe index of the PointerObject whose PointeesEscape flag has been handled. Must be a unification root.

Definition at line 182 of file DifferencePropagation.hpp.

◆ MarkPointsToExternalAsHandled()

void jlm::llvm::aa::DifferencePropagation::MarkPointsToExternalAsHandled ( PointerObjectIndex  index)
inline

Call once the addition of the new flag PointsToExternal has been handled. After this call, PointsToExternalIsNew(index) will return false (unless new unifications).

Parameters
indexthe index of the PointerObject whose PointsToExternal flag has been handled. Must be a unification root.

Definition at line 150 of file DifferencePropagation.hpp.

◆ OnPointerObjectsUnified()

void jlm::llvm::aa::DifferencePropagation::OnPointerObjectsUnified ( PointerObjectIndex  root,
PointerObjectIndex  nonRoot 
)
inline

Performs conservative clearing of tracked differences, after unification. The set of tracked pointees is fully cleared, since all pointees might be new to constraints previously owned by the opposite PointerObject.

If the worklist has seen the PointsToExternal and PointeesEscape flags on both operands, the flags will also be considered already seen for the resulting unification root.

Parameters
rootthe operand of the unification that ended up at the new root.
nonRootthe root of the other unification, that is now no longer a root.

Definition at line 201 of file DifferencePropagation.hpp.

◆ OnRemoveAllPointees()

void jlm::llvm::aa::DifferencePropagation::OnRemoveAllPointees ( PointerObjectIndex  index)
inline

Clears the tracked set of new pointees of index, and stops tracking it.

Parameters
indexthe index of the PointerObject, must be a unification root.

Definition at line 119 of file DifferencePropagation.hpp.

◆ PointeesEscapeIsNew()

bool jlm::llvm::aa::DifferencePropagation::PointeesEscapeIsNew ( PointerObjectIndex  index)
inline

If the given PointerObject has the PointeesEscape flag now, but didn't have it the last time ClearDifferenceTracking(index) was called, return true. An exception is if the PointerObject has been unified with other PointerObjects, and some of the other PointerObjects had not have that flag seen.

Parameters
indexthe index of the PointerObject being queried. Must be a unification root
Returns
true if the PointerObject is newly flagged as AllPointeesEscape.

Definition at line 166 of file DifferencePropagation.hpp.

◆ PointsToExternalIsNew()

bool jlm::llvm::aa::DifferencePropagation::PointsToExternalIsNew ( PointerObjectIndex  index)
inline

If the given PointerObject has the PointsToExternal flag now, and MarkPointsToExternalAsHandled(index) has not been called, return true. Otherwise false. An exception is if the PointerObject has been unified with other PointerObjects, and some of the other PointerObjects did not have that flag handled already.

Parameters
indexthe index of the PointerObject being queried. Must be a unification root
Returns
true if the PointerObject is newly flagged as PointsToExternal.

Definition at line 134 of file DifferencePropagation.hpp.

Member Data Documentation

◆ NewPointees_

std::vector<util::HashSet<PointerObjectIndex> > jlm::llvm::aa::DifferencePropagation::NewPointees_
private

Definition at line 223 of file DifferencePropagation.hpp.

◆ NewPointeesTracked_

std::vector<bool> jlm::llvm::aa::DifferencePropagation::NewPointeesTracked_
private

Definition at line 226 of file DifferencePropagation.hpp.

◆ PointeesEscapeFlagSeen_

std::vector<bool> jlm::llvm::aa::DifferencePropagation::PointeesEscapeFlagSeen_
private

Definition at line 232 of file DifferencePropagation.hpp.

◆ PointsToExternalFlagSeen_

std::vector<bool> jlm::llvm::aa::DifferencePropagation::PointsToExternalFlagSeen_
private

Definition at line 231 of file DifferencePropagation.hpp.

◆ Set_

PointerObjectSet& jlm::llvm::aa::DifferencePropagation::Set_
private

Definition at line 217 of file DifferencePropagation.hpp.


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