[PATCH] D116074: [NFC] Expose isRematerializable and copyHint from CalcSpillWeights

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 08:20:04 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG64e56f835641: [NFC] Expose isRematerializable and copyHint from CalcSpillWeights (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116074/new/

https://reviews.llvm.org/D116074

Files:
  llvm/include/llvm/CodeGen/CalcSpillWeights.h
  llvm/lib/CodeGen/CalcSpillWeights.cpp


Index: llvm/lib/CodeGen/CalcSpillWeights.cpp
===================================================================
--- llvm/lib/CodeGen/CalcSpillWeights.cpp
+++ llvm/lib/CodeGen/CalcSpillWeights.cpp
@@ -43,9 +43,9 @@
 }
 
 // Return the preferred allocation register for reg, given a COPY instruction.
-static Register copyHint(const MachineInstr *MI, unsigned Reg,
-                         const TargetRegisterInfo &TRI,
-                         const MachineRegisterInfo &MRI) {
+Register VirtRegAuxInfo::copyHint(const MachineInstr *MI, unsigned Reg,
+                                  const TargetRegisterInfo &TRI,
+                                  const MachineRegisterInfo &MRI) {
   unsigned Sub, HSub;
   Register HReg;
   if (MI->getOperand(0).getReg() == Reg) {
@@ -77,9 +77,10 @@
 }
 
 // Check if all values in LI are rematerializable
-static bool isRematerializable(const LiveInterval &LI, const LiveIntervals &LIS,
-                               const VirtRegMap &VRM,
-                               const TargetInstrInfo &TII) {
+bool VirtRegAuxInfo::isRematerializable(const LiveInterval &LI,
+                                        const LiveIntervals &LIS,
+                                        const VirtRegMap &VRM,
+                                        const TargetInstrInfo &TII) {
   Register Reg = LI.reg();
   Register Original = VRM.getOriginal(Reg);
   for (LiveInterval::const_vni_iterator I = LI.vni_begin(), E = LI.vni_end();
Index: llvm/include/llvm/CodeGen/CalcSpillWeights.h
===================================================================
--- llvm/include/llvm/CodeGen/CalcSpillWeights.h
+++ llvm/include/llvm/CodeGen/CalcSpillWeights.h
@@ -80,6 +80,18 @@
     /// live intervals.
     void calculateSpillWeightsAndHints();
 
+    /// Return the preferred allocation register for reg, given a COPY
+    /// instruction.
+    static Register copyHint(const MachineInstr *MI, unsigned Reg,
+                             const TargetRegisterInfo &TRI,
+                             const MachineRegisterInfo &MRI);
+
+    /// Determine if all values in LI are rematerializable.
+    static bool isRematerializable(const LiveInterval &LI,
+                                   const LiveIntervals &LIS,
+                                   const VirtRegMap &VRM,
+                                   const TargetInstrInfo &TII);
+
   protected:
     /// Helper function for weight calculations.
     /// (Re)compute LI's spill weight and allocation hint, or, for non null


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116074.397310.patch
Type: text/x-patch
Size: 2512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/fdacf5fd/attachment.bin>


More information about the llvm-commits mailing list