CIRCT  19.0.0git
Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
DiscoverLoops Class Reference
Collaboration diagram for DiscoverLoops:
Collaboration graph
[legend]

Public Member Functions

 DiscoverLoops (FModuleOp module, InstanceGraph &instanceGraph, const DenseMap< FModuleLike, DrivenBysMapType > &otherModulePortPaths, DrivenBysMapType &thisModulePortPaths)
 
LogicalResult processModule ()
 
void constructConnectivityGraph (FModuleOp module)
 
unsigned getOrAddNode (Value v)
 
unsigned getOrAddNode (FieldRef f)
 
void addDrivenBy (FieldRef dst, FieldRef src)
 
void recordDataflow (Value dstVal, Value srcVal)
 
void handleRefForce (Value dstProbe, Value srcVal)
 
void handleInstanceOp (InstanceOp inst)
 
void recordValueRefersToFieldRef (Value base, unsigned fieldID, Value result)
 
void handleMemory (MemOp mem)
 
LogicalResult dfsTraverse (const DrivenByGraphType &graph)
 
void reportLoopFound (SmallVectorImpl< FieldRef > &path, Location loc)
 
void dumpMap ()
 
void recordProbe (Value data, Value ref)
 
void probesReferToSameData (Value probe1, Value probe2)
 
void addToPortPathsIfRWProbe (unsigned srcNode, DenseSet< FieldRef > &inputPortPaths)
 

Static Public Member Functions

static std::string getName (FieldRef v)
 

Private Types

using DrivenByGraphType = SmallVector< std::pair< FieldRef, SmallVector< unsigned > >, 64 >
 Adjacency list representation. More...
 

Private Attributes

FModuleOp module
 
InstanceGraphinstanceGraph
 
DenseMap< Value, SmallVector< FieldRef > > valToFieldRefs
 Map of values to the set of all FieldRefs (same base) that this may be directly derived from through indexing operations. More...
 
const DenseMap< FModuleLike, DrivenBysMapType > & modulePortPaths
 Comb paths that exist between module ports. More...
 
DrivenBysMapTypeportPaths
 The comb paths between the ports of this module. More...
 
DrivenByGraphType drivenBy
 This is an adjacency list representation of the connectivity graph. More...
 
DenseMap< FieldRef, size_t > nodes
 Map of FieldRef to its corresponding graph node. More...
 
DenseMap< unsigned, unsigned > rwProbeRefersTo
 The base value that the RWProbe refers to. More...
 
llvm::EquivalenceClasses< unsigned > rwProbeClasses
 An eqv class of all the RWProbes that refer to the same base value. More...
 

Detailed Description

Definition at line 51 of file CheckCombLoops.cpp.

Member Typedef Documentation

◆ DrivenByGraphType

using DiscoverLoops::DrivenByGraphType = SmallVector<std::pair<FieldRef, SmallVector<unsigned> >, 64>
private

Adjacency list representation.

Each entry is a pair, the first element is the FieldRef corresponding to the graph vertex. The second element is the list of vertices, that have an edge to this vertex. The directed edges represent a connectivity relation, of a source that drives the sink.

Definition at line 59 of file CheckCombLoops.cpp.

Constructor & Destructor Documentation

◆ DiscoverLoops()

DiscoverLoops::DiscoverLoops ( FModuleOp  module,
InstanceGraph instanceGraph,
const DenseMap< FModuleLike, DrivenBysMapType > &  otherModulePortPaths,
DrivenBysMapType thisModulePortPaths 
)
inline

Definition at line 63 of file CheckCombLoops.cpp.

Member Function Documentation

◆ addDrivenBy()

void DiscoverLoops::addDrivenBy ( FieldRef  dst,
FieldRef  src 
)
inline

Definition at line 225 of file CheckCombLoops.cpp.

◆ addToPortPathsIfRWProbe()

void DiscoverLoops::addToPortPathsIfRWProbe ( unsigned  srcNode,
DenseSet< FieldRef > &  inputPortPaths 
)
inline

Definition at line 672 of file CheckCombLoops.cpp.

◆ constructConnectivityGraph()

void DiscoverLoops::constructConnectivityGraph ( FModuleOp  module)
inline

◆ dfsTraverse()

LogicalResult DiscoverLoops::dfsTraverse ( const DrivenByGraphType graph)
inline

◆ dumpMap()

void DiscoverLoops::dumpMap ( )
inline

Definition at line 615 of file CheckCombLoops.cpp.

References circt::hw::instance_like_impl::getName().

◆ getName()

static std::string DiscoverLoops::getName ( FieldRef  v)
inlinestatic

Definition at line 199 of file CheckCombLoops.cpp.

References circt::firrtl::getFieldName().

◆ getOrAddNode() [1/2]

unsigned DiscoverLoops::getOrAddNode ( FieldRef  f)
inline

Definition at line 209 of file CheckCombLoops.cpp.

◆ getOrAddNode() [2/2]

unsigned DiscoverLoops::getOrAddNode ( Value  v)
inline

Definition at line 201 of file CheckCombLoops.cpp.

◆ handleInstanceOp()

void DiscoverLoops::handleInstanceOp ( InstanceOp  inst)
inline

Definition at line 345 of file CheckCombLoops.cpp.

◆ handleMemory()

void DiscoverLoops::handleMemory ( MemOp  mem)
inline

Definition at line 471 of file CheckCombLoops.cpp.

References circt::firrtl::addr, circt::firrtl::data, and circt::firrtl::en.

◆ handleRefForce()

void DiscoverLoops::handleRefForce ( Value  dstProbe,
Value  srcVal 
)
inline

Definition at line 322 of file CheckCombLoops.cpp.

References assert().

◆ probesReferToSameData()

void DiscoverLoops::probesReferToSameData ( Value  probe1,
Value  probe2 
)
inline

Definition at line 666 of file CheckCombLoops.cpp.

◆ processModule()

LogicalResult DiscoverLoops::processModule ( )
inline

Definition at line 70 of file CheckCombLoops.cpp.

Referenced by CheckCombLoopsPass::runOnOperation().

◆ recordDataflow()

void DiscoverLoops::recordDataflow ( Value  dstVal,
Value  srcVal 
)
inline

◆ recordProbe()

void DiscoverLoops::recordProbe ( Value  data,
Value  ref 
)
inline

Definition at line 658 of file CheckCombLoops.cpp.

References circt::firrtl::data.

◆ recordValueRefersToFieldRef()

void DiscoverLoops::recordValueRefersToFieldRef ( Value  base,
unsigned  fieldID,
Value  result 
)
inline

Definition at line 449 of file CheckCombLoops.cpp.

◆ reportLoopFound()

void DiscoverLoops::reportLoopFound ( SmallVectorImpl< FieldRef > &  path,
Location  loc 
)
inline

Definition at line 572 of file CheckCombLoops.cpp.

References circt::hw::instance_like_impl::getName().

Member Data Documentation

◆ drivenBy

DrivenByGraphType DiscoverLoops::drivenBy
private

This is an adjacency list representation of the connectivity graph.

This can be indexed by the graph node id, and each entry is the list of graph nodes that has an edge to it. Each graph node represents a FieldRef and each edge represents a source that directly drives the sink node.

Definition at line 716 of file CheckCombLoops.cpp.

◆ instanceGraph

InstanceGraph& DiscoverLoops::instanceGraph
private

Definition at line 699 of file CheckCombLoops.cpp.

◆ module

FModuleOp DiscoverLoops::module
private

◆ modulePortPaths

const DenseMap<FModuleLike, DrivenBysMapType>& DiscoverLoops::modulePortPaths
private

Comb paths that exist between module ports.

This is maintained across modules.

Definition at line 706 of file CheckCombLoops.cpp.

◆ nodes

DenseMap<FieldRef, size_t> DiscoverLoops::nodes
private

Map of FieldRef to its corresponding graph node.

Definition at line 718 of file CheckCombLoops.cpp.

◆ portPaths

DrivenBysMapType& DiscoverLoops::portPaths
private

The comb paths between the ports of this module.

This is the final output of this intra-procedural analysis, that is used to construct the inter-procedural dataflow.

Definition at line 710 of file CheckCombLoops.cpp.

◆ rwProbeClasses

llvm::EquivalenceClasses<unsigned> DiscoverLoops::rwProbeClasses
private

An eqv class of all the RWProbes that refer to the same base value.

Definition at line 725 of file CheckCombLoops.cpp.

◆ rwProbeRefersTo

DenseMap<unsigned, unsigned> DiscoverLoops::rwProbeRefersTo
private

The base value that the RWProbe refers to.

Used to add an edge to the base value, when the probe is forced.

Definition at line 722 of file CheckCombLoops.cpp.

◆ valToFieldRefs

DenseMap<Value, SmallVector<FieldRef> > DiscoverLoops::valToFieldRefs
private

Map of values to the set of all FieldRefs (same base) that this may be directly derived from through indexing operations.

Definition at line 703 of file CheckCombLoops.cpp.


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