CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::calyx::CalyxLoweringState Class Reference

An interface for conversion passes that lower Calyx programs. More...

#include <CalyxLoweringUtils.h>

Collaboration diagram for circt::calyx::CalyxLoweringState:

Public Member Functions

 CalyxLoweringState (mlir::ModuleOp module, StringRef topLevelFunction)
mlir::ModuleOp getModule ()
 Returns the current program.
StringRef getTopLevelFunction () const
 Returns the name of the top-level function in the source program.
std::string blockName (Block *b)
 Returns a meaningful name for a block within the program scope (removes the ^ prefix from block names).
template<typename T = calyx::ComponentLoweringStateInterface>
T * getState (calyx::ComponentOp op)
 Returns the component lowering state associated with op.
template<typename ValueOrBlock>
std::string irName (ValueOrBlock &v)
 Returns a meaningful name for a value within the program scope.

Private Attributes

StringRef topLevelFunction
 The name of this top-level function.
mlir::ModuleOp module
 The program associated with this state.
DenseMap< Operation *, std::unique_ptr< ComponentLoweringStateInterface > > componentStates
 Mapping from ComponentOp to component lowering state.

Detailed Description

An interface for conversion passes that lower Calyx programs.

This handles state during the lowering of a Calyx program.

Definition at line 554 of file CalyxLoweringUtils.h.

Constructor & Destructor Documentation

◆ CalyxLoweringState()

circt::calyx::CalyxLoweringState::CalyxLoweringState ( mlir::ModuleOp module,
StringRef topLevelFunction )
explicit

Definition at line 471 of file CalyxLoweringUtils.cpp.

References module, and topLevelFunction.

Member Function Documentation

◆ blockName()

std::string circt::calyx::CalyxLoweringState::blockName ( Block * b)

Returns a meaningful name for a block within the program scope (removes the ^ prefix from block names).

Definition at line 484 of file CalyxLoweringUtils.cpp.

References blockName(), and irName().

Referenced by blockName(), circt::pipelinetocalyx::BuildOpGroups::buildOp(), circt::scftocalyx::BuildOpGroups::buildOp(), and circt::calyx::BuildBasicBlockRegs::partiallyLowerFuncToComp().

◆ getModule()

mlir::ModuleOp circt::calyx::CalyxLoweringState::getModule ( )

Returns the current program.

Definition at line 475 of file CalyxLoweringUtils.cpp.

References assert(), and module.

◆ getState()

template<typename T = calyx::ComponentLoweringStateInterface>
T * circt::calyx::CalyxLoweringState::getState ( calyx::ComponentOp op)
inline

Returns the component lowering state associated with op.

If not found already found, a new mapping is added for this ComponentOp. Different conversions may have different derived classes of the interface, so we provided a template.

Definition at line 574 of file CalyxLoweringUtils.h.

References componentStates, and success().

Referenced by circt::pipelinetocalyx::FuncOpConversion::partiallyLowerFuncToComp(), circt::scftocalyx::FuncOpConversion::partiallyLowerFuncToComp(), and circt::scftocalyx::BuildControl::scheduleBasicBlock().

◆ getTopLevelFunction()

StringRef circt::calyx::CalyxLoweringState::getTopLevelFunction ( ) const

Returns the name of the top-level function in the source program.

Definition at line 480 of file CalyxLoweringUtils.cpp.

References topLevelFunction.

◆ irName()

template<typename ValueOrBlock>
std::string circt::calyx::CalyxLoweringState::irName ( ValueOrBlock & v)
inline

Returns a meaningful name for a value within the program scope.

Definition at line 589 of file CalyxLoweringUtils.h.

References module.

Referenced by blockName(), and circt::scftocalyx::BuildWhileGroups::partiallyLowerFuncToComp().

Member Data Documentation

◆ componentStates

DenseMap<Operation *, std::unique_ptr<ComponentLoweringStateInterface> > circt::calyx::CalyxLoweringState::componentStates
private

Mapping from ComponentOp to component lowering state.

Definition at line 604 of file CalyxLoweringUtils.h.

Referenced by getState().

◆ module

mlir::ModuleOp circt::calyx::CalyxLoweringState::module
private

◆ topLevelFunction

StringRef circt::calyx::CalyxLoweringState::topLevelFunction
private

The name of this top-level function.

Definition at line 599 of file CalyxLoweringUtils.h.

Referenced by CalyxLoweringState(), and getTopLevelFunction().


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