CIRCT  19.0.0git
Classes | Namespaces | Functions
Dedup.cpp File Reference
#include "PassDetails.h"
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRRTLAttributes.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.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/LLVM.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/Threading.h"
#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/SHA256.h"
Include dependency graph for Dedup.cpp:

Go to the source code of this file.

Classes

struct  ModuleInfo
 
struct  SymbolTarget
 
struct  StructuralHasherSharedConstants
 This struct contains constant string attributes shared across different threads. More...
 
struct  StructuralHasher
 
struct  Equivalence
 This class is for reporting differences between two modules which should have been deduplicated. More...
 
struct  Equivalence::ModuleData
 
struct  Deduper
 
struct  llvm::DenseMapInfo< ModuleInfo >
 A DenseMapInfo implementation for ModuleInfo that is a pair of llvm::SHA256 hashes, which are represented as std::array<uint8_t, 32>, and an array of string attributes. More...
 

Namespaces

 llvm
 

Functions

llvm::raw_ostream & printHex (llvm::raw_ostream &stream, ArrayRef< uint8_t > bytes)
 
llvm::raw_ostream & printHash (llvm::raw_ostream &stream, llvm::SHA256 &data)
 
llvm::raw_ostream & printHash (llvm::raw_ostream &stream, std::string data)
 
static Location mergeLoc (MLIRContext *context, Location to, Location from)
 
bool fixupClassOp (ClassOp classOp)
 This fixes up ClassLikes with ClassType ports, when the classes have deduped. More...
 
void fixupObjectOp (ObjectOp objectOp, ClassType newClassType)
 This fixes up ObjectOps when the signature of their ClassOp changes. More...
 
void fixupConnect (ImplicitLocOpBuilder &builder, Value dst, Value src)
 This fixes up connects when the field names of a bundle type changes. More...
 
void fixupAllModules (InstanceGraph &instanceGraph)
 This is the root method to fixup module references when a module changes. More...
 

Function Documentation

◆ fixupAllModules()

void fixupAllModules ( InstanceGraph instanceGraph)

This is the root method to fixup module references when a module changes.

It matches all the results of "to" module with the results of the "from" module.

Definition at line 1483 of file Dedup.cpp.

References builder, fixupClassOp(), fixupConnect(), fixupObjectOp(), circt::firrtl::getNumPorts(), and circt::firrtl::Out.

◆ fixupClassOp()

bool fixupClassOp ( ClassOp  classOp)

This fixes up ClassLikes with ClassType ports, when the classes have deduped.

For each ClassType port, if the object reference being assigned is a different type, update the port type. Returns true if the ClassOp was updated and the associated ObjectOps should be updated.

Definition at line 1392 of file Dedup.cpp.

References assert(), and circt::calyx::direction::get().

Referenced by fixupAllModules().

◆ fixupConnect()

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

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 1457 of file Dedup.cpp.

References builder, and circt::firrtl::emitConnect().

Referenced by fixupAllModules().

◆ fixupObjectOp()

void fixupObjectOp ( ObjectOp  objectOp,
ClassType  newClassType 
)

This fixes up ObjectOps when the signature of their ClassOp changes.

This amounts to updating the ObjectOp result type to match the newly updated ClassOp type.

Definition at line 1450 of file Dedup.cpp.

Referenced by fixupAllModules().

◆ mergeLoc()

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

Definition at line 809 of file Dedup.cpp.

References circt::calyx::direction::get().

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

◆ printHash() [1/2]

llvm::raw_ostream& printHash ( llvm::raw_ostream &  stream,
llvm::SHA256 &  data 
)

Definition at line 52 of file Dedup.cpp.

References circt::firrtl::data, and printHex().

◆ printHash() [2/2]

llvm::raw_ostream& printHash ( llvm::raw_ostream &  stream,
std::string  data 
)

Definition at line 56 of file Dedup.cpp.

References circt::firrtl::data, and printHex().

◆ printHex()

llvm::raw_ostream& printHex ( llvm::raw_ostream &  stream,
ArrayRef< uint8_t >  bytes 
)

Definition at line 46 of file Dedup.cpp.

Referenced by printHash().