CIRCT 23.0.0git
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
InferDomains.cpp File Reference
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Support/Debug.h"
#include "circt/Support/Namespace.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/Iterators.h"
#include "mlir/IR/Threading.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for InferDomains.cpp:

Go to the source code of this file.

Classes

struct  ModuleState::Render< T >
 
struct  ModuleState::RenderLong
 

Namespaces

namespace  circt
 The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
 
namespace  circt::firrtl
 

Macros

#define DEBUG_TYPE   "firrtl-infer-domains"
 
#define GEN_PASS_DEF_INFERDOMAINS
 

Typedefs

using DomainValue = mlir::TypedValue< DomainType >
 
using PortInsertions = SmallVector< std::pair< unsigned, PortInfo > >
 
using PendingSolutions = DenseMap< VariableTerm *, unsigned >
 A map from unsolved variables to a port index, where that port has not yet been created.
 
using PendingExports = llvm::MapVector< DomainValue, unsigned >
 A map from local domains to an aliasing port index, where that port has not yet been created.
 
using ExportTable = DenseMap< DomainValue, TinyPtrVector< DomainValue > >
 A map from domain IR values defined internal to the moduleOp, to ports that alias that domain.
 

Functions

static auto getPortDomainAssociation (ArrayAttr info, size_t i)
 From a domain info attribute, get the row of associated domains for a hardware value at index i.
 
static bool isPort (BlockArgument arg)
 Return true if the value is a port on the module.
 
static bool isPort (Value value)
 Return true if the value is a port on the module.
 
static bool isDriven (DomainValue port)
 Returns true if the value is driven by a connect op.
 
static bool isHardware (Type type)
 True if a value of the given type could be associated with a domain.
 
static bool isHardware (Value value)
 True if the given value could be association with a domain.
 
template<typename T >
static llvm::raw_ostream & operator<< (llvm::raw_ostream &out, ModuleState::Render< T > r)
 
static Diagnostic & operator<< (Diagnostic &diag, ModuleState::RenderLong r)
 
static LogicalResult stripModuleImpl (FModuleLike op, llvm::function_ref< bool(StringAttr)> shouldStripDomain)
 A helper for stripping domains from a module based on a predicate.
 
static LogicalResult stripDomainsFromCircuit (MLIRContext *context, CircuitOp circuit, llvm::function_ref< bool(StringAttr)> shouldStripDomain)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-infer-domains"

Definition at line 36 of file InferDomains.cpp.

◆ GEN_PASS_DEF_INFERDOMAINS

#define GEN_PASS_DEF_INFERDOMAINS

Definition at line 40 of file InferDomains.cpp.

Typedef Documentation

◆ DomainValue

using DomainValue = mlir::TypedValue<DomainType>

Definition at line 63 of file InferDomains.cpp.

◆ ExportTable

using ExportTable = DenseMap<DomainValue, TinyPtrVector<DomainValue> >

A map from domain IR values defined internal to the moduleOp, to ports that alias that domain.

These ports make the domain useable as associations of ports, and we say these are exporting ports.

Definition at line 275 of file InferDomains.cpp.

◆ PendingExports

A map from local domains to an aliasing port index, where that port has not yet been created.

Eventually we will be exporting the domain value at the port index.

Definition at line 262 of file InferDomains.cpp.

◆ PendingSolutions

using PendingSolutions = DenseMap<VariableTerm *, unsigned>

A map from unsolved variables to a port index, where that port has not yet been created.

Eventually we will have an input domain at the port index, which will be the solution to the recorded variable.

Definition at line 257 of file InferDomains.cpp.

◆ PortInsertions

using PortInsertions = SmallVector<std::pair<unsigned, PortInfo> >

Definition at line 65 of file InferDomains.cpp.

Function Documentation

◆ getPortDomainAssociation()

static auto getPortDomainAssociation ( ArrayAttr  info,
size_t  i 
)
static

From a domain info attribute, get the row of associated domains for a hardware value at index i.

Definition at line 69 of file InferDomains.cpp.

◆ isDriven()

static bool isDriven ( DomainValue  port)
static

Returns true if the value is driven by a connect op.

Definition at line 89 of file InferDomains.cpp.

◆ isHardware() [1/2]

static bool isHardware ( Type  type)
static

True if a value of the given type could be associated with a domain.

Definition at line 98 of file InferDomains.cpp.

Referenced by isHardware().

◆ isHardware() [2/2]

static bool isHardware ( Value  value)
static

True if the given value could be association with a domain.

Definition at line 103 of file InferDomains.cpp.

References isHardware().

◆ isPort() [1/2]

static bool isPort ( BlockArgument  arg)
static

Return true if the value is a port on the module.

Definition at line 76 of file InferDomains.cpp.

Referenced by isPort().

◆ isPort() [2/2]

static bool isPort ( Value  value)
static

Return true if the value is a port on the module.

Definition at line 81 of file InferDomains.cpp.

References isPort().

◆ operator<<() [1/2]

static Diagnostic & operator<< ( Diagnostic &  diag,
ModuleState::RenderLong  r 
)
static

◆ operator<<() [2/2]

template<typename T >
static llvm::raw_ostream & operator<< ( llvm::raw_ostream &  out,
ModuleState::Render< T >  r 
)
static

Definition at line 540 of file InferDomains.cpp.

◆ stripDomainsFromCircuit()

static LogicalResult stripDomainsFromCircuit ( MLIRContext *  context,
CircuitOp  circuit,
llvm::function_ref< bool(StringAttr)>  shouldStripDomain 
)
static

Definition at line 2197 of file InferDomains.cpp.

References context, and stripModuleImpl().

◆ stripModuleImpl()

static LogicalResult stripModuleImpl ( FModuleLike  op,
llvm::function_ref< bool(StringAttr)>  shouldStripDomain 
)
static

A helper for stripping domains from a module based on a predicate.

The predicate takes a domain name and returns true if that domain should be stripped.

Definition at line 2092 of file InferDomains.cpp.

Referenced by stripDomainsFromCircuit().