Method.h no longer includes BasicBlock.h
authorChris Lattner <sabre@nondot.org>
Tue, 12 Feb 2002 21:04:35 +0000 (21:04 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 12 Feb 2002 21:04:35 +0000 (21:04 +0000)
Method::inst_* is now in llvm/Support/InstIterator.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1745 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ConstantsScanner.h
include/llvm/Analysis/InstForest.h
include/llvm/Analysis/IntervalIterator.h
include/llvm/Transforms/Scalar/DCE.h

index 69e97d53f93d2f057bba30588bbcb2c3222b770c..1a850820020289a4f6c226095add79973869f01d 100644 (file)
@@ -9,14 +9,14 @@
 #ifndef LLVM_ANALYSIS_CONSTANTSSCANNER_H
 #define LLVM_ANALYSIS_CONSTANTSSCANNER_H
 
-#include "llvm/Method.h"
+#include "llvm/Support/InstIterator.h"
 #include "llvm/Instruction.h"
 #include <iterator>
 class Constant;
 
 class constant_iterator
   : public std::forward_iterator<const Constant, ptrdiff_t> {
-  Method::const_inst_iterator InstI;        // Method instruction iterator
+  const_inst_iterator InstI;                // Method instruction iterator
   unsigned OpIdx;                           // Operand index
 
   typedef constant_iterator _Self;
@@ -28,15 +28,15 @@ class constant_iterator
   }
 
 public:
-  inline constant_iterator(const Method *M) : InstI(M->inst_begin()), OpIdx(0) {
+  inline constant_iterator(const Method *M) : InstI(inst_begin(M)), OpIdx(0) {
     // Advance to first constant... if we are not already at constant or end
-    if (InstI != M->inst_end() &&                          // InstI is valid?
+    if (InstI != inst_end(M) &&                            // InstI is valid?
        (InstI->getNumOperands() == 0 || !isAtConstant())) // Not at constant?
       operator++();
   }
 
   inline constant_iterator(const Method *M, bool)   // end ctor
-    : InstI(M->inst_end()), OpIdx(0) {
+    : InstI(inst_end(M)), OpIdx(0) {
   }
 
   inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx && 
index efcbf519f6682aa7fd5ef4b9799e5560654afb36..aacbb13fb7127935158deec5ccb8bd041559ff1a 100644 (file)
@@ -15,6 +15,7 @@
 #define LLVM_ANALYSIS_INSTFOREST_H
 
 #include "llvm/Instruction.h"
+#include "llvm/BasicBlock.h"
 #include "Support/Tree.h"
 #include <map>
 
@@ -163,12 +164,16 @@ class InstForest : public std::vector<InstTreeNode<Payload> *> {
 public:
   // ctor - Create an instruction forest for the specified method...
   InstForest(Method *M) {
-    for (Method::inst_iterator I = M->inst_begin(), E = M->inst_end();
-        I != E; ++I) {
-      Instruction *Inst = *I;
-      if (!getInstNode(Inst))   // Do we already have a tree for this inst?
-       push_back(new InstTreeNode<Payload>(*this, Inst, 0));  // No create one!
-      // InstTreeNode ctor automatically adds the created node into our InstMap
+    for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) {
+      BasicBlock *BB = *MI;
+      for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
+        Instruction *Inst = *I;
+        if (!getInstNode(Inst)) {  // Do we already have a tree for this inst?
+          // No, create one!  InstTreeNode ctor automatically adds the
+          // created node into our InstMap
+          push_back(new InstTreeNode<Payload>(*this, Inst, 0));
+        }
+      }
     }
   }
 
index 52d2cc807d9bda067b2e60f83b6f86f3d61d2b22..05add884fdb3ded7f51a5b34124e4e6a2c5b9ec1 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "llvm/Analysis/IntervalPartition.h"
 #include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
 #include <stack>
 #include <set>
 #include <algorithm>
index 6fc5287e42cca874b825a1b51e88f698000a7865..3246ed85e56fd8367e6bfdab70d41fe7108ba289 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "llvm/Pass.h"
 #include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
 
 //===----------------------------------------------------------------------===//
 // DeadInstElimination - This pass quickly removes trivially dead instructions