CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::ExportVerilog::GlobalNameResolver Class Reference

This class keeps track of modules and interfaces that need to be renamed, as well as module ports, parameters, declarations and verif labels that need to be renamed. More...

Collaboration diagram for circt::ExportVerilog::GlobalNameResolver:

Public Member Functions

 GlobalNameResolver (mlir::ModuleOp topLevel, const LoweringOptions &options)
 Construct a GlobalNameResolver and perform name legalization of the module/interfaces, port/parameter and declaration names.
GlobalNameTable takeGlobalNameTable ()

Private Member Functions

void legalizeModuleNames (HWModuleOp module)
 Check to see if the port names of the specified module conflict with keywords or themselves.
void legalizeInterfaceNames (InterfaceOp interface)
template<typename Package>
void legalizePackageNames (Package package)
void legalizeFunctionNames (FuncOp func)
void gatherEnumPrefixes (mlir::ModuleOp topLevel)
 GlobalNameResolver (const GlobalNameResolver &)=delete
void operator= (const GlobalNameResolver &)=delete

Private Attributes

NameCollisionResolver globalNameResolver
 Set of globally visible names, to ensure uniqueness.
GlobalNameTable globalNameTable
 This keeps track of globally visible names like module parameters.
const LoweringOptions & options

Detailed Description

This class keeps track of modules and interfaces that need to be renamed, as well as module ports, parameters, declarations and verif labels that need to be renamed.

This can happen either due to conflicts between them or due to a conflict with a Verilog keyword.

Once constructed, this is immutable.

Definition at line 128 of file LegalizeNames.cpp.

Constructor & Destructor Documentation

◆ GlobalNameResolver() [1/2]

GlobalNameResolver::GlobalNameResolver ( mlir::ModuleOp topLevel,
const LoweringOptions & options )

Construct a GlobalNameResolver and perform name legalization of the module/interfaces, port/parameter and declaration names.

Construct a GlobalNameResolver and do the initial scan to populate and unique the module/interfaces and port/parameter names.

Definition at line 271 of file LegalizeNames.cpp.

References globalNameResolver, globalNameTable, if(), and options.

Referenced by GlobalNameResolver(), and operator=().

◆ GlobalNameResolver() [2/2]

circt::ExportVerilog::GlobalNameResolver::GlobalNameResolver ( const GlobalNameResolver & )
privatedelete

References GlobalNameResolver().

Member Function Documentation

◆ gatherEnumPrefixes()

void GlobalNameResolver::gatherEnumPrefixes ( mlir::ModuleOp topLevel)
private

Definition at line 361 of file LegalizeNames.cpp.

References globalNameTable.

◆ legalizeFunctionNames()

void GlobalNameResolver::legalizeFunctionNames ( FuncOp func)
private

Definition at line 418 of file LegalizeNames.cpp.

References globalNameResolver.

◆ legalizeInterfaceNames()

void GlobalNameResolver::legalizeInterfaceNames ( InterfaceOp interface)
private

◆ legalizeModuleNames()

void GlobalNameResolver::legalizeModuleNames ( HWModuleOp module)
private

Check to see if the port names of the specified module conflict with keywords or themselves.

If so, add the replacement names to globalNameTable.

Definition at line 380 of file LegalizeNames.cpp.

References circt::ExportVerilog::NameCollisionResolver::getLegalName(), globalNameResolver, globalNameTable, and options.

◆ legalizePackageNames()

template<typename Package>
void GlobalNameResolver::legalizePackageNames ( Package package)
private

◆ operator=()

void circt::ExportVerilog::GlobalNameResolver::operator= ( const GlobalNameResolver & )
privatedelete

References GlobalNameResolver().

◆ takeGlobalNameTable()

GlobalNameTable circt::ExportVerilog::GlobalNameResolver::takeGlobalNameTable ( )
inline

Definition at line 134 of file LegalizeNames.cpp.

References globalNameTable.

Referenced by circt::ExportVerilog::legalizeGlobalNames().

Member Data Documentation

◆ globalNameResolver

NameCollisionResolver circt::ExportVerilog::GlobalNameResolver::globalNameResolver
private

Set of globally visible names, to ensure uniqueness.

Definition at line 150 of file LegalizeNames.cpp.

Referenced by GlobalNameResolver(), legalizeFunctionNames(), legalizeInterfaceNames(), legalizeModuleNames(), and legalizePackageNames().

◆ globalNameTable

GlobalNameTable circt::ExportVerilog::GlobalNameResolver::globalNameTable
private

This keeps track of globally visible names like module parameters.

Definition at line 153 of file LegalizeNames.cpp.

Referenced by gatherEnumPrefixes(), GlobalNameResolver(), legalizeModuleNames(), legalizePackageNames(), and takeGlobalNameTable().

◆ options

const LoweringOptions& circt::ExportVerilog::GlobalNameResolver::options
private

The documentation for this class was generated from the following file: