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

Instantiate one of these and use it to build typed backedges. More...

#include <BackedgeBuilder.h>

Collaboration diagram for circt::BackedgeBuilder:

Public Member Functions

 BackedgeBuilder (mlir::OpBuilder &builder, mlir::Location loc)
 To build a backedge op and manipulate it, we need a PatternRewriter and a Location.
 BackedgeBuilder (mlir::PatternRewriter &rewriter, mlir::Location loc)
 ~BackedgeBuilder ()
Backedge get (mlir::Type resultType, mlir::LocationAttr optionalLoc={})
 Create a typed backedge.
mlir::LogicalResult clearOrEmitError ()
 Clear the backedges, erasing any remaining cursor ops.
void abandon ()
 Abandon the backedges, suppressing any diagnostics if they are still active upon destruction of the backedge builder.

Private Attributes

mlir::OpBuilder & builder
mlir::PatternRewriter * rewriter
mlir::Location loc
llvm::SmallVector< mlir::Operation *, 16 > edges

Friends

class Backedge

Detailed Description

Instantiate one of these and use it to build typed backedges.

Backedges which get used as operands must be assigned to with the actual value before this class is destructed, usually at the end of a scope. It will check that invariant then erase all the backedge ops during destruction.

Example use:

circt::Backedge ready = back.get(rewriter.getI1Type());
// Use `ready` as a `Value`.
auto addOp = addOp::create(rewriter, loc, ready);
// When the actual value is available,
ready.set(anotherOp.getResult(0));
Instantiate one of these and use it to build typed backedges.
mlir::PatternRewriter * rewriter
Backedge is a wrapper class around a Value.

Definition at line 46 of file BackedgeBuilder.h.

Constructor & Destructor Documentation

◆ BackedgeBuilder() [1/2]

circt::BackedgeBuilder::BackedgeBuilder ( mlir::OpBuilder & builder,
mlir::Location loc )

To build a backedge op and manipulate it, we need a PatternRewriter and a Location.

Store them during construct of this instance and use them when building.

References builder, and loc.

◆ BackedgeBuilder() [2/2]

circt::BackedgeBuilder::BackedgeBuilder ( mlir::PatternRewriter & rewriter,
mlir::Location loc )

References Backedge, loc, and rewriter.

◆ ~BackedgeBuilder()

BackedgeBuilder::~BackedgeBuilder ( )

Definition at line 35 of file BackedgeBuilder.cpp.

References clearOrEmitError().

Member Function Documentation

◆ abandon()

void BackedgeBuilder::abandon ( )

Abandon the backedges, suppressing any diagnostics if they are still active upon destruction of the backedge builder.

Also, any currently existing cursor ops will be abandoned.

Definition at line 59 of file BackedgeBuilder.cpp.

References edges.

◆ clearOrEmitError()

LogicalResult BackedgeBuilder::clearOrEmitError ( )

Clear the backedges, erasing any remaining cursor ops.

Returns failure and emits diagnostic messages if a backedge is still active.

Definition at line 37 of file BackedgeBuilder.cpp.

References edges, loc, rewriter, and success().

Referenced by ~BackedgeBuilder().

◆ get()

Backedge BackedgeBuilder::get ( mlir::Type resultType,
mlir::LocationAttr optionalLoc = {} )

Create a typed backedge.

If no location is provided, the one passed to the constructor will be used.

Definition at line 65 of file BackedgeBuilder.cpp.

References Backedge, builder, edges, and loc.

Referenced by circt::handshake::HandshakeLowering::insertMerge(), instantiateSystemVerilogMemory(), lockRegion(), and circt::hw::PortConverterImpl::updateInstance().

◆ Backedge

friend class Backedge
friend

Definition at line 47 of file BackedgeBuilder.h.

References Backedge.

Referenced by Backedge, BackedgeBuilder(), and get().

Member Data Documentation

◆ builder

mlir::OpBuilder& circt::BackedgeBuilder::builder
private

Definition at line 71 of file BackedgeBuilder.h.

Referenced by BackedgeBuilder(), and get().

◆ edges

llvm::SmallVector<mlir::Operation *, 16> circt::BackedgeBuilder::edges
private

◆ loc

mlir::Location circt::BackedgeBuilder::loc
private

Definition at line 73 of file BackedgeBuilder.h.

Referenced by BackedgeBuilder(), BackedgeBuilder(), clearOrEmitError(), and get().

◆ rewriter

mlir::PatternRewriter* circt::BackedgeBuilder::rewriter
private

Definition at line 72 of file BackedgeBuilder.h.

Referenced by BackedgeBuilder(), and clearOrEmitError().


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