20 #include "mlir/IR/BuiltinAttributes.h"
21 #include "mlir/IR/BuiltinTypes.h"
22 #include "mlir/IR/Diagnostics.h"
26 using namespace circt;
27 using namespace firrtl;
32 SmallVectorImpl<Attribute> &annotations,
33 json::Path path, MLIRContext *context) {
36 auto *array = value.getAsArray();
39 "Expected OMIR to be an array of nodes, but found something else.");
43 NamedAttrList omirAnnoFields;
48 annotations.push_back(omirAnno);
58 json::Value &value, SmallVectorImpl<Attribute> &annotations,
59 json::Path path, MLIRContext *context) {
63 auto array = value.getAsArray();
66 "Expected annotations to be an array, but found something else.");
71 for (
size_t i = 0, e = (*array).size(); i != e; ++i) {
72 auto object = (*array)[i].getAsObject();
73 auto p = path.index(i);
75 p.report(
"Expected annotations to be an array of objects, but found an "
76 "array of something else.");
81 NamedAttrList metadata;
83 for (
auto field : *
object) {
85 metadata.append(field.first, value);
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
constexpr const char * omirAnnoClass
bool fromOMIRJSON(llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
Convert a JSON value containing OMIR JSON (an array of OMNodes), convert this to an OMIRAnnotation,...
bool importAnnotationsFromJSONRaw(llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
Deserialize a JSON value into FIRRTL Annotations.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Attribute convertJSONToAttribute(MLIRContext *context, llvm::json::Value &value, llvm::json::Path p)
Convert arbitrary JSON to an MLIR Attribute.