[all-commits] [llvm/llvm-project] 7d8106: [GlobalISel] Refactor Combiner MatchData & Apply C...
Pierre van Houtryve via All-commits
all-commits at lists.llvm.org
Thu May 16 04:39:22 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7d81062352f75cf328d91d4900af52c1842b950e
https://github.com/llvm/llvm-project/commit/7d81062352f75cf328d91d4900af52c1842b950e
Author: Pierre van Houtryve <pierre.vanhoutryve at amd.com>
Date: 2024-05-16 (Thu, 16 May 2024)
Changed paths:
M llvm/docs/GlobalISel/MIRPatterns.rst
M llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
M llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
M llvm/include/llvm/Target/GlobalISel/Combine.td
A llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-cxx.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-permutations.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table-variadics.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/match-table.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/patfrag-errors.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-errors.td
M llvm/test/TableGen/GlobalISelCombinerEmitter/pattern-parsing.td
M llvm/test/TableGen/GlobalISelEmitter.td
M llvm/test/TableGen/GlobalISelEmitterHwModes.td
M llvm/utils/TableGen/Common/CMakeLists.txt
M llvm/utils/TableGen/Common/GlobalISel/CXXPredicates.cpp
M llvm/utils/TableGen/Common/GlobalISel/CXXPredicates.h
M llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp
M llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h
M llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
M llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.h
R llvm/utils/TableGen/Common/GlobalISel/MatchDataInfo.cpp
R llvm/utils/TableGen/Common/GlobalISel/MatchDataInfo.h
M llvm/utils/TableGen/Common/GlobalISel/Patterns.cpp
M llvm/utils/TableGen/Common/GlobalISel/Patterns.h
M llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
M llvm/utils/TableGen/GlobalISelEmitter.cpp
Log Message:
-----------
[GlobalISel] Refactor Combiner MatchData & Apply C++ Code Handling (#92239)
Combiners that use C++ code in their "apply" pattern only use that. They
never mix it with MIR patterns as that has little added value.
This patch restricts C++ apply code so that if C++ is used, we cannot
use MIR patterns or builtins with it. Adding this restriction allows us
to merge calls to match and apply C++ code together, which in turns
makes it so we can just have MatchData variables on the stack.
So before, we would have
```
GIM_CheckCxxInsnPredicate // match
GIM_CheckCxxInsnPredicate // apply
GIR_Done
```
Alongside a massive C++ struct holding the MatchData of all rules
possible (which was a big space/perf issue).
Now we just have
```
GIR_DoneWithCustomAction
```
And the function being ran just does
```
unsigned SomeMatchData;
if (match(SomeMatchData))
apply(SomeMatchData)
```
This approach solves multiple issues in one:
- MatchData handling is greatly simplified and more efficient, "don't
pay for what you don't use"
- We reduce the size of the match table
- Calling C++ code has a certain overhead (we need a switch), and this
overhead is only paid once now.
Handling of C++ code inside PatFrags is unchanged though, that still
emits a `GIM_CheckCxxInsnPredicate`. This is completely fine as they
can't use MatchDatas.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list