These methods no longer take a TargetRegisterClass* operand.
authorChris Lattner <sabre@nondot.org>
Sun, 15 Aug 2004 21:56:44 +0000 (21:56 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 15 Aug 2004 21:56:44 +0000 (21:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15774 91177308-0d34-0410-b5e6-96231b3b80d8

16 files changed:
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/RegAllocLocal.cpp
lib/CodeGen/RegAllocSimple.cpp
lib/CodeGen/VirtRegMap.cpp
lib/Target/PowerPC/PowerPCRegisterInfo.cpp
lib/Target/PowerPC/PowerPCRegisterInfo.h
lib/Target/Skeleton/SkeletonRegisterInfo.cpp
lib/Target/Skeleton/SkeletonRegisterInfo.h
lib/Target/Sparc/SparcRegisterInfo.cpp
lib/Target/Sparc/SparcRegisterInfo.h
lib/Target/SparcV8/SparcV8RegisterInfo.cpp
lib/Target/SparcV8/SparcV8RegisterInfo.h
lib/Target/SparcV9/SparcV9RegisterInfo.cpp
lib/Target/SparcV9/SparcV9RegisterInfo.h
lib/Target/X86/X86RegisterInfo.cpp
lib/Target/X86/X86RegisterInfo.h

index 1a07013ac3080d1c6ce6e3860eb22df5c489e7c4..d9443c83e7550fe9ee15828dc7bde53de5408ef4 100644 (file)
@@ -206,10 +206,8 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
   MachineBasicBlock *MBB = Fn.begin();
   MachineBasicBlock::iterator I = MBB->begin();
   for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
-    const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
-
-    // Insert the spill to the stack frame...
-    RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i], RC);
+    // Insert the spill to the stack frame.
+    RegInfo->storeRegToStackSlot(*MBB, I, RegsToSave[i], StackSlots[i]);
   }
 
   // Add code to restore the callee-save registers in each exiting block.
@@ -221,8 +219,7 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
       I = MBB->end(); --I;
 
       for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
-        const TargetRegisterClass *RC = RegInfo->getRegClass(RegsToSave[i]);
-        RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i], RC);
+        RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i],StackSlots[i]);
         --I;  // Insert in reverse order
       }
     }
index bea603ce49667b7a8c6f4053816b24d9ebbb4c0d..68d5fd95eedbc200fa1738744d4587e58d2f5ce3 100644 (file)
@@ -267,7 +267,7 @@ void RA::spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
     const TargetRegisterClass *RC = MF->getSSARegMap()->getRegClass(VirtReg);
     int FrameIndex = getStackSpaceFor(VirtReg, RC);
     DEBUG(std::cerr << " to stack slot #" << FrameIndex);
-    RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIndex, RC);
+    RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIndex);
     ++NumStores;   // Update statistics
   }
 
@@ -506,7 +506,7 @@ MachineInstr *RA::reloadVirtReg(MachineBasicBlock &MBB, MachineInstr *MI,
                   << RegInfo->getName(PhysReg) << "\n");
 
   // Add move instruction(s)
-  RegInfo->loadRegFromStackSlot(MBB, MI, PhysReg, FrameIndex, RC);
+  RegInfo->loadRegFromStackSlot(MBB, MI, PhysReg, FrameIndex);
   ++NumLoads;    // Update statistics
 
   MI->SetMachineOperandReg(OpNum, PhysReg);  // Assign the input register
index 4c1e371c723b3c500a43a5ddb50a36452bd7caa8..320b2679337fa90daa24aab501cd0470b1dac71d 100644 (file)
@@ -131,7 +131,7 @@ unsigned RegAllocSimple::reloadVirtReg(MachineBasicBlock &MBB,
 
   // Add move instruction(s)
   ++NumLoads;
-  RegInfo->loadRegFromStackSlot(MBB, I, PhysReg, FrameIdx, RC);
+  RegInfo->loadRegFromStackSlot(MBB, I, PhysReg, FrameIdx);
   return PhysReg;
 }
 
@@ -143,7 +143,7 @@ void RegAllocSimple::spillVirtReg(MachineBasicBlock &MBB,
 
   // Add move instruction(s)
   ++NumStores;
-  RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIdx, RC);
+  RegInfo->storeRegToStackSlot(MBB, I, PhysReg, FrameIdx);
 }
 
 
index 572bace5944619151f0cf72a6261cb6c10d22a3d..e84652ece0624a4f6d2d4193a70836fdec1309eb 100644 (file)
@@ -144,8 +144,7 @@ namespace {
                                     *mbbi,
                                     mii,
                                     physReg,
-                                    vrm.getStackSlot(virtReg),
-                                    mf.getSSARegMap()->getRegClass(virtReg));
+                                    vrm.getStackSlot(virtReg));
                                 loaded[virtReg] = true;
                                 DEBUG(std::cerr << '\t';
                                       prior(mii)->print(std::cerr, &tm));
@@ -157,8 +156,7 @@ namespace {
                                     *mbbi,
                                     next(mii),
                                     physReg,
-                                    vrm.getStackSlot(virtReg),
-                                    mf.getSSARegMap()->getRegClass(virtReg));
+                                    vrm.getStackSlot(virtReg));
                                 ++numStores;
                             }
                             mii->SetMachineOperandReg(i, physReg);
@@ -226,8 +224,7 @@ namespace {
                 mri_->storeRegToStackSlot(*lastDef->getParent(),
                                           nextLastRef,
                                           physReg,
-                                          vrm_->getStackSlot(virtReg),
-                                          mri_->getRegClass(physReg));
+                                          vrm_->getStackSlot(virtReg));
                 ++numStores;
                 DEBUG(std::cerr << "added: ";
                       prior(nextLastRef)->print(std::cerr, tm_);
@@ -258,8 +255,7 @@ namespace {
                 // load if necessary
                 if (vrm_->hasStackSlot(virtReg)) {
                     mri_->loadRegFromStackSlot(mbb, mii, physReg,
-                                               vrm_->getStackSlot(virtReg),
-                                               mri_->getRegClass(physReg));
+                                               vrm_->getStackSlot(virtReg));
                     ++numLoads;
                     DEBUG(std::cerr << "added: ";
                           prior(mii)->print(std::cerr, tm_));
index 94430d5d7a26670f32be6bed65073817db7874f9..b1e3dd2b5c4d97575b71ec8c3a505bcf3bd4e809 100644 (file)
@@ -71,11 +71,12 @@ static unsigned getIdx(const TargetRegisterClass *RC) {
 int 
 PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
                                          MachineBasicBlock::iterator MI,
-                                         unsigned SrcReg, int FrameIdx,
-                                         const TargetRegisterClass *RC) const {
+                                         unsigned SrcReg, int FrameIdx) const {
+  const TargetRegisterClass *RC = getRegClass(SrcReg);
   static const unsigned Opcode[] = { 
     PPC::STB, PPC::STH, PPC::STW, PPC::STD, PPC::STFS, PPC::STFD 
   };
+
   unsigned OC = Opcode[getIdx(RC)];
   if (SrcReg == PPC::LR) {
     MBB.insert(MI, BuildMI(PPC::MFLR, 0, PPC::R0));
@@ -91,11 +92,11 @@ PowerPCRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
 int 
 PowerPCRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
                                           MachineBasicBlock::iterator MI,
-                                          unsigned DestReg, int FrameIdx,
-                                          const TargetRegisterClass *RC) const {
+                                          unsigned DestReg, int FrameIdx) const{
   static const unsigned Opcode[] = { 
     PPC::LBZ, PPC::LHZ, PPC::LWZ, PPC::LD, PPC::LFS, PPC::LFD 
   };
+  const TargetRegisterClass *RC = getRegClass(DestReg);
   unsigned OC = Opcode[getIdx(RC)];
   if (DestReg == PPC::LR) {
     MBB.insert(MI, addFrameReference(BuildMI(OC, 2, PPC::R0), FrameIdx));
index 45db65098e0a56a9945685668512f1adfc91f350..dfa571bb42d56369d6eabbae7d4b9e40263c7dea 100644 (file)
@@ -32,13 +32,11 @@ public:
   /// Code Generation virtual methods...
   int storeRegToStackSlot(MachineBasicBlock &MBB,
                           MachineBasicBlock::iterator MBBI,
-                          unsigned SrcReg, int FrameIndex,
-                          const TargetRegisterClass *RC) const;
+                          unsigned SrcReg, int FrameIndex) const;
 
   int loadRegFromStackSlot(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MBBI,
-                           unsigned DestReg, int FrameIndex,
-                           const TargetRegisterClass *RC) const;
+                           unsigned DestReg, int FrameIndex) const;
   
   int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                   unsigned DestReg, unsigned SrcReg,
index bb4651b6653894e3e70b85114abd4dbdbab180df..7c8ea1066e2c9cc2413fcf7308f9bfb97f5c5125 100644 (file)
@@ -20,18 +20,16 @@ SkeletonRegisterInfo::SkeletonRegisterInfo()
   : SkeletonGenRegisterInfo(Skeleton::ADJCALLSTACKDOWN,
                            Skeleton::ADJCALLSTACKUP) {}
 
-int SkeletonRegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
-                                              MachineBasicBlock::iterator MBBI,
-                                              unsigned SrcReg, int FrameIdx,
-                                          const TargetRegisterClass *RC) const {
+int SkeletonRegisterInfo::
+storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
+                    unsigned SrcReg, int FrameIdx) const {
   abort();
   return -1;
 }
 
-int SkeletonRegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
-                                               MachineBasicBlock::iterator MBBI,
-                                               unsigned DestReg, int FrameIdx,
-                                          const TargetRegisterClass *RC) const {
+int SkeletonRegisterInfo::
+loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
+                     unsigned DestReg, int FrameIdx) const {
   abort();
   return -1;
 }
index af8526f399d058bfb7c7942e0fa37a9b1e4c32e7..3bf5766d94b2a70d0803ce06a1b19ea230c6d8a0 100644 (file)
@@ -27,13 +27,11 @@ namespace llvm {
     // See MRegisterInfo.h for information on these methods.
     int storeRegToStackSlot(MachineBasicBlock &MBB,
                             MachineBasicBlock::iterator MBBI,
-                            unsigned SrcReg, int FrameIndex,
-                            const TargetRegisterClass *RC) const;
+                            unsigned SrcReg, int FrameIndex) const;
     
     int loadRegFromStackSlot(MachineBasicBlock &MBB,
                              MachineBasicBlock::iterator MBBI,
-                             unsigned DestReg, int FrameIndex,
-                             const TargetRegisterClass *RC) const;
+                             unsigned DestReg, int FrameIndex) const;
     
     int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                      unsigned DestReg, unsigned SrcReg,
index c2c7da8b48fbf669b7ff5740e952bcd93a4a5acd..ef4d1781d0b1082bb42827178ac872c06546abc4 100644 (file)
@@ -25,12 +25,11 @@ SparcV8RegisterInfo::SparcV8RegisterInfo()
   : SparcV8GenRegisterInfo(V8::ADJCALLSTACKDOWN,
                            V8::ADJCALLSTACKUP) {}
 
-int SparcV8RegisterInfo::storeRegToStackSlot(
-  MachineBasicBlock &MBB,
-  MachineBasicBlock::iterator I,
-  unsigned SrcReg, int FrameIdx,
-  const TargetRegisterClass *RC) const
-{
+int SparcV8RegisterInfo::
+storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
+                    unsigned SrcReg, int FrameIdx) const {
+  const TargetRegisterClass *RC = getRegClass(SrcReg);
+
   // On the order of operands here: think "[FrameIdx + 0] = SrcReg".
   if (RC == SparcV8::IntRegsRegisterClass) 
     BuildMI (MBB, I, V8::ST, 3).addFrameIndex (FrameIdx).addSImm (0)
@@ -46,12 +45,10 @@ int SparcV8RegisterInfo::storeRegToStackSlot(
   return 1;
 }
 
-int SparcV8RegisterInfo::loadRegFromStackSlot(
-  MachineBasicBlock &MBB,
-  MachineBasicBlock::iterator I,
-  unsigned DestReg, int FrameIdx,
-  const TargetRegisterClass *RC) const
-{
+int SparcV8RegisterInfo::
+loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
+                     unsigned DestReg, int FrameIdx) const {
+  const TargetRegisterClass *RC = getRegClass(DestReg);
   if (RC == SparcV8::IntRegsRegisterClass) 
     BuildMI (MBB, I, V8::LD, 2, DestReg).addFrameIndex (FrameIdx).addSImm (0);
   else if (RC == SparcV8::FPRegsRegisterClass)
index 1481f5fb1a8b68768860780da5beae70cad57ec3..e4dcaccf2ccf3845c34f2d0a8f43069d62e343ff 100644 (file)
@@ -28,13 +28,11 @@ struct SparcV8RegisterInfo : public SparcV8GenRegisterInfo {
   /// Code Generation virtual methods...
   int storeRegToStackSlot(MachineBasicBlock &MBB,
                           MachineBasicBlock::iterator MBBI,
-                          unsigned SrcReg, int FrameIndex,
-                          const TargetRegisterClass *RC) const;
+                          unsigned SrcReg, int FrameIndex) const;
 
   int loadRegFromStackSlot(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MBBI,
-                           unsigned DestReg, int FrameIndex,
-                           const TargetRegisterClass *RC) const;
+                           unsigned DestReg, int FrameIndex) const;
   
   int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                   unsigned DestReg, unsigned SrcReg,
index c2c7da8b48fbf669b7ff5740e952bcd93a4a5acd..ef4d1781d0b1082bb42827178ac872c06546abc4 100644 (file)
@@ -25,12 +25,11 @@ SparcV8RegisterInfo::SparcV8RegisterInfo()
   : SparcV8GenRegisterInfo(V8::ADJCALLSTACKDOWN,
                            V8::ADJCALLSTACKUP) {}
 
-int SparcV8RegisterInfo::storeRegToStackSlot(
-  MachineBasicBlock &MBB,
-  MachineBasicBlock::iterator I,
-  unsigned SrcReg, int FrameIdx,
-  const TargetRegisterClass *RC) const
-{
+int SparcV8RegisterInfo::
+storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
+                    unsigned SrcReg, int FrameIdx) const {
+  const TargetRegisterClass *RC = getRegClass(SrcReg);
+
   // On the order of operands here: think "[FrameIdx + 0] = SrcReg".
   if (RC == SparcV8::IntRegsRegisterClass) 
     BuildMI (MBB, I, V8::ST, 3).addFrameIndex (FrameIdx).addSImm (0)
@@ -46,12 +45,10 @@ int SparcV8RegisterInfo::storeRegToStackSlot(
   return 1;
 }
 
-int SparcV8RegisterInfo::loadRegFromStackSlot(
-  MachineBasicBlock &MBB,
-  MachineBasicBlock::iterator I,
-  unsigned DestReg, int FrameIdx,
-  const TargetRegisterClass *RC) const
-{
+int SparcV8RegisterInfo::
+loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
+                     unsigned DestReg, int FrameIdx) const {
+  const TargetRegisterClass *RC = getRegClass(DestReg);
   if (RC == SparcV8::IntRegsRegisterClass) 
     BuildMI (MBB, I, V8::LD, 2, DestReg).addFrameIndex (FrameIdx).addSImm (0);
   else if (RC == SparcV8::FPRegsRegisterClass)
index 1481f5fb1a8b68768860780da5beae70cad57ec3..e4dcaccf2ccf3845c34f2d0a8f43069d62e343ff 100644 (file)
@@ -28,13 +28,11 @@ struct SparcV8RegisterInfo : public SparcV8GenRegisterInfo {
   /// Code Generation virtual methods...
   int storeRegToStackSlot(MachineBasicBlock &MBB,
                           MachineBasicBlock::iterator MBBI,
-                          unsigned SrcReg, int FrameIndex,
-                          const TargetRegisterClass *RC) const;
+                          unsigned SrcReg, int FrameIndex) const;
 
   int loadRegFromStackSlot(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MBBI,
-                           unsigned DestReg, int FrameIndex,
-                           const TargetRegisterClass *RC) const;
+                           unsigned DestReg, int FrameIndex) const;
   
   int copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
                   unsigned DestReg, unsigned SrcReg,
index bf8717eddfd98f14ad1cca70933acbaa319c7249..1b0fc7276c8e606e827c3a1e9cd6d128430a655c 100644 (file)
@@ -278,15 +278,13 @@ SparcV9RegisterInfo::SparcV9RegisterInfo ()
 
 int SparcV9RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
                                          MachineBasicBlock::iterator MI,
-                                         unsigned SrcReg, int FrameIndex,
-                                         const TargetRegisterClass *RC) const {
+                                         unsigned SrcReg, int FrameIndex) const{
   abort ();
 }
 
 int SparcV9RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
                                           MachineBasicBlock::iterator MI,
-                                          unsigned DestReg, int FrameIndex,
-                                          const TargetRegisterClass *RC) const {
+                                          unsigned DestReg, int FrameIndex) const {
   abort ();
 }
 
index 6b86c881c6e1005c807792679db658636f16e67d..bd31bb1f5558caed613c06843a7206e4d557153f 100644 (file)
@@ -27,12 +27,10 @@ struct SparcV9RegisterInfo : public MRegisterInfo {
   // The rest of these are stubs... for now.
   int storeRegToStackSlot (MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MI,
-                           unsigned SrcReg, int FrameIndex,
-                           const TargetRegisterClass *RC) const;
+                           unsigned SrcReg, int FrameIndex) const;
   int loadRegFromStackSlot (MachineBasicBlock &MBB,
                             MachineBasicBlock::iterator MI,
-                            unsigned DestReg, int FrameIndex,
-                            const TargetRegisterClass *RC) const;
+                            unsigned DestReg, int FrameIndex) const;
   int copyRegToReg (MachineBasicBlock &MBB,
                     MachineBasicBlock::iterator MI,
                     unsigned DestReg, unsigned SrcReg,
index dba98d6ed05ae4c626d9414638308feb153416b6..6890cbe97b9d984e0632c44d7253000dd47db370 100644 (file)
@@ -56,10 +56,10 @@ static unsigned getIdx(const TargetRegisterClass *RC) {
 
 int X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
                                          MachineBasicBlock::iterator MI,
-                                         unsigned SrcReg, int FrameIdx,
-                                         const TargetRegisterClass *RC) const {
+                                         unsigned SrcReg, int FrameIdx) const {
   static const unsigned Opcode[] =
     { X86::MOV8mr, X86::MOV16mr, X86::MOV32mr, X86::FSTP80m };
+  const TargetRegisterClass *RC = getRegClass(SrcReg);
   MachineInstr *I = addFrameReference(BuildMI(Opcode[getIdx(RC)], 5),
                                       FrameIdx).addReg(SrcReg);
   MBB.insert(MI, I);
@@ -68,10 +68,10 @@ int X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
 
 int X86RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
                                           MachineBasicBlock::iterator MI,
-                                          unsigned DestReg, int FrameIdx,
-                                          const TargetRegisterClass *RC) const{
+                                          unsigned DestReg, int FrameIdx) const{
   static const unsigned Opcode[] =
     { X86::MOV8rm, X86::MOV16rm, X86::MOV32rm, X86::FLD80m };
+  const TargetRegisterClass *RC = getRegClass(DestReg);
   unsigned OC = Opcode[getIdx(RC)];
   MBB.insert(MI, addFrameReference(BuildMI(OC, 4, DestReg), FrameIdx));
   return 1;
index a582519255c3e9a8d12e95ab3a8d986ea60835d6..28395564bd11b6f7e9f922e040bbf5a443dd79bc 100644 (file)
@@ -29,13 +29,11 @@ struct X86RegisterInfo : public X86GenRegisterInfo {
   /// Code Generation virtual methods...
   int storeRegToStackSlot(MachineBasicBlock &MBB,
                           MachineBasicBlock::iterator MI,
-                          unsigned SrcReg, int FrameIndex,
-                          const TargetRegisterClass *RC) const;
+                          unsigned SrcReg, int FrameIndex) const;
 
   int loadRegFromStackSlot(MachineBasicBlock &MBB,
                            MachineBasicBlock::iterator MI,
-                           unsigned DestReg, int FrameIndex,
-                           const TargetRegisterClass *RC) const;
+                           unsigned DestReg, int FrameIndex) const;
   
   int copyRegToReg(MachineBasicBlock &MBB,
                    MachineBasicBlock::iterator MI,