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
This commit is contained in:
Chris Lattner 2002-02-12 21:04:35 +00:00
parent 428039a6e1
commit 3c34a46c7e
4 changed files with 18 additions and 11 deletions

View 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 &&

View 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));
}
}
}
}

View File

@ -28,6 +28,7 @@
#include "llvm/Analysis/IntervalPartition.h"
#include "llvm/Method.h"
#include "llvm/BasicBlock.h"
#include <stack>
#include <set>
#include <algorithm>

View 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