Refactor the support for AffineMap and IntegerSet aliases in the parser into...
authorRiver Riddle <riverriddle@google.com>
Mon, 6 May 2019 17:36:32 +0000 (10:36 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sat, 11 May 2019 02:22:32 +0000 (19:22 -0700)
commit94afc426e2643f29a426e3cde458e2f064147dfd
tree00d4df0231b50783710c05539df5e85d8a210c01
parent3df7a802655bba0f8596bc0ac90296ecdc635e12
Refactor the support for AffineMap and IntegerSet aliases in the parser into more general support for attribute aliases.

      `#` alias `=` attribute-value

    This also allows for dialects to define aliases for attributes in the AsmPrinter. The printer supports two types of attribute aliases, 'direct' and 'kind'.

    * Direct aliases are synonymous with the current support for type aliases, i.e. this maps an alias to a specific instance of an attribute.

    // A direct alias ("foo_str") for the string attribute "foo".
    #foo_str = "foo"

    * Kind aliases generates unique names for all instances of a given attribute kind. The generated aliases are of the form: `alias[0-9]+`.

    // A kind alias ("strattr") for all string attributes could generate.
    #strattr0 = "foo"
    #strattr1 = "bar"
    ...
    #strattrN = "baz"

--

PiperOrigin-RevId: 246851916
mlir/include/mlir/IR/Dialect.h
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/AttributeDetail.h
mlir/lib/Parser/Lexer.cpp
mlir/lib/Parser/Parser.cpp
mlir/test/IR/invalid-affinemap.mlir
mlir/test/IR/invalid.mlir