CIRCT  20.0.0git
Namespaces | Typedefs | Functions
FIRRTLUtils.h File Reference
#include "circt/Dialect/FIRRTL/FIRRTLOps.h"
#include "mlir/IR/BuiltinOps.h"
#include "llvm/Support/Parallel.h"
Include dependency graph for FIRRTLUtils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

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

Typedefs

using circt::firrtl::WalkDriverCallback = llvm::function_ref< bool(const FieldRef &dst, const FieldRef &src)>
 Walk all the drivers of a value, passing in the connect operations drive the value. More...
 
using circt::firrtl::GetNamespaceCallback = llvm::function_ref< hw::InnerSymbolNamespace &(FModuleLike mod)>
 

Functions

void circt::firrtl::emitConnect (OpBuilder &builder, Location loc, Value lhs, Value rhs)
 Emit a connect between two values. More...
 
void circt::firrtl::emitConnect (ImplicitLocOpBuilder &builder, Value lhs, Value rhs)
 Emit a connect between two values. More...
 
IntegerAttr circt::firrtl::getIntAttr (Type type, const APInt &value)
 Utiility for generating a constant attribute. More...
 
IntegerAttr circt::firrtl::getIntZerosAttr (Type type)
 Utility for generating a constant zero attribute. More...
 
IntegerAttr circt::firrtl::getIntOnesAttr (Type type)
 Utility for generating a constant all ones attribute. More...
 
PropAssignOp circt::firrtl::getPropertyAssignment (FIRRTLPropertyValue value)
 Return the single assignment to a Property value. More...
 
Value circt::firrtl::getDriverFromConnect (Value val)
 Return the module-scoped driver of a value only looking through one connect. More...
 
Value circt::firrtl::getValueSource (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope. More...
 
Value circt::firrtl::getModuleScopedDriver (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return the value that drives another FIRRTL value within module scope. More...
 
template<typename A , typename... B>
static bool circt::firrtl::isModuleScopedDrivenBy (Value val, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts)
 Return true if a value is module-scoped driven by a value of a specific type. More...
 
bool circt::firrtl::walkDrivers (FIRRTLBaseValue value, bool lookThroughWires, bool lookThroughNodes, bool lookThroughCasts, WalkDriverCallback callback)
 
FieldRef circt::firrtl::getFieldRefFromValue (Value value, bool lookThroughCasts=false)
 Get the FieldRef from a value. More...
 
FieldRef circt::firrtl::getDeltaRef (Value value, bool lookThroughCasts=false)
 Get the delta indexing from a value, as a FieldRef. More...
 
std::pair< std::string, bool > circt::firrtl::getFieldName (const FieldRef &fieldRef, bool nameSafe=false)
 Get a string identifier representing the FieldRef. More...
 
Value circt::firrtl::getValueByFieldID (ImplicitLocOpBuilder builder, Value value, unsigned fieldID)
 This gets the value targeted by a field id. More...
 
void circt::firrtl::walkGroundTypes (FIRRTLType firrtlType, llvm::function_ref< void(uint64_t, FIRRTLBaseType, bool)> fn)
 Walk leaf ground types in the firrtlType and apply the function fn. More...
 
hw::InnerSymTarget circt::firrtl::getTargetFor (FieldRef ref)
 Return the inner sym target for the specified value and fieldID. More...
 
FieldRef circt::firrtl::getFieldRefForTarget (const hw::InnerSymTarget &ist)
 Get FieldRef pointing to the specified inner symbol target, which must be valid. More...
 
std::pair< hw::InnerSymAttr, StringAttr > circt::firrtl::getOrAddInnerSym (MLIRContext *context, hw::InnerSymAttr attr, uint64_t fieldID, llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace)
 Ensure that the the InnerSymAttr has a symbol on the field specified. More...
 
StringAttr circt::firrtl::getOrAddInnerSym (const hw::InnerSymTarget &target, llvm::function_ref< hw::InnerSymbolNamespace &()> getNamespace)
 Returns an inner symbol identifier for the specified target (op or port), adding one if necessary. More...
 
StringAttr circt::firrtl::getOrAddInnerSym (const hw::InnerSymTarget &target, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified target (op or port), adding one if necessary. More...
 
hw::InnerRefAttr circt::firrtl::getInnerRefTo (const hw::InnerSymTarget &target, GetNamespaceCallback getNamespace)
 Obtain an inner reference to the target (operation or port), adding an inner symbol as necessary. More...
 
static StringAttr circt::firrtl::getOrAddInnerSym (Operation *op, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified operation, adding one if necessary. More...
 
static StringAttr circt::firrtl::getOrAddInnerSym (Operation *op, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified operation's field adding one if necessary. More...
 
static hw::InnerRefAttr circt::firrtl::getInnerRefTo (Operation *op, GetNamespaceCallback getNamespace)
 Obtain an inner reference to an operation, possibly adding an inner symbol. More...
 
static hw::InnerRefAttr circt::firrtl::getInnerRefTo (Operation *op, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Obtain an inner reference to an operation's field, possibly adding an inner symbol. More...
 
static StringAttr circt::firrtl::getOrAddInnerSym (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified port, adding one if necessary. More...
 
static StringAttr circt::firrtl::getOrAddInnerSym (FModuleLike mod, size_t portIdx, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Returns an inner symbol identifier for the specified port's field, adding one if necessary. More...
 
static hw::InnerRefAttr circt::firrtl::getInnerRefTo (FModuleLike mod, size_t portIdx, GetNamespaceCallback getNamespace)
 Obtain an inner reference to a port, possibly adding an inner symbol. More...
 
static hw::InnerRefAttr circt::firrtl::getInnerRefTo (FModuleLike mod, size_t portIdx, uint64_t fieldID, GetNamespaceCallback getNamespace)
 Obtain an inner reference to a port's field, possibly adding an inner symbol. More...
 
FIRRTLBaseType circt::firrtl::getBaseType (Type type)
 If it is a base type, return it as is. More...
 
template<typename T >
circt::firrtl::getBaseOfType (Type type)
 Get base type if isa<> the requested type, else null. More...
 
FIRRTLType circt::firrtl::mapBaseType (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function. More...
 
FIRRTLType circt::firrtl::mapBaseTypeNullable (FIRRTLType type, function_ref< FIRRTLBaseType(FIRRTLBaseType)> fn)
 Return a FIRRTLType with its base type component mutated by the given function. More...
 
Type circt::firrtl::lowerType (Type type, std::optional< Location > loc={}, llvm::function_ref< hw::TypeAliasType(Type, BaseTypeAliasType, Location)> getTypeDeclFn={})
 Given a type, return the corresponding lowered type for the HW dialect. More...
 
std::pair< bool, std::optional< mlir::LocationAttr > > circt::firrtl::maybeStringToLocation (StringRef spelling, bool skipParsing, StringAttr &locatorFilenameCache, FileLineColLoc &fileLineColLocCache, MLIRContext *context)
 Parse a string that may encode a FIRRTL location into a LocationAttr. More...
 
template<class IterTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy circt::firrtl::transformReduce (MLIRContext *context, IterTy begin, IterTy end, ResultTy init, ReduceFuncTy reduce, TransformFuncTy transform)
 Wrapper for llvm::parallelTransformReduce that performs the transform_reduce serially when MLIR multi-threading is disabled. More...
 
template<class RangeTy , class ResultTy , class ReduceFuncTy , class TransformFuncTy >
static ResultTy circt::firrtl::transformReduce (MLIRContext *context, RangeTy &&r, ResultTy init, ReduceFuncTy reduce, TransformFuncTy transform)
 Range wrapper. More...
 
void circt::firrtl::makeCommonPrefix (SmallString< 64 > &a, StringRef b)
 Truncate a to the common prefix of a and b. More...
 
PathOp circt::firrtl::createPathRef (Operation *op, hw::HierPathOp nla, mlir::ImplicitLocOpBuilder &builderOM)
 Add the tracker annotation to the op and get a PathOp to the op. More...