[llvm] [RegAlloc] Add register allocation anti-hints infrastructure (PR #218071)
Syadus Sefat via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 5 09:51:10 PDT 2026
================
@@ -443,6 +443,41 @@ bool TargetRegisterInfo::getRegAllocationHints(
return false;
}
+void TargetRegisterInfo::applyRegAllocationAntiHints(
+ Register VirtReg, ArrayRef<MCPhysReg> Order,
+ SmallVectorImpl<MCPhysReg> &HintsAndCustomOrder, unsigned NumHints,
+ SmallVectorImpl<MCPhysReg> &AntiHints, const MachineFunction &MF,
+ const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const {
+
+ if (AntiHints.empty() || !VRM)
+ return;
+
+ auto isAntiHinted = [&](MCPhysReg Reg) {
+ return llvm::any_of(AntiHints, [&](MCPhysReg AntiHint) {
+ return regsOverlap(Reg, AntiHint);
+ });
+ };
+
+ HintsAndCustomOrder.truncate(NumHints);
+ HintsAndCustomOrder.append(Order.begin(), Order.end());
+
+ // Partition non-anti-hinted register go first
----------------
mssefat wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/218071
More information about the llvm-commits
mailing list