16 #include "mlir/IR/BuiltinOps.h"
17 #include "mlir/IR/PatternMatch.h"
19 using namespace circt;
25 assert(!
set &&
"backedge already set to a value!");
26 value.replaceAllUsesWith(newValue);
38 unsigned numInUse = 0;
39 for (Operation *op :
edges) {
40 if (!op->use_empty()) {
41 auto diag = op->emitError(
"backedge of type ")
42 << op->getResult(0).getType() <<
" still in use";
43 for (
auto user : op->getUsers())
44 diag.attachNote(user->getLoc()) <<
"used by " << *user;
55 mlir::emitRemark(
loc,
"abandoned ") << numInUse <<
" backedges";
56 return success(numInUse == 0);
62 : builder(builder), rewriter(nullptr), loc(loc) {}
64 : builder(rewriter), rewriter(&rewriter), loc(loc) {}
68 Operation *op =
builder.create<mlir::UnrealizedConversionCastOp>(
69 optionalLoc, t, ValueRange{});
assert(baseType &&"element must be base type")
void abandon()
Abandon the backedges, suppressing any diagnostics if they are still active upon destruction of the b...
llvm::SmallVector< mlir::Operation *, 16 > edges
Backedge get(mlir::Type resultType, mlir::LocationAttr optionalLoc={})
Create a typed backedge.
mlir::OpBuilder & builder
mlir::PatternRewriter * rewriter
mlir::LogicalResult clearOrEmitError()
Clear the backedges, erasing any remaining cursor ops.
BackedgeBuilder(mlir::OpBuilder &builder, mlir::Location loc)
To build a backedge op and manipulate it, we need a PatternRewriter and a Location.
Backedge is a wrapper class around a Value.
void setValue(mlir::Value)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.