[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp AlphaInstrInfo.h

Evan Cheng evan.cheng at apple.com
Thu May 17 17:03:19 PDT 2007



Changes in directory llvm/lib/Target/Alpha:

AlphaInstrInfo.cpp updated: 1.17 -> 1.18
AlphaInstrInfo.h updated: 1.7 -> 1.8
---
Log message:

RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.

---
Diffs of the changes:  (+11 -9)

 AlphaInstrInfo.cpp |   16 +++++++++-------
 AlphaInstrInfo.h   |    4 ++--
 2 files changed, 11 insertions(+), 9 deletions(-)


Index: llvm/lib/Target/Alpha/AlphaInstrInfo.cpp
diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.17 llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.18
--- llvm/lib/Target/Alpha/AlphaInstrInfo.cpp:1.17	Wed Apr 25 02:12:14 2007
+++ llvm/lib/Target/Alpha/AlphaInstrInfo.cpp	Thu May 17 19:02:59 2007
@@ -99,7 +99,7 @@
   }
 }
 
-void AlphaInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB,
+unsigned AlphaInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB,
                                   MachineBasicBlock *FBB,
                                   const std::vector<MachineOperand> &Cond)const{
   assert(TBB && "InsertBranch must not be told to insert a fallthrough");
@@ -117,7 +117,7 @@
       else
         BuildMI(&MBB, get(Alpha::COND_BRANCH_F))
           .addImm(Cond[0].getImm()).addReg(Cond[1].getReg()).addMBB(TBB);
-    return;
+    return 1;
   }
   
   // Two-way Conditional Branch.
@@ -128,6 +128,7 @@
     BuildMI(&MBB, get(Alpha::COND_BRANCH_F))
       .addImm(Cond[0].getImm()).addReg(Cond[1].getReg()).addMBB(TBB);
   BuildMI(&MBB, get(Alpha::BR)).addMBB(FBB);
+  return 2;
 }
 
 static unsigned AlphaRevCondCode(unsigned Opcode) {
@@ -203,28 +204,29 @@
   return true;
 }
 
-void AlphaInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
+unsigned AlphaInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
   MachineBasicBlock::iterator I = MBB.end();
-  if (I == MBB.begin()) return;
+  if (I == MBB.begin()) return 0;
   --I;
   if (I->getOpcode() != Alpha::BR && 
       I->getOpcode() != Alpha::COND_BRANCH_I &&
       I->getOpcode() != Alpha::COND_BRANCH_F)
-    return;
+    return 0;
   
   // Remove the branch.
   I->eraseFromParent();
   
   I = MBB.end();
 
-  if (I == MBB.begin()) return;
+  if (I == MBB.begin()) return 1;
   --I;
   if (I->getOpcode() != Alpha::COND_BRANCH_I && 
       I->getOpcode() != Alpha::COND_BRANCH_F)
-    return;
+    return 1;
   
   // Remove the branch.
   I->eraseFromParent();
+  return 2;
 }
 
 void AlphaInstrInfo::insertNoop(MachineBasicBlock &MBB, 


Index: llvm/lib/Target/Alpha/AlphaInstrInfo.h
diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.7 llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.8
--- llvm/lib/Target/Alpha/AlphaInstrInfo.h:1.7	Tue Oct 31 10:49:55 2006
+++ llvm/lib/Target/Alpha/AlphaInstrInfo.h	Thu May 17 19:02:59 2007
@@ -39,13 +39,13 @@
   virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
   virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
   
-  virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
+  virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
                             MachineBasicBlock *FBB,
                             const std::vector<MachineOperand> &Cond) const;
   bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
                      MachineBasicBlock *&FBB,
                      std::vector<MachineOperand> &Cond) const;
-  void RemoveBranch(MachineBasicBlock &MBB) const;
+  unsigned RemoveBranch(MachineBasicBlock &MBB) const;
   void insertNoop(MachineBasicBlock &MBB, 
                   MachineBasicBlock::iterator MI) const;
   bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const;






More information about the llvm-commits mailing list