[mlir] Add method to populate default attributes
authorJacques Pienaar <jpienaar@google.com>
Fri, 8 Jul 2022 18:31:12 +0000 (11:31 -0700)
committerJacques Pienaar <jpienaar@google.com>
Fri, 8 Jul 2022 18:31:13 +0000 (11:31 -0700)
commit82140ad72814f5544e68643c64e528fa5b734fad
tree9cb24e4c8ba17e7c3137679a352cc0ba66a93976
parent7ecec30e43987f4851130fc08423ab23fec234a4
[mlir] Add method to populate default attributes

Previously default attributes were only usable by way of the ODS generated
accessors, but this was undesirable as
1. The ODS getters could construct Attribute each get request;
2. For non-C++ uses this would require either duplicating some of tee default
   attribute generating or generating additional bindings to generate methods;
3. Accessing op.getAttr("foo") and op.getFoo() would return different results;
Generate method to populate default attributes that can be used to address
these.

This merely adds this facility but does not employ by default on any path.

Differential Revision: https://reviews.llvm.org/D128962
mlir/include/mlir/IR/ExtensibleDialect.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/Operation.h
mlir/include/mlir/IR/OperationSupport.h
mlir/lib/IR/ExtensibleDialect.cpp
mlir/lib/IR/MLIRContext.cpp
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/unittests/IR/OperationSupportTest.cpp