[mlir][TypeDefGen] Add support for adding builders when generating a TypeDef
authorRiver Riddle <riddleriver@gmail.com>
Mon, 11 Jan 2021 19:55:00 +0000 (11:55 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Mon, 11 Jan 2021 20:06:22 +0000 (12:06 -0800)
commit948be58258dd81d56b1057657193f7dcf6dfa9bd
treeccd94c9fed1ee50a52993f6419028dec3be18edc
parent207417730134931c7d5bf82e0b16c7757ad05e05
[mlir][TypeDefGen] Add support for adding builders when generating a TypeDef

This allows for specifying additional get/getChecked methods that should be generated on the type, and acts similarly to how OpBuilders work. TypeBuilders have two additional components though:
* InferredContextParam
  - Bit indicating that the context parameter of a get method is inferred from one of the builder parameters
* checkedBody
  - A code block representing the body of the equivalent getChecked method.

Differential Revision: https://reviews.llvm.org/D94274
mlir/docs/OpDefinitions.md
mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/TableGen/TypeDef.h
mlir/lib/TableGen/TypeDef.cpp
mlir/test/lib/Dialect/Test/TestTypeDefs.td
mlir/test/lib/Dialect/Test/TestTypes.cpp
mlir/test/mlir-tblgen/typedefs.td
mlir/tools/mlir-tblgen/TypeDefGen.cpp