Add support for Unit Attributes.
authorRiver Riddle <riverriddle@google.com>
Thu, 25 Apr 2019 16:56:09 +0000 (09:56 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 6 May 2019 15:16:39 +0000 (08:16 -0700)
commit22ad45a7aa8c5065eca757e518323645d8a7e4f7
treeba4cc853ebcca2621980864dbdb7e269f79e95b4
parent69cdceae73387cafc797ca77530ab4aa20ae4c3a
Add support for Unit Attributes.

    A unit attribute is an attribute that represents a value of `unit` type. The
    `unit` type allows only one value forming a singleton set. This attribute value
    is used to represent attributes that only have meaning from their existence.

    One example of such an attribute could be the `swift.self` attribute. This attribute indicates that a function parameter is the self/context
    parameter. It could be represented as a boolean attribute(true or false), but a
    value of false doesn't really bring any value. The parameter either is the
    self/context or it isn't.

    ```mlir {.mlir}
    // A unit attribute defined with the `unit` value specifier.
    func @verbose_form(i1 {unitAttr : unit})

    // A unit attribute can also be defined without the `unit` value specifier.
    func @simple_form(i1 {unitAttr})
    ```

--

PiperOrigin-RevId: 245254045
mlir/g3doc/LangRef.md
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/Builders.h
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/AttributeDetail.h
mlir/lib/IR/Builders.cpp
mlir/lib/IR/MLIRContext.cpp
mlir/lib/Parser/Parser.cpp
mlir/lib/Parser/TokenKinds.def
mlir/test/IR/invalid.mlir
mlir/test/IR/parser.mlir