CIRCT 24.0.0git
Loading...
Searching...
No Matches
DiscoverLoops Class Reference
Collaboration diagram for DiscoverLoops:

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 processInstancePorts (FModuleOp refMod, ValueRange instResults)
void handleInstanceOp (InstanceOp inst)
void handleInstanceChoiceOp (InstanceChoiceOp inst)
void recordValueRefersToFieldRef (Value base, unsigned fieldID, Value result)
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
 Adjacency list representation.

Private Attributes

FModuleOp module
InstanceGraph & instanceGraph
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.
const DenseMap< FModuleLike, DrivenBysMapType > & modulePortPaths
 Comb paths that exist between module ports.
DrivenBysMapType & portPaths
 The comb paths between the ports of this module.
DrivenByGraphType drivenBy
 This is an adjacency list representation of the connectivity graph.
DenseMap< FieldRef, size_t > nodes
 Map of FieldRef to its corresponding graph node.
DenseMap< unsigned, unsigned > rwProbeRefersTo
 The base value that the RWProbe refers to.
llvm::EquivalenceClasses< unsigned > rwProbeClasses
 An eqv class of all the RWProbes that refer to the same base value.

Detailed Description

Definition at line 58 of file CheckCombLoops.cpp.

Member Typedef Documentation

◆ DrivenByGraphType

Initial value:
SmallVector<std::pair<FieldRef, SmallVector<unsigned>>, 64>

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 66 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 70 of file CheckCombLoops.cpp.

References instanceGraph, module, modulePortPaths, and portPaths.

Member Function Documentation

◆ addDrivenBy()

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

Definition at line 216 of file CheckCombLoops.cpp.

References drivenBy, and getOrAddNode().

Referenced by constructConnectivityGraph(), processInstancePorts(), and recordDataflow().

◆ addToPortPathsIfRWProbe()

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

Definition at line 665 of file CheckCombLoops.cpp.

References drivenBy, getOrAddNode(), and rwProbeClasses.

Referenced by dfsTraverse().

◆ constructConnectivityGraph()

◆ dfsTraverse()

LogicalResult DiscoverLoops::dfsTraverse ( const DrivenByGraphType & graph)
inline

◆ dumpMap()

void DiscoverLoops::dumpMap ( )
inline

◆ getName()

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

Definition at line 190 of file CheckCombLoops.cpp.

References circt::firrtl::getFieldName().

Referenced by dfsTraverse(), dumpMap(), and reportLoopFound().

◆ getOrAddNode() [1/2]

unsigned DiscoverLoops::getOrAddNode ( FieldRef f)
inline

Definition at line 200 of file CheckCombLoops.cpp.

References drivenBy, and nodes.

◆ getOrAddNode() [2/2]

unsigned DiscoverLoops::getOrAddNode ( Value v)
inline

◆ handleInstanceChoiceOp()

void DiscoverLoops::handleInstanceChoiceOp ( InstanceChoiceOp inst)
inline

Definition at line 445 of file CheckCombLoops.cpp.

References instanceGraph, and processInstancePorts().

Referenced by constructConnectivityGraph().

◆ handleInstanceOp()

void DiscoverLoops::handleInstanceOp ( InstanceOp inst)
inline

Definition at line 434 of file CheckCombLoops.cpp.

References instanceGraph, and processInstancePorts().

Referenced by constructConnectivityGraph().

◆ handleRefForce()

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

◆ probesReferToSameData()

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

Definition at line 659 of file CheckCombLoops.cpp.

References getOrAddNode(), and rwProbeClasses.

Referenced by constructConnectivityGraph().

◆ processInstancePorts()

void DiscoverLoops::processInstancePorts ( FModuleOp refMod,
ValueRange instResults )
inline

◆ processModule()

LogicalResult DiscoverLoops::processModule ( )
inline

◆ recordDataflow()

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

◆ recordProbe()

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

◆ recordValueRefersToFieldRef()

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

Definition at line 461 of file CheckCombLoops.cpp.

References valToFieldRefs.

Referenced by constructConnectivityGraph().

◆ reportLoopFound()

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

Definition at line 567 of file CheckCombLoops.cpp.

References getName(), and module.

Referenced by dfsTraverse().

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 706 of file CheckCombLoops.cpp.

Referenced by addDrivenBy(), addToPortPathsIfRWProbe(), dfsTraverse(), dumpMap(), getOrAddNode(), handleRefForce(), processInstancePorts(), and processModule().

◆ instanceGraph

InstanceGraph& DiscoverLoops::instanceGraph
private

Definition at line 689 of file CheckCombLoops.cpp.

Referenced by DiscoverLoops(), handleInstanceChoiceOp(), and handleInstanceOp().

◆ 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 696 of file CheckCombLoops.cpp.

Referenced by DiscoverLoops(), and processInstancePorts().

◆ nodes

DenseMap<FieldRef, size_t> DiscoverLoops::nodes
private

Map of FieldRef to its corresponding graph node.

Definition at line 708 of file CheckCombLoops.cpp.

Referenced by getOrAddNode().

◆ 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 700 of file CheckCombLoops.cpp.

Referenced by dfsTraverse(), DiscoverLoops(), and dumpMap().

◆ rwProbeClasses

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

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

Definition at line 715 of file CheckCombLoops.cpp.

Referenced by addToPortPathsIfRWProbe(), dumpMap(), handleRefForce(), probesReferToSameData(), processInstancePorts(), and recordProbe().

◆ 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 712 of file CheckCombLoops.cpp.

Referenced by dumpMap(), handleRefForce(), processInstancePorts(), and recordProbe().

◆ 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 693 of file CheckCombLoops.cpp.

Referenced by dumpMap(), getOrAddNode(), recordDataflow(), and recordValueRefersToFieldRef().


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