[all-commits] [llvm/llvm-project] d19a38: [NFC][RFC][TableGen] Split GlobalISelEmitter.cpp

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Wed Jun 7 00:35:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d19a3834dce5f9e8c84835ea14e8b434e8aa5fa7
      https://github.com/llvm/llvm-project/commit/d19a3834dce5f9e8c84835ea14e8b434e8aa5fa7
  Author: pvanhout <pierre.vanhoutryve at amd.com>
  Date:   2023-06-07 (Wed, 07 Jun 2023)

  Changed paths:
    M llvm/utils/TableGen/CMakeLists.txt
    M llvm/utils/TableGen/GlobalISelEmitter.cpp
    A llvm/utils/TableGen/GlobalISelMatchTable.cpp
    A llvm/utils/TableGen/GlobalISelMatchTable.h

  Log Message:
  -----------
  [NFC][RFC][TableGen] Split GlobalISelEmitter.cpp

This patch splits the GlobalISelEmitter.cpp file, which imports DAG ISel patterns for GISel, into separate "GISelMatchTable.h/cpp" files.

The main motive is readability & maintainability. GlobalISelEmitter.cpp was about 6400 lines of mixed code, some bits implementing the match table codegen, some others dedicated to importing DAG patterns.

Now it's down to  2700 + a 2150 header + 2000 impl.
It's a tiny bit more lines overall but that's to be expected - moving
inline definitions to out-of-line, adding comments in the .cpp, etc. all of that takes additional space, but I think the tradeoff is worth it.

I did as little unrelated code changes as possible, I would say the biggest change is the introduction of the `gi` namespace used to prevent name conflicts/ODR violations with type common names such as `Matcher`.
It was previously not an issue because all of the code was in an anonymous namespace.

This moves all of the "match table" code out of the file, so predicates,
rules, and actions are all separated now. I believe this helps separating concerns, now `GlobalISelEmitter.cpp` is more focused on importing DAG patterns into GI, instead of also containing the whole match table internals as well.

Note: the new files have a "GISel" prefix to make them distinct from the other "GI" files in the same folder, which are for the combiner.

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D151432




More information about the All-commits mailing list