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

Pierre van Houtryve via All-commits all-commits at lists.llvm.org
Mon Jun 5 00:28:02 PDT 2023


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

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

  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