CIRCT 22.0.0git
Loading...
Searching...
No Matches
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 "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Support/Debug.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for InferDomains.cpp:

Go to the source code of this file.

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 ModuleUpdateTable = DenseMap< StringAttr, ModuleUpdateInfo >
 
using ExportTable = DenseMap< DomainValue, TinyPtrVector< DomainValue > >
 A map from domain IR values defined internal to the moduleOp, to ports that alias that domain.
 
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.
 

Functions

static StringAttr getDomainPortTypeName (ArrayAttr info, size_t i)
 From a domain info attribute, get the domain-type of a domain value at index i.
 
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.
 
template<typename T >
static T fixInstancePorts (T op, const ModuleUpdateInfo &update)
 Apply the port changes of a moduleOp onto an instance-like op.
 
static Term * find (Term *x)
 
static void render (const DomainInfo &info, Diagnostic &out, VariableIDTable &idTable, Term *term)
 
static LogicalResult unify (Term *lhs, Term *rhs)
 
static LogicalResult unify (VariableTerm *x, Term *y)
 
static LogicalResult unify (ValueTerm *xv, Term *y)
 
static LogicalResult unify (RowTerm *lhsRow, Term *rhs)
 
static void solve (Term *lhs, Term *rhs)
 
static Term * getTermForDomain (TermAllocator &allocator, DomainTable &table, DomainValue value)
 Get the corresponding term for a domain in the IR.
 
static void processDomainDefinition (TermAllocator &allocator, DomainTable &table, DomainValue domain)
 
static RowTerm * getDomainAssociationAsRow (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, Value value)
 Get the row of domains that a hardware value in the IR is associated with.
 
static void noteLocation (mlir::InFlightDiagnostic &diag, Operation *op)
 
template<typename T >
static void emitPortDomainCrossingError (const DomainInfo &info, T op, size_t i, DomainTypeID domainTypeID, Term *term1, Term *term2)
 
template<typename T >
static void emitDuplicatePortDomainError (const DomainInfo &info, T op, size_t i, DomainTypeID domainTypeID, IntegerAttr domainPortIndexAttr1, IntegerAttr domainPortIndexAttr2)
 
template<typename T >
static void emitDomainPortInferenceError (T op, size_t i)
 Emit an error when we fail to infer the concrete domain to drive to a domain port.
 
template<typename T >
static void emitAmbiguousPortDomainAssociation (const DomainInfo &info, T op, const llvm::TinyPtrVector< DomainValue > &exports, DomainTypeID typeID, size_t i)
 
template<typename T >
static void emitMissingPortDomainAssociationError (const DomainInfo &info, T op, DomainTypeID typeID, size_t i)
 
static LogicalResult unifyAssociations (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, Operation *op, Value lhs, Value rhs)
 Unify the associated domain rows of two terms.
 
static LogicalResult processModulePorts (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, FModuleOp moduleOp)
 
template<typename T >
static LogicalResult processInstancePorts (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, T op)
 
static LogicalResult processOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, const ModuleUpdateTable &updateTable, InstanceOp op)
 
static LogicalResult processOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, const ModuleUpdateTable &updateTable, InstanceChoiceOp op)
 
static LogicalResult processOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, UnsafeDomainCastOp op)
 
static LogicalResult processOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, DomainDefineOp op)
 
static LogicalResult processOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, const ModuleUpdateTable &updateTable, Operation *op)
 
static LogicalResult processModuleBody (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, const ModuleUpdateTable &updateTable, FModuleOp moduleOp)
 
static LogicalResult processModule (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, const ModuleUpdateTable &updateTable, FModuleOp moduleOp)
 Populate the domain table by processing the moduleOp.
 
static ExportTable initializeExportTable (const DomainTable &table, FModuleOp moduleOp)
 Build a table of exported domains: a map from domains defined internally, to their set of aliasing output ports.
 
static void ensureSolved (const DomainInfo &info, Namespace &ns, DomainTypeID typeID, size_t ip, LocationAttr loc, VariableTerm *var, PendingUpdates &pending)
 If var is not solved, solve it by recording a pending input port at the indicated insertion point.
 
static void ensureExported (const DomainInfo &info, Namespace &ns, const ExportTable &exports, DomainTypeID typeID, size_t ip, LocationAttr loc, ValueTerm *val, PendingUpdates &pending)
 Ensure that the domain value is available in the signature of the moduleOp, so that subsequent hardware ports may be associated with this domain.
 
static void getUpdatesForDomainAssociationOfPort (const DomainInfo &info, Namespace &ns, PendingUpdates &pending, DomainTypeID typeID, size_t ip, LocationAttr loc, Term *term, const ExportTable &exports)
 
static void getUpdatesForDomainAssociationOfPort (const DomainInfo &info, Namespace &ns, const ExportTable &exports, size_t ip, LocationAttr loc, RowTerm *row, PendingUpdates &pending)
 
static void getUpdatesForModulePorts (const DomainInfo &info, TermAllocator &allocator, const ExportTable &exports, DomainTable &table, Namespace &ns, FModuleOp moduleOp, PendingUpdates &pending)
 
static void getUpdatesForModule (const DomainInfo &info, TermAllocator &allocator, const ExportTable &exports, DomainTable &table, FModuleOp mod, PendingUpdates &pending)
 
static void applyUpdatesToModule (const DomainInfo &info, TermAllocator &allocator, ExportTable &exports, DomainTable &table, FModuleOp moduleOp, const PendingUpdates &pending)
 
static SmallVector< Attribute > copyPortDomainAssociations (const DomainInfo &info, ArrayAttr moduleDomainInfo, size_t portIndex)
 Copy the domain associations from the moduleOp domain info attribute into a small vector.
 
static LogicalResult driveModuleOutputDomainPorts (const DomainInfo &info, const DomainTable &table, FModuleOp moduleOp)
 
static LogicalResult updateModuleDomainInfo (const DomainInfo &info, const DomainTable &table, const ExportTable &exportTable, ArrayAttr &result, FModuleOp moduleOp)
 After generalizing the moduleOp, all domains should be solved.
 
template<typename T >
static LogicalResult updateInstance (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, T op)
 
static LogicalResult updateOp (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, Operation *op)
 
static LogicalResult updateModuleBody (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, FModuleOp moduleOp)
 After updating the port domain associations, walk the body of the moduleOp to fix up any child instance modules.
 
static LogicalResult updateModule (const DomainInfo &info, TermAllocator &allocator, DomainTable &table, ModuleUpdateTable &updates, FModuleOp op)
 Write the domain associations recorded in the domain table back to the IR.
 
static LogicalResult checkModulePorts (const DomainInfo &info, FModuleLike moduleOp)
 Check that a module's hardware ports have complete domain associations.
 
static LogicalResult checkModuleDomainPortDrivers (const DomainInfo &info, FModuleOp moduleOp)
 Check that output domain ports are driven.
 
template<typename T >
static LogicalResult checkInstanceDomainPortDrivers (T op)
 Check that the input domain ports are driven.
 
static LogicalResult checkOp (Operation *op)
 
static LogicalResult checkModuleBody (FModuleOp moduleOp)
 Check that instances under this module have driven domain input ports.
 
static LogicalResult inferModule (const DomainInfo &info, ModuleUpdateTable &updates, FModuleOp moduleOp)
 Solve for domains and then write the domain associations back to the IR.
 
static LogicalResult checkModule (const DomainInfo &info, FModuleOp moduleOp)
 Check that a module's ports are fully annotated, before performing domain inference on the module.
 
static LogicalResult checkModule (const DomainInfo &info, FExtModuleOp moduleOp)
 Check that an extmodule's ports are fully annotated.
 
static LogicalResult checkAndInferModule (const DomainInfo &info, ModuleUpdateTable &updateTable, FModuleOp moduleOp)
 Check that a module's ports are fully annotated, before performing domain inference on the module.
 
static LogicalResult runOnModuleLike (InferDomainsMode mode, const DomainInfo &info, ModuleUpdateTable &updateTable, Operation *op)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-infer-domains"

Definition at line 26 of file InferDomains.cpp.

◆ GEN_PASS_DEF_INFERDOMAINS

#define GEN_PASS_DEF_INFERDOMAINS

Definition at line 30 of file InferDomains.cpp.

Typedef Documentation

◆ DomainValue

using DomainValue = mlir::TypedValue<DomainType>

Definition at line 42 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 967 of file InferDomains.cpp.

◆ ModuleUpdateTable

using ModuleUpdateTable = DenseMap<StringAttr, ModuleUpdateInfo>

Definition at line 176 of file InferDomains.cpp.

◆ PendingExports

using PendingExports = llvm::MapVector<DomainValue, unsigned>

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 999 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 994 of file InferDomains.cpp.

◆ PortInsertions

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

Definition at line 44 of file InferDomains.cpp.

Function Documentation

◆ applyUpdatesToModule()

static void applyUpdatesToModule ( const DomainInfo &  info,
TermAllocator &  allocator,
ExportTable exports,
DomainTable &  table,
FModuleOp  moduleOp,
const PendingUpdates &  pending 
)
static

Definition at line 1121 of file InferDomains.cpp.

References solve().

Referenced by updateModule().

◆ checkAndInferModule()

static LogicalResult checkAndInferModule ( const DomainInfo &  info,
ModuleUpdateTable updateTable,
FModuleOp  moduleOp 
)
static

Check that a module's ports are fully annotated, before performing domain inference on the module.

We use this when private module interfaces are inferred but public module interfaces are checked.

Definition at line 1497 of file InferDomains.cpp.

References checkModulePorts(), driveModuleOutputDomainPorts(), processModule(), and updateModuleBody().

Referenced by runOnModuleLike().

◆ checkInstanceDomainPortDrivers()

template<typename T >
static LogicalResult checkInstanceDomainPortDrivers ( op)
static

Check that the input domain ports are driven.

Definition at line 1420 of file InferDomains.cpp.

References isDriven(), and noteLocation().

Referenced by checkOp().

◆ checkModule() [1/2]

static LogicalResult checkModule ( const DomainInfo &  info,
FExtModuleOp  moduleOp 
)
static

Check that an extmodule's ports are fully annotated.

Definition at line 1489 of file InferDomains.cpp.

References checkModulePorts().

◆ checkModule() [2/2]

static LogicalResult checkModule ( const DomainInfo &  info,
FModuleOp  moduleOp 
)
static

Check that a module's ports are fully annotated, before performing domain inference on the module.

Definition at line 1472 of file InferDomains.cpp.

References checkModuleBody(), checkModuleDomainPortDrivers(), checkModulePorts(), and processModule().

Referenced by runOnModuleLike().

◆ checkModuleBody()

static LogicalResult checkModuleBody ( FModuleOp  moduleOp)
static

Check that instances under this module have driven domain input ports.

Definition at line 1447 of file InferDomains.cpp.

References checkOp().

Referenced by checkModule().

◆ checkModuleDomainPortDrivers()

static LogicalResult checkModuleDomainPortDrivers ( const DomainInfo &  info,
FModuleOp  moduleOp 
)
static

Check that output domain ports are driven.

Definition at line 1400 of file InferDomains.cpp.

References isDriven(), and noteLocation().

Referenced by checkModule().

◆ checkModulePorts()

static LogicalResult checkModulePorts ( const DomainInfo &  info,
FModuleLike  moduleOp 
)
static

Check that a module's hardware ports have complete domain associations.

Definition at line 1356 of file InferDomains.cpp.

References emitDuplicatePortDomainError(), emitMissingPortDomainAssociationError(), and getPortDomainAssociation().

Referenced by checkAndInferModule(), checkModule(), and checkModule().

◆ checkOp()

static LogicalResult checkOp ( Operation *  op)
static

Definition at line 1438 of file InferDomains.cpp.

References checkInstanceDomainPortDrivers().

Referenced by checkModuleBody().

◆ copyPortDomainAssociations()

static SmallVector< Attribute > copyPortDomainAssociations ( const DomainInfo &  info,
ArrayAttr  moduleDomainInfo,
size_t  portIndex 
)
static

Copy the domain associations from the moduleOp domain info attribute into a small vector.

Definition at line 1151 of file InferDomains.cpp.

References getPortDomainAssociation().

Referenced by updateModuleDomainInfo().

◆ driveModuleOutputDomainPorts()

static LogicalResult driveModuleOutputDomainPorts ( const DomainInfo &  info,
const DomainTable &  table,
FModuleOp  moduleOp 
)
static

Definition at line 1166 of file InferDomains.cpp.

References emitDomainPortInferenceError(), and isDriven().

Referenced by checkAndInferModule(), and updateModule().

◆ emitAmbiguousPortDomainAssociation()

template<typename T >
static void emitAmbiguousPortDomainAssociation ( const DomainInfo &  info,
op,
const llvm::TinyPtrVector< DomainValue > &  exports,
DomainTypeID  typeID,
size_t  i 
)
static

Definition at line 641 of file InferDomains.cpp.

References noteLocation().

Referenced by updateModuleDomainInfo().

◆ emitDomainPortInferenceError()

template<typename T >
static void emitDomainPortInferenceError ( op,
size_t  i 
)
static

Emit an error when we fail to infer the concrete domain to drive to a domain port.

Definition at line 620 of file InferDomains.cpp.

References noteLocation().

Referenced by driveModuleOutputDomainPorts().

◆ emitDuplicatePortDomainError()

template<typename T >
static void emitDuplicatePortDomainError ( const DomainInfo &  info,
op,
size_t  i,
DomainTypeID  domainTypeID,
IntegerAttr  domainPortIndexAttr1,
IntegerAttr  domainPortIndexAttr2 
)
static

Definition at line 593 of file InferDomains.cpp.

References noteLocation().

Referenced by checkModulePorts(), processInstancePorts(), and processModulePorts().

◆ emitMissingPortDomainAssociationError()

template<typename T >
static void emitMissingPortDomainAssociationError ( const DomainInfo &  info,
op,
DomainTypeID  typeID,
size_t  i 
)
static

Definition at line 661 of file InferDomains.cpp.

References noteLocation().

Referenced by checkModulePorts().

◆ emitPortDomainCrossingError()

template<typename T >
static void emitPortDomainCrossingError ( const DomainInfo &  info,
op,
size_t  i,
DomainTypeID  domainTypeID,
Term *  term1,
Term *  term2 
)
static

Definition at line 568 of file InferDomains.cpp.

References noteLocation(), and render().

◆ ensureExported()

static void ensureExported ( const DomainInfo &  info,
Namespace ns,
const ExportTable exports,
DomainTypeID  typeID,
size_t  ip,
LocationAttr  loc,
ValueTerm *  val,
PendingUpdates &  pending 
)
static

Ensure that the domain value is available in the signature of the moduleOp, so that subsequent hardware ports may be associated with this domain.

output port.

Definition at line 1040 of file InferDomains.cpp.

References assert(), context, isPort(), and circt::Namespace::newName().

Referenced by getUpdatesForDomainAssociationOfPort().

◆ ensureSolved()

static void ensureSolved ( const DomainInfo &  info,
Namespace ns,
DomainTypeID  typeID,
size_t  ip,
LocationAttr  loc,
VariableTerm *  var,
PendingUpdates &  pending 
)
static

If var is not solved, solve it by recording a pending input port at the indicated insertion point.

Definition at line 1011 of file InferDomains.cpp.

References context, and circt::Namespace::newName().

Referenced by getUpdatesForDomainAssociationOfPort().

◆ find()

static Term * find ( Term *  x)
static

◆ fixInstancePorts()

template<typename T >
static T fixInstancePorts ( op,
const ModuleUpdateInfo &  update 
)
static

Apply the port changes of a moduleOp onto an instance-like op.

Definition at line 180 of file InferDomains.cpp.

Referenced by processOp(), and processOp().

◆ getDomainAssociationAsRow()

static RowTerm * getDomainAssociationAsRow ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
Value  value 
)
static

Get the row of domains that a hardware value in the IR is associated with.

The returned term is forced to be at least a row.

Definition at line 517 of file InferDomains.cpp.

References assert(), and solve().

Referenced by getUpdatesForModulePorts(), and processOp().

◆ getDomainPortTypeName()

static StringAttr getDomainPortTypeName ( ArrayAttr  info,
size_t  i 
)
static

From a domain info attribute, get the domain-type of a domain value at index i.

Definition at line 48 of file InferDomains.cpp.

Referenced by updateInstance().

◆ 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 56 of file InferDomains.cpp.

Referenced by checkModulePorts(), copyPortDomainAssociations(), processInstancePorts(), and processModulePorts().

◆ getTermForDomain()

static Term * getTermForDomain ( TermAllocator &  allocator,
DomainTable &  table,
DomainValue  value 
)
static

Get the corresponding term for a domain in the IR.

If we don't know what the term is, then map the domain in the IR to a variable term.

Definition at line 491 of file InferDomains.cpp.

References assert().

Referenced by processInstancePorts(), processModulePorts(), processOp(), processOp(), and updateInstance().

◆ getUpdatesForDomainAssociationOfPort() [1/2]

static void getUpdatesForDomainAssociationOfPort ( const DomainInfo &  info,
Namespace ns,
const ExportTable exports,
size_t  ip,
LocationAttr  loc,
RowTerm *  row,
PendingUpdates &  pending 
)
static

Definition at line 1085 of file InferDomains.cpp.

References find(), and getUpdatesForDomainAssociationOfPort().

◆ getUpdatesForDomainAssociationOfPort() [2/2]

static void getUpdatesForDomainAssociationOfPort ( const DomainInfo &  info,
Namespace ns,
PendingUpdates &  pending,
DomainTypeID  typeID,
size_t  ip,
LocationAttr  loc,
Term *  term,
const ExportTable exports 
)
static

◆ getUpdatesForModule()

static void getUpdatesForModule ( const DomainInfo &  info,
TermAllocator &  allocator,
const ExportTable exports,
DomainTable &  table,
FModuleOp  mod,
PendingUpdates &  pending 
)
static

Definition at line 1110 of file InferDomains.cpp.

References circt::Namespace::add(), and getUpdatesForModulePorts().

Referenced by updateModule().

◆ getUpdatesForModulePorts()

static void getUpdatesForModulePorts ( const DomainInfo &  info,
TermAllocator &  allocator,
const ExportTable exports,
DomainTable &  table,
Namespace ns,
FModuleOp  moduleOp,
PendingUpdates &  pending 
)
static

◆ inferModule()

static LogicalResult inferModule ( const DomainInfo &  info,
ModuleUpdateTable updates,
FModuleOp  moduleOp 
)
static

Solve for domains and then write the domain associations back to the IR.

Definition at line 1458 of file InferDomains.cpp.

References processModule(), and updateModule().

Referenced by runOnModuleLike().

◆ initializeExportTable()

static ExportTable initializeExportTable ( const DomainTable &  table,
FModuleOp  moduleOp 
)
static

Build a table of exported domains: a map from domains defined internally, to their set of aliasing output ports.

Definition at line 971 of file InferDomains.cpp.

Referenced by updateModule().

◆ isDriven()

static bool isDriven ( DomainValue  port)
static

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

Definition at line 76 of file InferDomains.cpp.

Referenced by checkInstanceDomainPortDrivers(), checkModuleDomainPortDrivers(), driveModuleOutputDomainPorts(), and updateInstance().

◆ isPort() [1/2]

static bool isPort ( BlockArgument  arg)
static

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

Definition at line 63 of file InferDomains.cpp.

Referenced by ensureExported(), and isPort().

◆ isPort() [2/2]

static bool isPort ( Value  value)
static

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

Definition at line 68 of file InferDomains.cpp.

References isPort().

◆ noteLocation()

static void noteLocation ( mlir::InFlightDiagnostic &  diag,
Operation *  op 
)
static

◆ processDomainDefinition()

static void processDomainDefinition ( TermAllocator &  allocator,
DomainTable &  table,
DomainValue  domain 
)
static

Definition at line 501 of file InferDomains.cpp.

References assert(), and unify().

Referenced by processInstancePorts(), and processModulePorts().

◆ processInstancePorts()

template<typename T >
static LogicalResult processInstancePorts ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
op 
)
static

◆ processModule()

static LogicalResult processModule ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
const ModuleUpdateTable updateTable,
FModuleOp  moduleOp 
)
static

Populate the domain table by processing the moduleOp.

If the moduleOp has any domain crossing errors, return failure.

Definition at line 949 of file InferDomains.cpp.

References processModuleBody(), and processModulePorts().

Referenced by checkAndInferModule(), checkModule(), and inferModule().

◆ processModuleBody()

static LogicalResult processModuleBody ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
const ModuleUpdateTable updateTable,
FModuleOp  moduleOp 
)
static

Definition at line 936 of file InferDomains.cpp.

References processOp().

Referenced by processModule().

◆ processModulePorts()

static LogicalResult processModulePorts ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
FModuleOp  moduleOp 
)
static

◆ processOp() [1/5]

static LogicalResult processOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
const ModuleUpdateTable updateTable,
InstanceChoiceOp  op 
)
static

Definition at line 843 of file InferDomains.cpp.

References fixInstancePorts(), and processInstancePorts().

◆ processOp() [2/5]

static LogicalResult processOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
const ModuleUpdateTable updateTable,
InstanceOp  op 
)
static

Definition at line 832 of file InferDomains.cpp.

References fixInstancePorts(), and processInstancePorts().

Referenced by processModuleBody(), and processOp().

◆ processOp() [3/5]

static LogicalResult processOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
const ModuleUpdateTable updateTable,
Operation *  op 
)
static

Definition at line 896 of file InferDomains.cpp.

References processOp(), and unifyAssociations().

◆ processOp() [4/5]

static LogicalResult processOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
DomainDefineOp  op 
)
static

Definition at line 875 of file InferDomains.cpp.

References getTermForDomain(), render(), and unify().

◆ processOp() [5/5]

static LogicalResult processOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
UnsafeDomainCastOp  op 
)
static

◆ render()

static void render ( const DomainInfo &  info,
Diagnostic &  out,
VariableIDTable &  idTable,
Term *  term 
)
static

◆ runOnModuleLike()

static LogicalResult runOnModuleLike ( InferDomainsMode  mode,
const DomainInfo &  info,
ModuleUpdateTable updateTable,
Operation *  op 
)
static

Definition at line 1514 of file InferDomains.cpp.

References checkAndInferModule(), checkModule(), and inferModule().

◆ solve()

static void solve ( Term *  lhs,
Term *  rhs 
)
static

Definition at line 356 of file InferDomains.cpp.

References assert(), and unify().

Referenced by applyUpdatesToModule(), getDomainAssociationAsRow(), and updateInstance().

◆ unify() [1/4]

static LogicalResult unify ( RowTerm *  lhsRow,
Term *  rhs 
)
static

Definition at line 325 of file InferDomains.cpp.

References unify().

◆ unify() [2/4]

static LogicalResult unify ( Term *  lhs,
Term *  rhs 
)
static

Definition at line 340 of file InferDomains.cpp.

References find(), and unify().

Referenced by processDomainDefinition(), processOp(), solve(), unify(), unify(), and unifyAssociations().

◆ unify() [3/4]

static LogicalResult unify ( ValueTerm *  xv,
Term *  y 
)
static

Definition at line 312 of file InferDomains.cpp.

◆ unify() [4/4]

static LogicalResult unify ( VariableTerm *  x,
Term *  y 
)
static

Definition at line 306 of file InferDomains.cpp.

References assert().

◆ unifyAssociations()

static LogicalResult unifyAssociations ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
Operation *  op,
Value  lhs,
Value  rhs 
)
static

Unify the associated domain rows of two terms.

Definition at line 673 of file InferDomains.cpp.

References render(), and unify().

Referenced by processOp(), and processOp().

◆ updateInstance()

template<typename T >
static LogicalResult updateInstance ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
op 
)
static

Definition at line 1267 of file InferDomains.cpp.

References getDomainPortTypeName(), getTermForDomain(), isDriven(), and solve().

Referenced by updateOp().

◆ updateModule()

static LogicalResult updateModule ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
ModuleUpdateTable updates,
FModuleOp  op 
)
static

Write the domain associations recorded in the domain table back to the IR.

Definition at line 1323 of file InferDomains.cpp.

References applyUpdatesToModule(), driveModuleOutputDomainPorts(), getUpdatesForModule(), initializeExportTable(), updateModuleBody(), and updateModuleDomainInfo().

Referenced by inferModule().

◆ updateModuleBody()

static LogicalResult updateModuleBody ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
FModuleOp  moduleOp 
)
static

After updating the port domain associations, walk the body of the moduleOp to fix up any child instance modules.

Definition at line 1313 of file InferDomains.cpp.

References updateOp().

Referenced by checkAndInferModule(), and updateModule().

◆ updateModuleDomainInfo()

static LogicalResult updateModuleDomainInfo ( const DomainInfo &  info,
const DomainTable &  table,
const ExportTable exportTable,
ArrayAttr &  result,
FModuleOp  moduleOp 
)
static

After generalizing the moduleOp, all domains should be solved.

Reflect the solved domain associations into the port domain info attribute.

Definition at line 1193 of file InferDomains.cpp.

References context, copyPortDomainAssociations(), emitAmbiguousPortDomainAssociation(), find(), and noteLocation().

Referenced by updateModule().

◆ updateOp()

static LogicalResult updateOp ( const DomainInfo &  info,
TermAllocator &  allocator,
DomainTable &  table,
Operation *  op 
)
static

Definition at line 1302 of file InferDomains.cpp.

References updateInstance().

Referenced by updateModuleBody().