From 3c34a46c7e51ab290b208248461542eb83c469b0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 12 Feb 2002 21:04:35 +0000 Subject: [PATCH] Method.h no longer includes BasicBlock.h 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 | 10 +++++----- include/llvm/Analysis/InstForest.h | 17 +++++++++++------ include/llvm/Analysis/IntervalIterator.h | 1 + include/llvm/Transforms/Scalar/DCE.h | 1 + 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/include/llvm/Analysis/ConstantsScanner.h b/include/llvm/Analysis/ConstantsScanner.h index 69e97d53f93..1a850820020 100644 --- a/include/llvm/Analysis/ConstantsScanner.h +++ b/include/llvm/Analysis/ConstantsScanner.h @@ -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 class Constant; class constant_iterator : public std::forward_iterator { - 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 && diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h index efcbf519f66..aacbb13fb71 100644 --- a/include/llvm/Analysis/InstForest.h +++ b/include/llvm/Analysis/InstForest.h @@ -15,6 +15,7 @@ #define LLVM_ANALYSIS_INSTFOREST_H #include "llvm/Instruction.h" +#include "llvm/BasicBlock.h" #include "Support/Tree.h" #include @@ -163,12 +164,16 @@ class InstForest : public std::vector *> { 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(*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(*this, Inst, 0)); + } + } } } diff --git a/include/llvm/Analysis/IntervalIterator.h b/include/llvm/Analysis/IntervalIterator.h index 52d2cc807d9..05add884fdb 100644 --- a/include/llvm/Analysis/IntervalIterator.h +++ b/include/llvm/Analysis/IntervalIterator.h @@ -28,6 +28,7 @@ #include "llvm/Analysis/IntervalPartition.h" #include "llvm/Method.h" +#include "llvm/BasicBlock.h" #include #include #include diff --git a/include/llvm/Transforms/Scalar/DCE.h b/include/llvm/Transforms/Scalar/DCE.h index 6fc5287e42c..3246ed85e56 100644 --- a/include/llvm/Transforms/Scalar/DCE.h +++ b/include/llvm/Transforms/Scalar/DCE.h @@ -10,6 +10,7 @@ #include "llvm/Pass.h" #include "llvm/Method.h" +#include "llvm/BasicBlock.h" //===----------------------------------------------------------------------===// // DeadInstElimination - This pass quickly removes trivially dead instructions