summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/RDFGraph.cpp
AgeCommit message (Collapse)Author
2025-03-28[llvm] Use range constructors of *Set (NFC) (#133549)Kazu Hirata
2025-03-20[llvm] Use *Set::insert_range (NFC) (#132325)Kazu Hirata
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently gained C++23-style insert_range. This patch replaces: Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); This patch does not touch custom begin like succ_begin for now.
2025-02-07[RDF] Create phi nodes for clobbering defs (#123694)Yashas Andaluri
When a def in a block A reaches another block B that is in A's iterated dominance frontier, a phi node is added to B for the def register. A clobbering def can be created at a call instruction, for a register clobbered by a call. However, phi nodes are not created for a register, when one of the reaching defs of the register is a clobbering def. This patch adds phi nodes for registers that have a clobbering reaching def. These additional phis help in checking reaching defs for an instruction in RDF based copy propagation and addressing mode optimizations.
2024-11-19[RDF] Fix cover check when linking refs to defs (#113888)Yashas Andaluri
During RDF graph construction, linkRefUp method links a register ref to its upward reaching defs until all RegUnits of the ref have been covered by defs. However, when a sub-register def covers some, but not all, of the RegUnits of a previous super-register def, a super-register ref is not linked to the super-register def. This can result in certain super register defs being dead code eliminated. This patch fixes the cover check for a register ref. A def must be skipped only when all RegUnits of that def have already been covered by a previously seen def.
2024-11-12[CodeGen] Remove unused includes (NFC) (#115996)Kazu Hirata
Identified with misc-include-cleaner.
2024-08-25[CodeGen] Use std::pair<MCRegister, Register> to match return from ↵Craig Topper
MRI.liveins(). NFC MachineRegisterInfo::liveins returns std::pair<MCRegister, Register>. Don't convert to std::pair<unsigned, unsigned>.
2024-05-02[llvm] Make lambda take const reference to prevent unneeded copy (NFC)Youngsuk Kim
Closes #89198
2024-02-05[RDF] Skip over NoRegister. NFCI. (#80672)Jay Foad
This just avoids useless work of adding NoRegister to BaseSet, for consistency with other places that iterate over all physical registers.
2024-01-12[llvm] Use llvm::is_contained (NFC)Kazu Hirata
2023-06-14[RDF] Create build configKrzysztof Parzyszek
- Add option to ignore reserved registers - Add possibility to track selected registers or register classes only Tracking is done based on register units, so the set of registers to track is translated into a set of register units.
2023-06-14[RDF] Minor refactoring for clarity, NFCKrzysztof Parzyszek
2023-06-14[RDF] Remove unused variant of getNextShadow, NFCKrzysztof Parzyszek
2023-06-14[RDF] Print something useful for NodeId == 0 instead of crashingKrzysztof Parzyszek
2023-06-14[RDF] Remove unused parameter AllRefs from buildPhisKrzysztof Parzyszek
2023-06-12[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFCKrzysztof Parzyszek
Remove all instances of 'using namespace rdf' from files in CodeGen, all implementation code is explicitly enclosed in 'namespace rdf'.
2023-06-12[RDF] Allow RegisterRef to contain register unitKrzysztof Parzyszek
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-12Revert "[RDF] Allow RegisterRef to contain register unit" and follow-upsNico Weber
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-09[RDF] Do not use trailing return type after all, NFCKrzysztof Parzyszek
This sort of reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a, the issue with `Use` will be addressed by using fully-qualified name.
2023-06-09[RDF] Use trailing return type syntax, NFCKrzysztof Parzyszek
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[RDF] Define short type names: NodeAddr<XyzNode*> -> Xyz, NFCKrzysztof Parzyszek
2023-06-09[RDF] Allow RegisterRef to contain register unitKrzysztof Parzyszek
2023-06-08[RDF] Add RegisterAggr::refs to return iterator range, NFCKrzysztof Parzyszek
2023-06-08[RDF] Create individual phi for each indivisible registerKrzysztof Parzyszek
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[RDF] Use RegisterAggr instead of RegisterSet in few placesKrzysztof Parzyszek
This shouldn't change any functionality.
2023-06-08[RDF] Clang-format the sources, NFCKrzysztof Parzyszek
2023-06-01[CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.Jay Foad
Differential Revision: https://reviews.llvm.org/D151424
2023-01-23[MC] Define and use MCInstrDesc implicit_uses and implicit_defs. NFC.Jay Foad
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-13[CodeGen] Remove uses of Register::isPhysicalRegister/isVirtualRegister. NFCCraig Topper
Use isPhysical/isVirtual methods. Reviewed By: foad Differential Revision: https://reviews.llvm.org/D141715
2022-08-08Recommit [RDF] Remove explicit template arguments from PrintKrzysztof Parzyszek
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-07Revert "[RDF] Remove explicit template arguments from Print"Aaron Ballman
This reverts commit ede96de751224487aea122af8bfb4e82bc54840b. This breaks the build on Windows with Visual Studio: https://lab.llvm.org/buildbot/#/builders/123/builds/12134
2022-08-06[RDF] Use default TargetOperandInfo if not given in constructorKrzysztof Parzyszek
All current in-tree users use the default implementation.
2022-08-06[RDF] Remove explicit template arguments from PrintKrzysztof Parzyszek
CTAD takes care of it.
2022-07-17[CodeGen] Qualify auto variables in for loops (NFC)Kazu Hirata
2022-06-13[CodeGen] Remove restrictRef (NFC)Kazu Hirata
The last use was removed on Apr 14, 2017 in commit 4fe9d6c640e81457db1350766bf6dfef118bcacd.
2022-03-16Cleanup codegen includesserge-sans-paille
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-10Revert "Cleanup codegen includes"Nico Weber
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-10Cleanup codegen includesserge-sans-paille
after: 1061034926 before: 1063332844 Differential Revision: https://reviews.llvm.org/D121169
2021-12-12[llvm] Use llvm::reverse (NFC)Kazu Hirata
2021-02-17[CodeGen] Use range-based for loops (NFC)Kazu Hirata
2020-08-04[RDF] Really remove remaining uses of PhysicalRegisterInfo::normalizeKrzysztof Parzyszek
2020-03-17Move RDF from Hexagon to CodegenScott Constable
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