Skip to content

Commit d19a383

Browse files
committed
[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
1 parent 8df5841 commit d19a383

File tree

4 files changed

+4261
-3845
lines changed

4 files changed

+4261
-3845
lines changed

llvm/utils/TableGen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ add_tablegen(llvm-tblgen LLVM
6161
FastISelEmitter.cpp
6262
GICombinerEmitter.cpp
6363
GlobalISelEmitter.cpp
64+
GlobalISelMatchTable.cpp
6465
InfoByHwMode.cpp
6566
InstrInfoEmitter.cpp
6667
InstrDocsEmitter.cpp

0 commit comments

Comments
 (0)