Add virtual method spillCalleeSaveRegisters() and restoreCalleeSaveRegisters()
authorEvan Cheng <evan.cheng@apple.com>
Tue, 2 Jan 2007 20:55:17 +0000 (20:55 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 2 Jan 2007 20:55:17 +0000 (20:55 +0000)
to MRegisterInfo. These allow the target to issue instructions to spill and
restore callee saved registers in case where individual stores / loads aren't
the correct / profitable choice.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32820 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/MRegisterInfo.h

index a45d53aa3c5152e016aee413394ffdd67cb6406b..c5a41872499001a7df7f9b942eca4ffaf011b2fc 100644 (file)
@@ -29,6 +29,7 @@ class MachineInstr;
 class MachineLocation;
 class MachineMove;
 class TargetRegisterClass;
+class CalleeSavedInfo;
 
 /// TargetRegisterDesc - This record contains all of the information known about
 /// a particular register.  The AliasSet field (if not null) contains a pointer
@@ -319,6 +320,26 @@ public:
   // immediates and memory.  FIXME: Move these to TargetInstrInfo.h.
   //
 
+  /// spillCalleeSaveRegisters - Issues instruction(s) to spill all callee saved
+  /// registers and returns true if it isn't possible / profitable to do so by
+  /// issuing a series of store instructions via storeRegToStackSlot(). Returns
+  /// false otherwise.
+  virtual bool spillCalleeSaveRegisters(MachineBasicBlock &MBB,
+                                        MachineBasicBlock::iterator MI,
+                                const std::vector<CalleeSavedInfo> &CSI) const {
+    return false;
+  }
+
+  /// restoreCalleeSaveRegisters - Issues instruction(s) to restore all callee
+  /// saved registers and returns true if it isn't possible / profitable to do
+  /// so by issuing a series of load instructions via loadRegToStackSlot().
+  /// Returns false otherwise.
+  virtual bool restoreCalleeSaveRegisters(MachineBasicBlock &MBB,
+                                          MachineBasicBlock::iterator MI,
+                                const std::vector<CalleeSavedInfo> &CSI) const {
+    return false;
+  }
+
   virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
                                    MachineBasicBlock::iterator MI,
                                    unsigned SrcReg, int FrameIndex,