17 using namespace circt;
24 void FileOp::build(OpBuilder &builder, OperationState &result,
25 StringRef fileName, StringRef symName,
26 llvm::function_ref<
void()> bodyCtor) {
27 MLIRContext *context = builder.getContext();
28 OpBuilder::InsertionGuard guard(builder);
30 auto &props = result.getOrAddProperties<Properties>();
34 builder.createBlock(result.addRegion());
39 void FileOp::build(OpBuilder &builder, OperationState &result,
40 StringAttr fileName, llvm::function_ref<
void()> bodyCtor) {
41 OpBuilder::InsertionGuard guard(builder);
43 auto &props = result.getOrAddProperties<Properties>();
44 props.file_name = fileName;
46 builder.createBlock(result.addRegion());
55 void FragmentOp::build(OpBuilder &builder, OperationState &result,
57 llvm::function_ref<
void()> bodyCtor) {
58 OpBuilder::InsertionGuard guard(builder);
60 auto &props = result.getOrAddProperties<Properties>();
61 props.sym_name = symName;
63 builder.createBlock(result.addRegion());
72 LogicalResult RefOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
73 auto target = getTargetAttr();
74 auto *op = symbolTable.lookupNearestSymbolFrom(getOperation(), target);
76 return emitError(
"invalid symbol reference: ") << target;
77 if (!isa<emit::Emittable>(op))
78 return emitError(
"does not target an emittable op: ") << target;
86 LogicalResult FileListOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
87 for (
auto sym : getFiles()) {
88 Operation *op = symbolTable.lookupNearestSymbolFrom(
89 getOperation(), cast<FlatSymbolRefAttr>(sym));
91 return emitError(
"invalid symbol reference: ") << sym;
93 if (!isa<emit::FileOp>(op))
94 return emitError(
"referenced operation is not a file: ") << sym;
104 #define GET_OP_CLASSES
105 #include "circt/Dialect/Emit/Emit.cpp.inc"
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.