[mlir] Generate Dialect constructors in .cpp instead of .h
authorRiver Riddle <riddleriver@gmail.com>
Fri, 22 Apr 2022 21:16:06 +0000 (14:16 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Sat, 23 Apr 2022 07:44:54 +0000 (00:44 -0700)
commitf3ebf828dc54bf488ad49d5ec2f070ea36a31e6f
treee98a8ba07ed050c8a04796d108277189db72c644
parenta48300aee570f8eea4ec0b03e2d176aab648afb0
[mlir] Generate Dialect constructors in .cpp instead of .h

By generating in the .h file, we were forcing dialects to include
a lot of additional header files because:

* Fields of the dialect, e.g. std::unique_ptr<>, were unable to use
  forward declarations.
* Dependent dialects are loaded in the constructor, requiring the
  full definition of each dependent dialect (which, depending on
  the file structure of the dialect, may include the operations).

By generating in the .cpp we get much faster builds, and also
better align with the rest of the code base.

Fixes #55044

Differential Revision: https://reviews.llvm.org/D124297
mlir/tools/mlir-tblgen/DialectGen.cpp