CIRCT  20.0.0git
Namespaces | Macros | Typedefs | Functions
PrefixModules.cpp File Reference
#include "circt/Dialect/FIRRTL/AnnotationDetails.h"
#include "circt/Dialect/FIRRTL/FIRRTLAnnotations.h"
#include "circt/Dialect/FIRRTL/FIRRTLInstanceGraph.h"
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "circt/Dialect/FIRRTL/NLATable.h"
#include "circt/Dialect/FIRRTL/Passes.h"
#include "circt/Dialect/HW/HWAttributes.h"
#include "circt/Support/LLVM.h"
#include "mlir/IR/AttrTypeSubElements.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/StringMap.h"
#include "circt/Dialect/FIRRTL/Passes.h.inc"
Include dependency graph for PrefixModules.cpp:

Go to the source code of this file.

Namespaces

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

Macros

#define GEN_PASS_DEF_PREFIXMODULES
 

Typedefs

using PrefixMap = llvm::DenseMap< StringRef, std::vector< std::string > >
 This maps a FModuleOp to a list of all prefixes that need to be applied. More...
 

Functions

static void recordPrefix (PrefixMap &prefixMap, StringRef moduleName, std::string prefix)
 Insert a string into the end of vector if the string is not already present. More...
 
static PrefixInfo getPrefixInfo (Operation *module)
 Get the PrefixInfo for a module from a NestedPrefixModulesAnnotation on a module. More...
 
static StringRef getPrefix (Operation *module)
 If there is an inclusive prefix attached to the module, return it. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_PREFIXMODULES

#define GEN_PASS_DEF_PREFIXMODULES

Definition at line 29 of file PrefixModules.cpp.

Typedef Documentation

◆ PrefixMap

using PrefixMap = llvm::DenseMap<StringRef, std::vector<std::string> >

This maps a FModuleOp to a list of all prefixes that need to be applied.

When a module has multiple prefixes, it will be cloned for each one. Usually there is only a single prefix applied to each module, although there could be many.

Definition at line 41 of file PrefixModules.cpp.

Function Documentation

◆ getPrefix()

static StringRef getPrefix ( Operation *  module)
static

If there is an inclusive prefix attached to the module, return it.

Definition at line 88 of file PrefixModules.cpp.

References getPrefixInfo().

◆ getPrefixInfo()

static PrefixInfo getPrefixInfo ( Operation *  module)
static

Get the PrefixInfo for a module from a NestedPrefixModulesAnnotation on a module.

If the module is not annotated, the prefix returned will be empty.

Definition at line 66 of file PrefixModules.cpp.

References circt::firrtl::AnnotationSet::getAnnotation(), and circt::firrtl::prefixModulesAnnoClass.

Referenced by getPrefix().

◆ recordPrefix()

static void recordPrefix ( PrefixMap prefixMap,
StringRef  moduleName,
std::string  prefix 
)
static

Insert a string into the end of vector if the string is not already present.

Definition at line 44 of file PrefixModules.cpp.