CIRCT 24.0.0git
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions
ModuleInliner.cpp File Reference
#include "circt/Dialect/Debug/DebugOps.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotations.h"
#include "circt/Dialect/FIRRTL/FIRRTLOpInterfaces.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/FIRRTLTypes.h"
#include "circt/Dialect/FIRRTL/FIRRTLUtils.h"
#include "circt/Dialect/FIRRTL/Namespace.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/HWOpInterfaces.h"
#include "circt/Dialect/HW/HWOps.h"
#include "circt/Dialect/HW/InnerSymbolNamespace.h"
#include "circt/Support/Debug.h"
#include "circt/Support/LLVM.h"
#include "circt/Support/Utils.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Threading.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/TrailingObjects.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for ModuleInliner.cpp:

Go to the source code of this file.

Classes

struct  llvm::DenseMapInfo< TrimmedPathRef >
 DenseMapInfo specialization for TrimmedPathRef to enable deduplication. More...
 

Namespaces

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

Macros

#define DEBUG_TYPE   "firrtl-inliner"
 
#define GEN_PASS_DEF_INLINER
 

Typedefs

using InnerRefToNewNameMap = DenseMap< hw::InnerRefAttr, StringAttr >
 

Functions

static bool vnlaIdLess (const VirtualNLA *a, const VirtualNLA *b)
 Context collections are ordered by creation id throughout (I4/I5/I6).
 
static void mapResultsToWires (IRMapping &mapper, SmallVectorImpl< Value > &wires, InstanceOp instance)
 Map each of the instance's results to its corresponding replacement wire.
 
static LogicalResult replaceInnerRefUsers (ArrayRef< Operation * > newOps, const InnerRefToNewNameMap &map, StringAttr istName)
 Process each operation, updating InnerRefAttr's using the specified map, with the given name as the containing IST of the mapped-to sym names.
 
static hw::InnerSymAttr uniqueInNamespace (hw::InnerSymAttr old, InnerRefToNewNameMap &map, hw::InnerSymbolNamespace &ns, StringAttr istName)
 Unique each of old's symbols in ns; record old-ref -> new-name entries in map under istName.
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-inliner"

Definition at line 189 of file ModuleInliner.cpp.

◆ GEN_PASS_DEF_INLINER

#define GEN_PASS_DEF_INLINER

Definition at line 193 of file ModuleInliner.cpp.

Typedef Documentation

◆ InnerRefToNewNameMap

using InnerRefToNewNameMap = DenseMap<hw::InnerRefAttr, StringAttr>

Definition at line 202 of file ModuleInliner.cpp.

Function Documentation

◆ mapResultsToWires()

static void mapResultsToWires ( IRMapping &  mapper,
SmallVectorImpl< Value > &  wires,
InstanceOp  instance 
)
static

Map each of the instance's results to its corresponding replacement wire.

Later clones from the parent block then read the wires.

Definition at line 1204 of file ModuleInliner.cpp.

◆ replaceInnerRefUsers()

static LogicalResult replaceInnerRefUsers ( ArrayRef< Operation * >  newOps,
const InnerRefToNewNameMap map,
StringAttr  istName 
)
static

Process each operation, updating InnerRefAttr's using the specified map, with the given name as the containing IST of the mapped-to sym names.

Every inner-ref in the cloned ops names the child being inlined, so map covers them all (I11).

A miss is a reference to another module, in an unknown capacity (!). There is no correct update, so it is diagnosed.

Definition at line 1218 of file ModuleInliner.cpp.

◆ uniqueInNamespace()

static hw::InnerSymAttr uniqueInNamespace ( hw::InnerSymAttr  old,
InnerRefToNewNameMap map,
hw::InnerSymbolNamespace &  ns,
StringAttr  istName 
)
static

Unique each of old's symbols in ns; record old-ref -> new-name entries in map under istName.

Definition at line 1244 of file ModuleInliner.cpp.

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

◆ vnlaIdLess()

static bool vnlaIdLess ( const VirtualNLA *  a,
const VirtualNLA *  b 
)
static

Context collections are ordered by creation id throughout (I4/I5/I6).

Definition at line 570 of file ModuleInliner.cpp.