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

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
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...
 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>

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 

Definition at line 63 of file CheckCombLoops.cpp.

Member Function Documentation

◆ addDrivenBy()

void DiscoverLoops::addDrivenBy ( FieldRef  dst,
FieldRef  src 

Definition at line 225 of file CheckCombLoops.cpp.

◆ addToPortPathsIfRWProbe()

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

Definition at line 665 of file CheckCombLoops.cpp.

◆ constructConnectivityGraph()

void DiscoverLoops::constructConnectivityGraph ( FModuleOp  module)

◆ dfsTraverse()

LogicalResult DiscoverLoops::dfsTraverse ( const DrivenByGraphType graph)

◆ dumpMap()

void DiscoverLoops::dumpMap ( )

Definition at line 608 of file CheckCombLoops.cpp.

References lec::dbgs(), and circt::hw::instance_like_impl::getName().

◆ getName()

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

Definition at line 199 of file CheckCombLoops.cpp.

References circt::firrtl::getFieldName().

◆ getOrAddNode() [1/2]

unsigned DiscoverLoops::getOrAddNode ( FieldRef  f)

Definition at line 209 of file CheckCombLoops.cpp.

◆ getOrAddNode() [2/2]

unsigned DiscoverLoops::getOrAddNode ( Value  v)

Definition at line 201 of file CheckCombLoops.cpp.

◆ handleInstanceOp()

void DiscoverLoops::handleInstanceOp ( InstanceOp  inst)

Definition at line 338 of file CheckCombLoops.cpp.

◆ handleMemory()

void DiscoverLoops::handleMemory ( MemOp  mem)

Definition at line 464 of file CheckCombLoops.cpp.

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

◆ handleRefForce()

void DiscoverLoops::handleRefForce ( Value  dstProbe,
Value  srcVal 

Definition at line 322 of file CheckCombLoops.cpp.

References assert().

◆ probesReferToSameData()

void DiscoverLoops::probesReferToSameData ( Value  probe1,
Value  probe2 

Definition at line 659 of file CheckCombLoops.cpp.

◆ processModule()

LogicalResult DiscoverLoops::processModule ( )

Definition at line 70 of file CheckCombLoops.cpp.

References lec::dbgs().

Referenced by CheckCombLoopsPass::runOnOperation().

◆ recordDataflow()

void DiscoverLoops::recordDataflow ( Value  dstVal,
Value  srcVal 

◆ recordProbe()

void DiscoverLoops::recordProbe ( Value  data,
Value  ref 

Definition at line 651 of file CheckCombLoops.cpp.

References circt::firrtl::data.

◆ recordValueRefersToFieldRef()

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

Definition at line 442 of file CheckCombLoops.cpp.

◆ reportLoopFound()

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

Definition at line 565 of file CheckCombLoops.cpp.

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

Member Data Documentation

◆ drivenBy

DrivenByGraphType DiscoverLoops::drivenBy

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

◆ instanceGraph

InstanceGraph& DiscoverLoops::instanceGraph

Definition at line 692 of file CheckCombLoops.cpp.

◆ module

FModuleOp DiscoverLoops::module

◆ modulePortPaths

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

Comb paths that exist between module ports.

This is maintained across modules.

Definition at line 699 of file CheckCombLoops.cpp.

◆ nodes

DenseMap<FieldRef, size_t> DiscoverLoops::nodes

Map of FieldRef to its corresponding graph node.

Definition at line 711 of file CheckCombLoops.cpp.

◆ portPaths

DrivenBysMapType& DiscoverLoops::portPaths

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

◆ rwProbeClasses

llvm::EquivalenceClasses<unsigned> DiscoverLoops::rwProbeClasses

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

Definition at line 718 of file CheckCombLoops.cpp.

◆ rwProbeRefersTo

DenseMap<unsigned, unsigned> DiscoverLoops::rwProbeRefersTo

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

◆ valToFieldRefs

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

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

Definition at line 696 of file CheckCombLoops.cpp.

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