Add a variant of foldMemoryOperand to fold any load / store, not just load / store...
authorEvan Cheng <evan.cheng@apple.com>
Thu, 30 Aug 2007 05:52:20 +0000 (05:52 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 30 Aug 2007 05:52:20 +0000 (05:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41597 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/LiveIntervalAnalysis.h
include/llvm/Target/MRegisterInfo.h
lib/Target/ARM/ARMRegisterInfo.h
lib/Target/Alpha/AlphaRegisterInfo.h
lib/Target/Mips/MipsRegisterInfo.h
lib/Target/PowerPC/PPCRegisterInfo.h
lib/Target/Sparc/SparcRegisterInfo.h

index 59d482e955e741136f9675df76bf481a4e5bd25d..bf78475a01f136787a610740893daec8082f3f7a 100644 (file)
@@ -242,11 +242,13 @@ namespace llvm {
     bool isReMaterializable(const LiveInterval &li, const VNInfo *ValNo,
                             MachineInstr *MI);
 
-    /// tryFoldMemoryOperand - Attempts to fold a spill / restore from slot
-    /// to reg into ith operand of specified MI. If it is successul, MI is
-    /// updated with the newly created MI and returns true.
-    bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm, unsigned index,
-                              unsigned i, int slot, unsigned reg);
+    /// tryFoldMemoryOperand - Attempts to fold either a spill / restore from
+    /// slot / to reg or any rematerialized load into ith operand of specified
+    /// MI. If it is successul, MI is updated with the newly created MI and
+    /// returns true.
+    bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm,
+                              unsigned index, unsigned i, bool isSS,
+                              MachineInstr *DefMI, int slot, unsigned reg);
 
     static LiveInterval createInterval(unsigned Reg);
 
index d88bcf0c7c2ffa491c959e216b3b298998dfd59f..a4846d8afa8aba332d386eeea0d5eb10336ec2ae 100644 (file)
@@ -521,6 +521,15 @@ public:
     return 0;
   }
 
+  /// foldMemoryOperand - Same as the previous version except it allows folding
+  /// of any load and store from / to any address, not just from a specific
+  /// stack slot.
+  virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
+                                          unsigned OpNum,
+                                          MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   /// targetHandlesStackFrameRounding - Returns true if the target is responsible
   /// for rounding up the stack frame (probably at emitPrologue time).
   virtual bool targetHandlesStackFrameRounding() const {
index a425bb6f903b774700502a5463084308e077bd58..614eaec5b7c71aaf43806618eb485fc5a32a3b02 100644 (file)
@@ -66,6 +66,11 @@ public:
   MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
                                   int FrameIndex) const;
 
+  MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
+                                  MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
 
   const TargetRegisterClass* const*
index 2872e595bb0f13571907543e6cb0c9c304a8c070..354c3a12f3a1395d4df315c798d6438cfb981d5a 100644 (file)
@@ -41,6 +41,11 @@ struct AlphaRegisterInfo : public AlphaGenRegisterInfo {
   MachineInstr* foldMemoryOperand(MachineInstr *MI, unsigned OpNum, 
                                   int FrameIndex) const;
 
+  MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
+                                  MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                     unsigned DestReg, unsigned SrcReg,
                     const TargetRegisterClass *RC) const;
index cc8215c8649dacb604af8bd3750cc349d3708949..2727910972d05ce385b5dd4b07e94f61eda234fe 100644 (file)
@@ -48,6 +48,11 @@ struct MipsRegisterInfo : public MipsGenRegisterInfo {
   MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
                                   int FrameIndex) const;
 
+  MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
+                                  MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
           unsigned DestReg, unsigned SrcReg,
           const TargetRegisterClass *RC) const;
index 0a1446eb78020378287f987112df1fa0909d55bd..19bec1ca7f844b5eb8aa60a8fbcf5713c07cafd0 100644 (file)
@@ -57,6 +57,11 @@ public:
   virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
                                           int FrameIndex) const;
   
+  virtual MachineInstr* foldMemoryOperand(MachineInstr* MI, unsigned OpNum,
+                                          MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
 
   const TargetRegisterClass* const*
index 451964b2f75ff6a886c6bc044824d45e6258d117..bcb09d475e126683b01c09f08414e1749df2db60 100644 (file)
@@ -51,6 +51,12 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
                                           unsigned OpNum,
                                           int FrameIndex) const;
 
+  virtual MachineInstr* foldMemoryOperand(MachineInstr* MI,
+                                          unsigned OpNum,
+                                          MachineInstr* LoadMI) const {
+    return 0;
+  }
+
   const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
 
   const TargetRegisterClass* const* getCalleeSavedRegClasses(