31 Commits

Author SHA1 Message Date
Krzysztof Parzyszek
3eeebfe83b [RDF] Minor refactoring for clarity, NFC 2023-06-14 09:12:08 -07:00
Krzysztof Parzyszek
198d647fad [RDF] Remove unused variant of getNextShadow, NFC 2023-06-14 09:12:08 -07:00
Krzysztof Parzyszek
ffa2bbc7f4 [RDF] Print something useful for NodeId == 0 instead of crashing 2023-06-14 06:17:33 -07:00
Krzysztof Parzyszek
edfcc3a5d5 [RDF] Remove unused parameter AllRefs from buildPhis 2023-06-14 06:17:32 -07:00
Krzysztof Parzyszek
375d798067 [RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC
Remove all instances of 'using namespace rdf' from files in CodeGen,
all implementation code is explicitly enclosed in 'namespace rdf'.
2023-06-12 17:07:05 -07:00
Krzysztof Parzyszek
2af7036d7b [RDF] Allow RegisterRef to contain register unit
Recommit with the fix for incorrect `constexpr` with `hash` from a later
commit, and a fix for "std::swap(std::less<RegisterRef>...)" issue with
MSVC's `std::map`.
2023-06-12 13:51:31 -07:00
Nico Weber
7b31d3dada Revert "[RDF] Allow RegisterRef to contain register unit" and follow-ups
This reverts commit 859b05b02d3fd9ab6b77f2bed8df6902fe704806.

Also reverts these follow-ups:

Revert "[RDF] Remove `constexpr` from `hash"
This reverts commit 621507ce20ad8eef2986be2712631165e53b7d91.

Revert "[RDF] Do not use trailing return type after all, NFC"
This reverts commit 46e19e3a2c45e7fb5f501bdb983a7151c158304f.

Revert "[RDF] Stop looking when reached code node in getNextRef with NextOnly"
This reverts commit a049ce9d1bd5a7c1c4fcccc6a801b72b00ea8e0f.

Revert "[RDF] Use trailing return type syntax, NFC"
This reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a.

Revert "[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC"
This reverts commit f8ed60b56d1948422dda924fcf450560591e8a19.
2023-06-12 11:35:28 -04:00
Krzysztof Parzyszek
46e19e3a2c [RDF] Do not use trailing return type after all, NFC
This sort of reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a,
the issue with `Use` will be addressed by using fully-qualified name.
2023-06-09 15:36:48 -07:00
Krzysztof Parzyszek
d3b34b7f3a [RDF] Use trailing return type syntax, NFC
The name rdf::Use conflicts with llvm::Use when both namespaces are
used via `using namespace`. Specifically this happened in the declaration
of DataFlowGraph::newUse (in RDFGraph.cpp):
```
using namespace rdf;

Use newUse(...);  <-- Lookup conflict for "Use"
```
Since the TRT lookup starts in a different namespace than that of the
leading type, this serves as a workaround. In general the rdf namespace
will not likely be introduced via `using namespace`, so this shouldn't
be a problem elsewhere.
2023-06-09 11:46:27 -07:00
Krzysztof Parzyszek
f8ed60b56d [RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFC 2023-06-09 11:46:27 -07:00
Krzysztof Parzyszek
859b05b02d [RDF] Allow RegisterRef to contain register unit 2023-06-09 06:19:03 -07:00
Krzysztof Parzyszek
f10f7b0dca [RDF] Add RegisterAggr::refs to return iterator range, NFC 2023-06-08 11:07:57 -07:00
Krzysztof Parzyszek
c6ddd04d73 [RDF] Create individual phi for each indivisible register
This isn't quite using register units, but it's getting close. The phi
generation is driven by register units, but each phi still contains a
reference to a register, potentially with a mask that amounts to a unit.
In cases of explicit register aliasing this may still create phis with
references that are aliased, whereas separate phis would ideally contain
disjoint references (this is all within a single basic block).

Previously phis used maximal registers, now they use minimal. This is a
step towards both, using register units directly, and a simpler liveness
calculation algorithm. The idea is that a phi cannot reach a reference
to anything smaller than the phi itself represents. Before there could
be a phi for R1_R0, now there will be two for this case (assuming R0 and
R1 have one unit each).
2023-06-08 11:07:57 -07:00
Krzysztof Parzyszek
fc3ad148cd [RDF] Use RegisterAggr instead of RegisterSet in few places
This shouldn't change any functionality.
2023-06-08 11:07:57 -07:00
Krzysztof Parzyszek
7fc73104e8 [RDF] Clang-format the sources, NFC 2023-06-08 11:07:56 -07:00
Jay Foad
5022fc2ad3 [CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.
Differential Revision: https://reviews.llvm.org/D151424
2023-06-01 19:17:34 +01:00
Jay Foad
073401e59c [MC] Define and use MCInstrDesc implicit_uses and implicit_defs. NFC.
The new methods return a range for easier iteration. Use them everywhere
instead of getImplicitUses, getNumImplicitUses, getImplicitDefs and
getNumImplicitDefs. A future patch will remove the old methods.

In some use cases the new methods are less efficient because they always
have to scan the whole uses/defs array to count its length, but that
will be fixed in a future patch by storing the number of implicit
uses/defs explicitly in MCInstrDesc. At that point there will be no need
to 0-terminate the arrays.

Differential Revision: https://reviews.llvm.org/D142215
2023-01-23 14:44:58 +00:00
Craig Topper
e72ca520bb [CodeGen] Remove uses of Register::isPhysicalRegister/isVirtualRegister. NFC
Use isPhysical/isVirtual methods.

Reviewed By: foad

Differential Revision: https://reviews.llvm.org/D141715
2023-01-13 14:38:08 -08:00
Krzysztof Parzyszek
0f5385b70e Recommit [RDF] Remove explicit template arguments from Print
The build breakages should be addressed by d4abdd2e3d:
  [CMake] Check CMAKE_CXX_STANDARD and error if it's to old

Thanks to Tobias and Roy for addressing these issues.
2022-08-08 07:28:45 -07:00
Aaron Ballman
32fd0b7fd5 Revert "[RDF] Remove explicit template arguments from Print"
This reverts commit ede96de751224487aea122af8bfb4e82bc54840b.

This breaks the build on Windows with Visual Studio:
https://lab.llvm.org/buildbot/#/builders/123/builds/12134
2022-08-07 08:24:01 -04:00
Krzysztof Parzyszek
2bc390bdd6 [RDF] Use default TargetOperandInfo if not given in constructor
All current in-tree users use the default implementation.
2022-08-06 14:32:52 -05:00
Krzysztof Parzyszek
ede96de751 [RDF] Remove explicit template arguments from Print
CTAD takes care of it.
2022-08-06 13:29:15 -05:00
Kazu Hirata
9e6d1f4b5d [CodeGen] Qualify auto variables in for loops (NFC) 2022-07-17 01:33:28 -07:00
Kazu Hirata
34ff78c5cf [CodeGen] Remove restrictRef (NFC)
The last use was removed on Apr 14, 2017 in commit
4fe9d6c640e81457db1350766bf6dfef118bcacd.
2022-06-13 23:08:48 -07:00
serge-sans-paille
989f1c72e0 Cleanup codegen includes
This is a (fixed) recommit of https://reviews.llvm.org/D121169

after:  1061034926
before: 1063332844

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D121681
2022-03-16 08:43:00 +01:00
Nico Weber
a278250b0f Revert "Cleanup codegen includes"
This reverts commit 7f230feeeac8a67b335f52bd2e900a05c6098f20.
Breaks CodeGenCUDA/link-device-bitcode.cu in check-clang,
and many LLVM tests, see comments on https://reviews.llvm.org/D121169
2022-03-10 07:59:22 -05:00
serge-sans-paille
7f230feeea Cleanup codegen includes
after:  1061034926
before: 1063332844

Differential Revision: https://reviews.llvm.org/D121169
2022-03-10 10:00:30 +01:00
Kazu Hirata
bb6447a78c [llvm] Use llvm::reverse (NFC) 2021-12-12 16:13:49 -08:00
Kazu Hirata
61efa3d93f [CodeGen] Use range-based for loops (NFC) 2021-02-17 23:58:46 -08:00
Krzysztof Parzyszek
4b25f67299 [RDF] Really remove remaining uses of PhysicalRegisterInfo::normalize 2020-08-04 18:23:38 -05:00
Scott Constable
080dd10f7d Move RDF from Hexagon to Codegen
RDF is designed to be target agnostic. Therefore it would be useful to have it available for other targets, such as X86.

Based on a previous patch by Krzysztof Parzyszek

Differential Revision: https://reviews.llvm.org/D75932
2020-03-17 12:43:14 -07:00