aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-07 21:07:10 +0000
committerChris Lattner <sabre@nondot.org>2001-09-07 21:07:10 +0000
commitcffebdc3901dd13449fc1b5241ae45f8f293642c (patch)
tree98827594f6ef83ca8699f29d6af86f7d01ba3ba6 /include
parentf977bbcad6319e5d7e660f4faf1d1ad76799a3ac (diff)
downloadexternal_llvm-cffebdc3901dd13449fc1b5241ae45f8f293642c.zip
external_llvm-cffebdc3901dd13449fc1b5241ae45f8f293642c.tar.gz
external_llvm-cffebdc3901dd13449fc1b5241ae45f8f293642c.tar.bz2
* Remove lots of annoying extra #includes
* Elminate dependecy on stringextras.h by moving dump's into .cpp files * Kill InOutIterator class because it breaks iterator semantics to work like that - Copy ctor on iterator doesn't work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@485 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/SchedGraph.h81
1 files changed, 38 insertions, 43 deletions
diff --git a/include/llvm/CodeGen/SchedGraph.h b/include/llvm/CodeGen/SchedGraph.h
index ea9fe31..e12d90f 100644
--- a/include/llvm/CodeGen/SchedGraph.h
+++ b/include/llvm/CodeGen/SchedGraph.h
@@ -19,27 +19,15 @@
#ifndef LLVM_CODEGEN_SCHEDGRAPH_H
#define LLVM_CODEGEN_SCHEDGRAPH_H
-//************************** System Include Files **************************/
-
-#include <hash_map>
-#include <vector>
-
-//*************************** User Include Files ***************************/
-
#include "llvm/CFGdecls.h" // just for graph iterators
#include "llvm/Support/NonCopyable.h"
#include "llvm/Support/HashExtras.h"
-#include "llvm/Support/StringExtras.h"
-#include "llvm/CodeGen/TargetMachine.h"
-#include "llvm/CodeGen/MachineInstr.h"
-
-//************************* Opaque Declarations ****************************/
+#include <hash_map>
class Value;
class Instruction;
class BasicBlock;
class Method;
-class MachineInstr;
class TargetMachine;
class SchedGraphEdge;
class SchedGraphNode;
@@ -131,8 +119,8 @@ public:
//
friend ostream& operator<<(ostream& os, const SchedGraphEdge& edge);
- void dump (int indent=0) const { printIndent(indent);
- cout << *this; }
+ void dump (int indent=0) const;
+
private:
// disable default ctor
/*ctor*/ SchedGraphEdge(); // DO NOT IMPLEMENT
@@ -160,7 +148,6 @@ public:
unsigned int getNodeId () const { return nodeId; }
const Instruction* getInstr () const { return instr; }
const MachineInstr* getMachineInstr () const { return minstr; }
- MachineOpCode getOpCode () const { return minstr->getOpCode();}
int getLatency () const { return latency; }
unsigned int getNumInEdges () const { return inEdges.size(); }
unsigned int getNumOutEdges () const { return outEdges.size(); }
@@ -190,8 +177,7 @@ public:
//
friend ostream& operator<<(ostream& os, const SchedGraphNode& node);
- void dump (int indent=0) const { printIndent(indent);
- cout << *this; }
+ void dump (int indent=0) const;
private:
friend class SchedGraph; // give access for ctor and dtor
@@ -386,53 +372,62 @@ private:
// for <const SchedGraphNode, SchedGraphNode::const_iterator>.
//
template <class _NodeType, class _EdgeType, class _EdgeIter>
-class InOutIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
+class PredIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
protected:
_EdgeIter oi;
public:
- typedef InOutIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
+ typedef PredIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
- inline InOutIterator(_EdgeIter startEdge) : oi(startEdge) {}
+ inline PredIterator(_EdgeIter startEdge) : oi(startEdge) {}
inline bool operator==(const _Self& x) const { return oi == x.oi; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
// operator*() differs for pred or succ iterator
- virtual inline _NodeType* operator*() const = 0;
+ inline _NodeType* operator*() const { return (*oi)->getSrc(); }
inline _NodeType* operator->() const { return operator*(); }
inline _EdgeType* getEdge() const { return *(oi); }
- inline _Self& operator++() { ++oi; return *this; } // Preincrement
- // inline _Self operator++(int) { // Postincrement
- // _Self tmp(*this); ++*this; return tmp;
- // }
+ inline _Self &operator++() { ++oi; return *this; } // Preincrement
+ inline _Self operator++(int) { // Postincrement
+ _Self tmp(*this); ++*this; return tmp;
+ }
- inline _Self& operator--() { --oi; return *this; } // Predecrement
- // inline _Self operator--(int) { // Postdecrement
- // _Self tmp = *this; --*this; return tmp;
- // }
+ inline _Self &operator--() { --oi; return *this; } // Predecrement
+ inline _Self operator--(int) { // Postdecrement
+ _Self tmp = *this; --*this; return tmp;
+ }
};
template <class _NodeType, class _EdgeType, class _EdgeIter>
-class PredIterator: public InOutIterator<_NodeType, _EdgeType, _EdgeIter> {
+class SuccIterator: public std::bidirectional_iterator<_NodeType, ptrdiff_t> {
+protected:
+ _EdgeIter oi;
public:
- inline PredIterator(_EdgeIter startEdge)
- : InOutIterator<_NodeType, _EdgeType, _EdgeIter>(startEdge) {}
+ typedef SuccIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
- virtual inline _NodeType* operator*() const { return (*oi)->getSrc(); }
-};
-
-template <class _NodeType, class _EdgeType, class _EdgeIter>
-class SuccIterator: public InOutIterator<_NodeType, _EdgeType, _EdgeIter> {
-public:
- inline SuccIterator(_EdgeIter startEdge)
- : InOutIterator<_NodeType, _EdgeType, _EdgeIter>(startEdge) {}
+ inline SuccIterator(_EdgeIter startEdge) : oi(startEdge) {}
+
+ inline bool operator==(const _Self& x) const { return oi == x.oi; }
+ inline bool operator!=(const _Self& x) const { return !operator==(x); }
+
+ inline _NodeType* operator*() const { return (*oi)->getSink(); }
+ inline _NodeType* operator->() const { return operator*(); }
- virtual inline _NodeType* operator*() const { return (*oi)->getSink(); }
+ inline _EdgeType* getEdge() const { return *(oi); }
+
+ inline _Self &operator++() { ++oi; return *this; } // Preincrement
+ inline _Self operator++(int) { // Postincrement
+ _Self tmp(*this); ++*this; return tmp;
+ }
+
+ inline _Self &operator--() { --oi; return *this; } // Predecrement
+ inline _Self operator--(int) { // Postdecrement
+ _Self tmp = *this; --*this; return tmp;
+ }
};
-
//
// sg_pred_iterator
// sg_pred_const_iterator