15 #include "mlir/IR/BuiltinAttributes.h"
16 #include "mlir/IR/OperationSupport.h"
25 json::Value &value, SmallVectorImpl<Attribute> &annotations,
26 json::Path path, MLIRContext *context) {
30 auto *array = value.getAsArray();
33 "Expected annotations to be an array, but found something else.");
38 for (
size_t i = 0, e = (*array).size(); i != e; ++i) {
39 auto *
object = (*array)[i].getAsObject();
40 auto p = path.index(i);
42 p.report(
"Expected annotations to be an array of objects, but found an "
43 "array of something else.");
48 NamedAttrList metadata;
50 for (
auto field : *
object) {
52 metadata.append(field.first, value);
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
bool importAnnotationsFromJSONRaw(llvm::json::Value &value, SmallVectorImpl< Attribute > &annotations, llvm::json::Path path, MLIRContext *context)
Deserialize a JSON value into FIRRTL Annotations.
Attribute convertJSONToAttribute(MLIRContext *context, llvm::json::Value &value, llvm::json::Path p)
Convert arbitrary JSON to an MLIR Attribute.