Skip to content

Commit 79caedf

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 3486615 commit 79caedf

File tree

4 files changed

+4261
-3845
lines changed

4 files changed

+4261
-3845
lines changed

llvm/utils/TableGen/GlobalISel/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ add_llvm_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
1313
GIMatchDagPredicate.cpp
1414
GIMatchDagPredicateDependencyEdge.cpp
1515
GIMatchTree.cpp
16+
GISelMatchTable.cpp
1617

1718
DEPENDS
1819
vt_gen

0 commit comments

Comments
 (0)