[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Mar 18 08:12:54 PST 2005



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.233 -> 1.234
---
Log message:

remove use of getPrev() and getNext() on ilist nodes.


---
Diffs of the changes:  (+8 -5)

 Writer.cpp |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.233 llvm/lib/Target/CBackend/Writer.cpp:1.234
--- llvm/lib/Target/CBackend/Writer.cpp:1.233	Mon Mar 14 22:59:54 2005
+++ llvm/lib/Target/CBackend/Writer.cpp	Fri Mar 18 10:12:37 2005
@@ -33,6 +33,7 @@
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Config/config.h"
 #include <algorithm>
@@ -1246,7 +1247,7 @@
     BasicBlock *Succ = cast<BasicBlock>(SI.getOperand(i+1));
     printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
     printBranchToBlock(SI.getParent(), Succ, 2);
-    if (Succ == SI.getParent()->getNext())
+    if (Succ == next(Function::iterator(SI.getParent())))
       Out << "    break;\n";
   }
   Out << "  }\n";
@@ -1260,12 +1261,11 @@
   /// FIXME: This should be reenabled, but loop reordering safe!!
   return true;
 
-  if (From->getNext() != To) // Not the direct successor, we need a goto
-    return true; 
+  if (next(Function::iterator(From)) != Function::iterator(To))
+    return true;  // Not the direct successor, we need a goto.
 
   //isa<SwitchInst>(From->getTerminator())
 
-
   if (LI->getLoopFor(From) != LI->getLoopFor(To))
     return true;
   return false;
@@ -1443,7 +1443,10 @@
             break;
           default:
             // All other intrinsic calls we must lower.
-            Instruction *Before = CI->getPrev();
+            Instruction *Before = 0;
+            if (CI != &BB->front()) 
+              Before = prior(BasicBlock::iterator(CI));
+              
             IL.LowerIntrinsicCall(CI);
             if (Before) {        // Move iterator to instruction after call
               I = Before; ++I;






More information about the llvm-commits mailing list