CIRCT 24.0.0git
Loading...
Searching...
No Matches
Dedup.cpp File Reference
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRRTLAttributes.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.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/NLATable.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Dialect/HW/InnerSymbolNamespace.h"
#include "circt/Support/Debug.h"
#include "circt/Support/LLVM.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Threading.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/SHA256.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for Dedup.cpp:

Go to the source code of this file.

Classes

struct  ModuleInfo
struct  StructuralHasherSharedConstants
 This struct contains constant string attributes shared across different threads. More...
struct  StructuralHasher
struct  ModuleInfoRef
 A reference to a ModuleInfo that compares and hashes like it. More...
struct  llvm::DenseMapInfo< ModuleInfoRef >
 Allow ModuleInfoRef to be used as dense map keys. More...
struct  Equivalence
 This class is for reporting differences between two modules which should have been deduplicated. More...
struct  Equivalence::ModuleData
struct  Deduper

Namespaces

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

Macros

#define DEBUG_TYPE   "firrtl-dedup"
#define GEN_PASS_DEF_DEDUP

Functions

static bool canRemoveModule (mlir::SymbolOpInterface symbol)
 Returns true if the module can be removed.
static bool operator== (const ModuleInfo &lhs, const ModuleInfo &rhs)
static Location mergeLoc (MLIRContext *context, Location to, Location from)
static void fixupConnect (ImplicitLocOpBuilder &builder, Value dst, Value src)
 This fixes up connects when the field names of a bundle type changes.
static void fixupInstanceTypes (InstanceGraph &instanceGraph)
 Adjust instance result types to match the deduplicated module's port types.

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "firrtl-dedup"

Definition at line 38 of file Dedup.cpp.

◆ GEN_PASS_DEF_DEDUP

#define GEN_PASS_DEF_DEDUP

Definition at line 42 of file Dedup.cpp.

Function Documentation

◆ canRemoveModule()

bool canRemoveModule ( mlir::SymbolOpInterface symbol)
static

Returns true if the module can be removed.

Definition at line 56 of file Dedup.cpp.

Referenced by Equivalence::check().

◆ fixupConnect()

void fixupConnect ( ImplicitLocOpBuilder & builder,
Value dst,
Value src )
static

This fixes up connects when the field names of a bundle type changes.

It finds all fields which were previously bulk connected and legalizes it into a connect for each field.

Definition at line 1562 of file Dedup.cpp.

References circt::firrtl::emitConnect(), fixupConnect(), and circt::firrtl::type_cast().

Referenced by fixupConnect(), and fixupInstanceTypes().

◆ fixupInstanceTypes()

void fixupInstanceTypes ( InstanceGraph & instanceGraph)
static

Adjust instance result types to match the deduplicated module's port types.

Bundle field names may have changed, so preserve the old types for users by going through intermediate wires. Delay this until after deduplication to avoid introducing differences between otherwise equivalent parent modules.

Definition at line 1589 of file Dedup.cpp.

References fixupConnect().

◆ mergeLoc()

Location mergeLoc ( MLIRContext * context,
Location to,
Location from )
static

Definition at line 905 of file Dedup.cpp.

References context.

Referenced by Deduper::dedup(), Deduper::mergeBlocks(), and Deduper::mergeOps().

◆ operator==()

bool operator== ( const ModuleInfo & lhs,
const ModuleInfo & rhs )
static

Definition at line 85 of file Dedup.cpp.

References ModuleInfo::referredModuleNames, and ModuleInfo::structuralHash.