diff options
author | Sergei Barannikov <barannikov88@gmail.com> | 2025-04-26 15:25:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-26 15:25:40 +0300 |
commit | bb1765179e1fe7d671edf92eba22da2ed4173848 (patch) | |
tree | fc4ffffbae35c6ca8997988174c21b83a8142955 /llvm/lib/CodeGen/LiveDebugVariables.cpp | |
parent | 28293ea023c1aeeed3bff0e2d06feacc9bc365cd (diff) | |
download | llvm-bb1765179e1fe7d671edf92eba22da2ed4173848.zip llvm-bb1765179e1fe7d671edf92eba22da2ed4173848.tar.gz llvm-bb1765179e1fe7d671edf92eba22da2ed4173848.tar.bz2 |
[TTI] Simplify implementation (NFCI) (#136674)
Replace "concept based polymorphism" with simpler PImpl idiom.
This pursues two goals:
* Enforce static type checking. Previously, target implementations hid
base class methods and type checking was impossible. Now that they
override the methods, the compiler will complain on mismatched
signatures.
* Make the code easier to navigate. Previously, if you asked your
favorite LSP server to show a method (e.g. `getInstructionCost()`), it
would show you methods from `TTI`, `TTI::Concept`, `TTI::Model`,
`TTIImplBase`, and target overrides. Now it is two less :)
There are three commits to hopefully simplify the review.
The first commit removes `TTI::Model`. This is done by deriving
`TargetTransformInfoImplBase` from `TTI::Concept`. This is possible
because they implement the same set of interfaces with identical
signatures.
The first commit makes `TargetTransformImplBase` polymorphic, which
means all derived classes should `override` its methods. This is done in
second commit to make the first one smaller. It appeared infeasible to
extract this into a separate PR because the first commit landed
separately would result in tons of `-Woverloaded-virtual` warnings (and
break `-Werror` builds).
The third commit eliminates `TTI::Concept` by merging it with the only
derived class `TargetTransformImplBase`. This commit could be extracted
into a separate PR, but it touches the same lines in
`TargetTransformInfoImpl.h` (removes `override` added by the second
commit and adds `virtual`), so I thought it may make sense to land these
two commits together.
Pull Request: https://github.com/llvm/llvm-project/pull/136674
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
0 files changed, 0 insertions, 0 deletions