under this new system, dialects can define their own custom attributes, complete with their own print() and parse() callbacks, which can then be used as values in an op's attribute dictionary. alongside custom dialect attributes, the former int, float, and string constant values have been converted to attributes provided by the arith and builtin dialects respectively. the caches for these attributes have also been moved from mie_ctx to their respective dialect data structures. this system will allow new types of attributes to be implemented, including dictionaries, arrays, and references to types themselves (rather than just particular values of a given type).
22 lines
747 B
C
22 lines
747 B
C
#include <mie/dialect/dialect.h>
|
|
#include <mie/macros.h>
|
|
#include <mie/trait/trait-definition.h>
|
|
#include <mie/trait/trait.h>
|
|
|
|
static enum mie_status validate(
|
|
const struct mie_trait_definition *trait_def,
|
|
const struct mie_trait *trait, const struct mie_trait_target *target)
|
|
{
|
|
return MIE_SUCCESS;
|
|
}
|
|
|
|
/* select.graph-op trait:
|
|
* ops with this trait can be used within graph regions. by default, ops cannot
|
|
* be used in graph regions unless they have the graph-op or graph-only traits.
|
|
*/
|
|
MIE_TRAIT_DEFINITION_BEGIN(mie_select_graph_op, "graph-op")
|
|
MIE_TRAIT_DEFINITION_TARGETS(MIE_TRAIT_TARGET_OP | MIE_TRAIT_TARGET_TYPE);
|
|
MIE_TRAIT_DEFINITION_STRUCT(struct mie_trait);
|
|
MIE_TRAIT_DEFINITION_VALIDATE(validate);
|
|
MIE_TRAIT_DEFINITION_END()
|