22 #ifndef CIRCT_DIALECT_HW_PORTCONVERTER_H
23 #define CIRCT_DIALECT_HW_PORTCONVERTER_H
33 class PortConversionBuilder;
60 std::unique_ptr<PortConversionBuilder>
ssb;
72 hw::HWMutableModuleLike
mod;
85 SmallVector<std::pair<unsigned, hw::PortInfo>, 0>
newInputs;
86 SmallVector<std::pair<unsigned, hw::PortInfo>, 0>
newOutputs;
106 virtual LogicalResult
init() {
return success(); }
121 SmallVectorImpl<Value> &newOperands,
122 ArrayRef<Backedge> newResults) = 0;
124 SmallVectorImpl<Value> &newOperands,
125 ArrayRef<Backedge> newResults) = 0;
168 template <
typename PortConversionBuilderImpl>
171 template <
typename... Args>
175 ssb = std::make_unique<PortConversionBuilderImpl>(*
this, args...);
HW-specific instance graph with a virtual entry node linking to all publicly visible modules.
PortConverterImpl & converter
PortConversionBuilder(PortConverterImpl &converter)
virtual FailureOr< std::unique_ptr< PortConversion > > build(hw::PortInfo port)
virtual ~PortConversionBuilder()=default
Base class for the port conversion of a particular port.
virtual void buildInputSignals()=0
virtual void mapInputSignals(OpBuilder &b, Operation *inst, Value instValue, SmallVectorImpl< Value > &newOperands, ArrayRef< Backedge > newResults)=0
Update an instance port to the new port information.
virtual ~PortConversion()=default
PortConversion(PortConverterImpl &converter, hw::PortInfo origPort)
virtual LogicalResult init()
MLIRContext * getContext()
PortConverterImpl & converter
virtual void mapOutputSignals(OpBuilder &b, Operation *inst, Value instValue, SmallVectorImpl< Value > &newOperands, ArrayRef< Backedge > newResults)=0
virtual void buildOutputSignals()=0
hw::HWMutableModuleLike getModule()
LogicalResult run()
Run port conversion.
SmallVector< std::unique_ptr< PortConversion > > loweredOutputs
SmallVector< std::pair< unsigned, hw::PortInfo >, 0 > newInputs
igraph::InstanceGraphNode * moduleNode
SmallVector< std::unique_ptr< PortConversion > > loweredInputs
hw::HWMutableModuleLike mod
void createNewOutput(hw::PortInfo origPort, const Twine &suffix, Type type, Value output, hw::PortInfo &newPort)
Same as above.
hw::HWMutableModuleLike getModule() const
void updateInstance(hw::InstanceOp)
Updates an instance of the module.
std::unique_ptr< PortConversionBuilder > ssb
PortConverterImpl(igraph::InstanceGraphNode *moduleNode)
SmallVector< std::pair< unsigned, hw::PortInfo >, 0 > newOutputs
Value createNewInput(hw::PortInfo origPort, const Twine &suffix, Type type, hw::PortInfo &newPort)
These two methods take care of allocating new ports in the correct place based on the position of 'or...
PortConverter(hw::InstanceGraph &graph, hw::HWMutableModuleLike mod, Args &&...args)
This is a Node in the InstanceGraph.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
This holds the name, type, direction of a module's ports.