MLIR  19.0.0git
Public Types | Public Member Functions | List of all members
mlir::BufferViewFlowAnalysis Class Reference

A straight-forward alias analysis which ensures that all dependencies of all values will be determined. More...

#include "mlir/Dialect/Bufferization/Transforms/BufferViewFlowAnalysis.h"

Public Types

using ValueSetT = SmallPtrSet< Value, 16 >
 
using ValueMapT = llvm::DenseMap< Value, ValueSetT >
 

Public Member Functions

 BufferViewFlowAnalysis (Operation *op)
 Constructs a new alias analysis using the op provided. More...
 
ValueMapT::const_iterator find (Value value) const
 Find all immediate dependencies this value could potentially have. More...
 
ValueMapT::const_iterator begin () const
 Returns the begin iterator to iterate over all dependencies. More...
 
ValueMapT::const_iterator end () const
 Returns the end iterator that can be used in combination with find. More...
 
ValueSetT resolve (Value value) const
 Find all immediate and indirect views upon this value. More...
 
ValueSetT resolveReverse (Value value) const
 
void remove (const SetVector< Value > &aliasValues)
 Removes the given values from all alias sets. More...
 
void rename (Value from, Value to)
 Replaces all occurrences of 'from' in the internal datastructures with 'to'. More...
 
bool mayBeTerminalBuffer (Value value) const
 Returns "true" if the given value may be a terminal. More...
 

Detailed Description

A straight-forward alias analysis which ensures that all dependencies of all values will be determined.

This is a requirement for the BufferPlacement class since you need to determine safe positions to place alloc and deallocs. This alias analysis only finds aliases that might have been created on top of the specified view. To find all aliases, resolve the intial alloc/argument value.

Definition at line 23 of file BufferViewFlowAnalysis.h.

Member Typedef Documentation

◆ ValueMapT

Definition at line 26 of file BufferViewFlowAnalysis.h.

◆ ValueSetT

Definition at line 25 of file BufferViewFlowAnalysis.h.

Constructor & Destructor Documentation

◆ BufferViewFlowAnalysis()

BufferViewFlowAnalysis::BufferViewFlowAnalysis ( Operation op)

Constructs a new alias analysis using the op provided.

Definition at line 27 of file BufferViewFlowAnalysis.cpp.

Member Function Documentation

◆ begin()

ValueMapT::const_iterator mlir::BufferViewFlowAnalysis::begin ( ) const
inline

Returns the begin iterator to iterate over all dependencies.

Definition at line 37 of file BufferViewFlowAnalysis.h.

◆ end()

ValueMapT::const_iterator mlir::BufferViewFlowAnalysis::end ( ) const
inline

Returns the end iterator that can be used in combination with find.

Definition at line 40 of file BufferViewFlowAnalysis.h.

◆ find()

ValueMapT::const_iterator mlir::BufferViewFlowAnalysis::find ( Value  value) const
inline

Find all immediate dependencies this value could potentially have.

Definition at line 32 of file BufferViewFlowAnalysis.h.

◆ mayBeTerminalBuffer()

bool BufferViewFlowAnalysis::mayBeTerminalBuffer ( Value  value) const

Returns "true" if the given value may be a terminal.

Definition at line 203 of file BufferViewFlowAnalysis.cpp.

References mlir::Value::getType().

Referenced by mlir::BufferOriginAnalysis::isSameAllocation().

◆ remove()

void BufferViewFlowAnalysis::remove ( const SetVector< Value > &  aliasValues)

Removes the given values from all alias sets.

Definition at line 61 of file BufferViewFlowAnalysis.cpp.

◆ rename()

void BufferViewFlowAnalysis::rename ( Value  from,
Value  to 
)

Replaces all occurrences of 'from' in the internal datastructures with 'to'.

This is useful when the defining operation of a value has to be re-built because additional results have to be added or the types of results have to be changed.

Definition at line 66 of file BufferViewFlowAnalysis.cpp.

◆ resolve()

BufferViewFlowAnalysis::ValueSetT BufferViewFlowAnalysis::resolve ( Value  rootValue) const

Find all immediate and indirect views upon this value.

Find all immediate and indirect dependent buffers this value could potentially have.

This will find all dependencies on this value that can potentially be later in the execution of the program, but will not return values that this alias might have been created from (such as if the value is created by a subview, this will not return the parent view if there is no cyclic behavior). Note that the resulting set will also contain the value provided as it is an alias of itself.

A = * B = subview(A) C = B

Results in resolve(B) returning {B, C}

Note that the resulting set will also contain the value provided as it is a dependent alias of itself.

Definition at line 51 of file BufferViewFlowAnalysis.cpp.

References resolveValues().

Referenced by hasAllocationScope().

◆ resolveReverse()

BufferViewFlowAnalysis::ValueSetT BufferViewFlowAnalysis::resolveReverse ( Value  value) const

Definition at line 56 of file BufferViewFlowAnalysis.cpp.

References resolveValues().

Referenced by mlir::BufferOriginAnalysis::isSameAllocation().


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