CIRCT  20.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 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. 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 107 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 246 of file LegalizeNames.cpp.

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

◆ GlobalNameResolver() [2/2]

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

Member Function Documentation

◆ gatherEnumPrefixes()

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

◆ legalizeFunctionNames()

void GlobalNameResolver::legalizeFunctionNames ( FuncOp  func)
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 317 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 113 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 127 of file LegalizeNames.cpp.

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

◆ globalNameTable

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

This keeps track of globally visible names like module parameters.

Definition at line 130 of file LegalizeNames.cpp.

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

◆ options

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

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