[llvm-commits] CVS: llvm/lib/Target/X86/InstSelectSimple.cpp

Alkis Evlogimenos alkis at niobe.cs.uiuc.edu
Mon Feb 23 12:16:17 PST 2004


Changes in directory llvm/lib/Target/X86:

InstSelectSimple.cpp updated: 1.173 -> 1.174

---
Log message:

Refactor rewinding code for finding the first terminator of a basic
block into MachineBasicBlock::getFirstTerminator().

This also fixes a bug in the implementation of the above in both
RegAllocLocal and InstrSched, where instructions where added after the
terminator if the basic block's only instruction was a terminator (it
shouldn't matter for RegAllocLocal since this case never occurs in
practice).


---
Diffs of the changes:  (+1 -6)

Index: llvm/lib/Target/X86/InstSelectSimple.cpp
diff -u llvm/lib/Target/X86/InstSelectSimple.cpp:1.173 llvm/lib/Target/X86/InstSelectSimple.cpp:1.174
--- llvm/lib/Target/X86/InstSelectSimple.cpp:1.173	Mon Feb 23 01:42:19 2004
+++ llvm/lib/Target/X86/InstSelectSimple.cpp	Mon Feb 23 12:14:47 2004
@@ -679,7 +679,6 @@
 //
 void ISel::InsertFPRegKills() {
   SSARegMap &RegMap = *F->getSSARegMap();
-  const TargetInstrInfo &TII = TM.getInstrInfo();
 
   for (MachineFunction::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
     for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I!=E; ++I)
@@ -709,11 +708,7 @@
     // it's not an unwind/return), insert the FP_REG_KILL instruction.
     if (BB->getBasicBlock()->getTerminator()->getNumSuccessors() &&
         RequiresFPRegKill(BB->getBasicBlock())) {
-      // Rewind past any terminator instructions that might exist.
-      MachineBasicBlock::iterator I = BB->end();
-      while (I != BB->begin() && TII.isTerminatorInstr((--I)->getOpcode()));
-      if (I != BB->end()) ++I;
-      BMI(BB, I, X86::FP_REG_KILL, 0);
+      BMI(BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0);
       ++NumFPKill;
     }
   }





More information about the llvm-commits mailing list