[llvm] [RegAlloc] Add register allocation anti-hints infrastructure (PR #218071)
Diana Picus via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 05:09:26 PDT 2026
================
@@ -852,6 +853,25 @@ class LLVM_ABI TargetRegisterInfo : public MCRegisterInfo {
// Do nothing.
}
+ /// Return true if Reg overlaps one of the anti-hinted register units.
+ bool isAntiHintedReg(MCPhysReg Reg,
+ const BitVector &AntiHintedRegUnits) const;
+
+ /// Apply anti-hints to the allocation order.
+ void applyRegAllocationAntiHints(
+ Register VirtReg, ArrayRef<MCPhysReg> Order,
+ SmallVectorImpl<MCPhysReg> &HintsAndCustomOrder, unsigned NumHints,
+ const BitVector &AntiHintedRegUnits, const MachineFunction &MF,
+ const LiveRegMatrix *Matrix = nullptr,
+ const RegisterClassInfo *RegClassInfo = nullptr) const;
+
+ /// Custom reordering of the allocation order.
+ virtual void filterAndSortForAntiHintedRegs(
----------------
rovka wrote:
Can this be protected instead? Or do you ever envision it being called from anywhere other than `applyRegAllocAntiHints`? Either way it's not super clear without reading the implementation what the relationship between these 2 methods is and when we'd want to call one versus the other, so please add a few more details in the comments.
https://github.com/llvm/llvm-project/pull/218071
More information about the llvm-commits
mailing list