#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;
}
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 &&
#define LLVM_ANALYSIS_INSTFOREST_H
#include "llvm/Instruction.h"
+#include "llvm/BasicBlock.h"
#include "Support/Tree.h"
#include <map>
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));
+ }
+ }
}
}
#include "llvm/Analysis/IntervalPartition.h"
#include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
#include <stack>
#include <set>
#include <algorithm>
#include "llvm/Pass.h"
#include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
//===----------------------------------------------------------------------===//
// DeadInstElimination - This pass quickly removes trivially dead instructions