Commit Graph

8 Commits

Author SHA1 Message Date
Jean-Michel Gorius 05b4ff0a4b [mlir-tblgen] Use fully qualified names in generated code files
Using fully qualified names wherever possible avoids ambiguous class and function names. This is a follow-up to D82371.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D82471
2020-06-26 15:05:33 +02:00
Jean-Michel Gorius 1db1a08dda [mlir] Avoid pontentially ambiguous class name
Summary: The Pass class exists in both the mlir and the llvm namespaces. Use the fully qualified class name to avoid any ambiguities.

Reviewers: rriddle

Reviewed By: rriddle

Subscribers: mehdi_amini, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, jurahul, msifontes

Tags: #mlir

Differential Revision: https://reviews.llvm.org/D82371
2020-06-23 21:24:43 +02:00
River Riddle a517191a47 [mlir][NFC] Refactor ClassID into a TypeID class.
Summary: ClassID is a bit janky right now as it involves passing a magic pointer around. This revision hides the internal implementation mechanism within a new class TypeID. This class is a value-typed wrapper around the original ClassID implementation.

Differential Revision: https://reviews.llvm.org/D77768
2020-04-10 23:52:33 -07:00
River Riddle 7824768b2e [mlir][Pass] Add a new `Pass::getArgument` hook
Summary: This hook allows for passes to specify the command line argument without the need for registration. More concretely this will allow for generating pass crash reproducers without needing to have the passes registered. This should remove the need for production tools to register passes, leaving that solely to development tools like mlir-opt.

Differential Revision: https://reviews.llvm.org/D77907
2020-04-10 22:50:14 -07:00
River Riddle 1834ad4a69 [mlir][Pass] Update the PassGen to generate base classes instead of utilities
Summary:
This is much cleaner, and fits the same structure as many other tablegen backends. This was not done originally as the CRTP in the pass classes made it overly verbose/complex.

Differential Revision: https://reviews.llvm.org/D77367
2020-04-07 14:08:52 -07:00
Mehdi Amini ee4d034277 Change pass registration generated code to allow users to selectively register passes
This slightly tweaks the generated code from:

  #ifdef GEN_PASS_REGISTRATION
  ::mlir::registerPass("flag1", ...
  ::mlir::registerPass("flag2", ...
  #endif // GEN_PASS_REGISTRATION

to:

  #ifdef GEN_PASS_REGISTRATION
  #define GEN_PASS_REGISTRATION_Pass1
  #define GEN_PASS_REGISTRATION_Pass2
  #endif // GEN_PASS_REGISTRATION

  #ifdef GEN_PASS_REGISTRATION_Pass1
  ::mlir::registerPass("flag1", ...
  #endif
  #ifdef GEN_PASS_REGISTRATION_Pass1
  ::mlir::registerPass("flag2", ...
  #endif

That way the generated code can be included by defining the
`GEN_PASS_REGISTRATION` macro as currenty and register all the passes,
but one can also define only `GEN_PASS_REGISTRATION_Pass1` to register a
subset of the passes.

Differential Revision: https://reviews.llvm.org/D77322
2020-04-02 18:58:47 +00:00
River Riddle 9a277af2d4 [mlir][Pass] Add support for generating pass utilities via tablegen
This revision adds support for generating utilities for passes such as options/statistics/etc. that can be inferred from the tablegen definition. This removes additional boilerplate from the pass, and also makes it easier to remove the reliance on the pass registry to provide certain things(e.g. the pass argument).

Differential Revision: https://reviews.llvm.org/D76659
2020-04-01 02:10:46 -07:00
River Riddle 8155e41ac6 [mlir][Pass] Add a tablegen backend for defining Pass information
This will greatly simplify a number of things related to passes:
* Enables generation of pass registration
* Enables generation of boiler plate pass utilities
* Enables generation of pass documentation

This revision focuses on adding the basic structure and adds support for generating the registration for passes in the Transforms/ directory. Future revisions will add more support and move more passes over.

Differential Revision: https://reviews.llvm.org/D76656
2020-04-01 02:10:46 -07:00