13 #include "mlir/Transforms/InliningUtils.h"
15 using namespace circt;
20 struct ArcInlinerInterface :
public mlir::DialectInlinerInterface {
21 using mlir::DialectInlinerInterface::DialectInlinerInterface;
23 bool isLegalToInline(Operation *call, Operation *callable,
24 bool wouldBeCloned)
const override {
25 return isa<CallOp>(call);
27 bool isLegalToInline(Region *dest, Region *src,
bool wouldBeCloned,
28 IRMapping &valueMapping)
const override {
32 bool isLegalToInline(Operation *op, Region *dest,
bool wouldBeCloned,
33 IRMapping &valueMapping)
const override {
37 void handleTerminator(Operation *op,
38 mlir::ValueRange valuesToRepl)
const override {
39 assert(isa<arc::OutputOp>(op));
40 for (
auto [from, to] : llvm::zip(valuesToRepl, op->getOperands()))
41 from.replaceAllUsesWith(to);
46 void ArcDialect::initialize() {
50 #include "circt/Dialect/Arc/Arc.cpp.inc"
54 addInterfaces<ArcInlinerInterface>();
64 Operation *ArcDialect::materializeConstant(OpBuilder &builder, Attribute value,
65 Type type, Location loc) {
67 if (
auto intType = dyn_cast<IntegerType>(type))
68 if (
auto attrValue = dyn_cast<IntegerAttr>(value))
72 auto *parentOp = builder.getBlock()->getParentOp();
73 auto curModule = dyn_cast<hw::HWModuleOp>(parentOp);
77 return builder.create<hw::ParamValueOp>(loc, type, value);
82 #include "circt/Dialect/Arc/ArcDialect.cpp.inc"
83 #include "circt/Dialect/Arc/ArcEnums.cpp.inc"
assert(baseType &&"element must be base type")
bool isValidParameterExpression(Attribute attr, Operation *module)
Return true if the specified attribute tree is made up of nodes that are valid in a parameter express...
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.