CIRCT  19.0.0git
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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:
Collaboration graph
[legend]

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. More...
 
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. More...
 
void legalizeInterfaceNames (InterfaceOp interface)
 
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. More...
 
GlobalNameTable globalNameTable
 This keeps track of globally visible names like module parameters. More...
 
const LoweringOptionsoptions
 

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 98 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 224 of file LegalizeNames.cpp.

References circt::LoweringOptions::caseInsensitiveKeywords, gatherEnumPrefixes(), circt::hw::getVerilogModuleNameAttr(), globalNameResolver, circt::ExportVerilog::NameCollisionResolver::insertUsedName(), circt::sv::isNameValid(), legalizeInterfaceNames(), legalizeModuleNames(), and options.

◆ GlobalNameResolver() [2/2]

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

Member Function Documentation

◆ gatherEnumPrefixes()

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

◆ 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 288 of file LegalizeNames.cpp.

References circt::ExportVerilog::GlobalNameTable::addRenamedParam(), esiaccel.accelerator::ctxt, circt::calyx::direction::get(), circt::ExportVerilog::NameCollisionResolver::getLegalName(), globalNameResolver, globalNameTable, and options.

Referenced by GlobalNameResolver().

◆ operator=()

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

◆ takeGlobalNameTable()

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

Definition at line 104 of file LegalizeNames.cpp.

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 117 of file LegalizeNames.cpp.

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

◆ globalNameTable

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

This keeps track of globally visible names like module parameters.

Definition at line 120 of file LegalizeNames.cpp.

Referenced by gatherEnumPrefixes(), and legalizeModuleNames().

◆ options

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

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