make findDebugLoc a class method
authorDale Johannesen <dalej@apple.com>
Wed, 20 Jan 2010 21:36:02 +0000 (21:36 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 20 Jan 2010 21:36:02 +0000 (21:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94032 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineBasicBlock.h
lib/CodeGen/MachineBasicBlock.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86RegisterInfo.cpp

index ad4bc1f79d54781125c7143e58422abea334ef76..20644c17e1adb5d30d52ad180712a0297f92ee92 100644 (file)
@@ -337,6 +337,10 @@ public:
                             MachineBasicBlock *DestB,
                             bool isCond);
 
+  /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping
+  /// any DEBUG_VALUE instructions.  Return UnknownLoc if there is none.
+  DebugLoc findDebugLoc(MachineBasicBlock::iterator &MBBI);
+
   // Debugging methods.
   void dump() const;
   void print(raw_ostream &OS) const;
@@ -367,9 +371,6 @@ private:   // Methods used to maintain doubly linked list of blocks...
   void removePredecessor(MachineBasicBlock *pred);
 };
 
-DebugLoc
-findDebugLoc(MachineBasicBlock::iterator &MBBI, MachineBasicBlock &MBB);
-
 raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
 
 void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
index 030438fceb5af9316c1e274fe876d1942e5fe0dc..9215bd583b59b707239acc33d9d8dc8f18e51488 100644 (file)
@@ -524,24 +524,26 @@ bool MachineBasicBlock::CorrectExtraCFGEdges(MachineBasicBlock *DestA,
   return MadeChange;
 }
 
-void llvm::WriteAsOperand(raw_ostream &OS, const MachineBasicBlock *MBB,
-                          bool t) {
-  OS << "BB#" << MBB->getNumber();
-}
-
 /// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping
 /// any DEBUG_VALUE instructions.  Return UnknownLoc if there is none.
 DebugLoc
-llvm::findDebugLoc(MachineBasicBlock::iterator &MBBI, MachineBasicBlock &MBB) {
+MachineBasicBlock::findDebugLoc(MachineBasicBlock::iterator &MBBI) {
   DebugLoc DL;
-  if (MBBI != MBB.end()) {
+  MachineBasicBlock::iterator E = end();
+  if (MBBI != E) {
     // Skip debug declarations, we don't want a DebugLoc from them.
     MachineBasicBlock::iterator MBBI2 = MBBI;
-    while (MBBI2 != MBB.end() &&
+    while (MBBI2 != E &&
            MBBI2->getOpcode()==TargetInstrInfo::DEBUG_VALUE)
       MBBI2++;
-    if (MBBI2 != MBB.end())
+    if (MBBI2 != E)
       DL = MBBI2->getDebugLoc();
   }
   return DL;
 }
+
+void llvm::WriteAsOperand(raw_ostream &OS, const MachineBasicBlock *MBB,
+                          bool t) {
+  OS << "BB#" << MBB->getNumber();
+}
+
index 9501ace8d374c21442f14e62d350ac45ea7bd0c2..e643048356959309ecb6adc01ae7a4516bc41363 100644 (file)
@@ -2200,7 +2200,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
   if (CSI.empty())
     return false;
 
-  DebugLoc DL = findDebugLoc(MI, MBB);
+  DebugLoc DL = MBB.findDebugLoc(MI);
 
   bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit();
   bool isWin64 = TM.getSubtarget<X86Subtarget>().isTargetWin64();
@@ -2238,7 +2238,7 @@ bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
   if (CSI.empty())
     return false;
 
-  DebugLoc DL = findDebugLoc(MI, MBB);
+  DebugLoc DL = MBB.findDebugLoc(MI);
 
   MachineFunction &MF = *MBB.getParent();
   unsigned FPReg = RI.getFrameRegister(MF);
index 6962b8cef9559d75fc67c1e4eba81871b8a7e68a..f959a2db8b8696711f56cb0d6262afed196182db 100644 (file)
@@ -682,7 +682,7 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
        (Is64Bit ? X86::ADD64ri8 : X86::ADD32ri8) :
        (Is64Bit ? X86::ADD64ri32 : X86::ADD32ri));
   uint64_t Chunk = (1LL << 31) - 1;
-  DebugLoc DL = findDebugLoc(MBBI, MBB);
+  DebugLoc DL = MBB.findDebugLoc(MBBI);
 
   while (Offset) {
     uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
@@ -1031,7 +1031,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
     }
   }
 
-  DL = findDebugLoc(MBBI, MBB);
+  DL = MBB.findDebugLoc(MBBI);
 
   // Adjust stack pointer: ESP -= numbytes.
   if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) {