mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
* 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
This commit is contained in:
@@ -19,27 +19,15 @@
|
|||||||
#ifndef LLVM_CODEGEN_SCHEDGRAPH_H
|
#ifndef LLVM_CODEGEN_SCHEDGRAPH_H
|
||||||
#define 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/CFGdecls.h" // just for graph iterators
|
||||||
#include "llvm/Support/NonCopyable.h"
|
#include "llvm/Support/NonCopyable.h"
|
||||||
#include "llvm/Support/HashExtras.h"
|
#include "llvm/Support/HashExtras.h"
|
||||||
#include "llvm/Support/StringExtras.h"
|
#include <hash_map>
|
||||||
#include "llvm/CodeGen/TargetMachine.h"
|
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
|
||||||
|
|
||||||
//************************* Opaque Declarations ****************************/
|
|
||||||
|
|
||||||
class Value;
|
class Value;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
class BasicBlock;
|
class BasicBlock;
|
||||||
class Method;
|
class Method;
|
||||||
class MachineInstr;
|
|
||||||
class TargetMachine;
|
class TargetMachine;
|
||||||
class SchedGraphEdge;
|
class SchedGraphEdge;
|
||||||
class SchedGraphNode;
|
class SchedGraphNode;
|
||||||
@@ -131,8 +119,8 @@ public:
|
|||||||
//
|
//
|
||||||
friend ostream& operator<<(ostream& os, const SchedGraphEdge& edge);
|
friend ostream& operator<<(ostream& os, const SchedGraphEdge& edge);
|
||||||
|
|
||||||
void dump (int indent=0) const { printIndent(indent);
|
void dump (int indent=0) const;
|
||||||
cout << *this; }
|
|
||||||
private:
|
private:
|
||||||
// disable default ctor
|
// disable default ctor
|
||||||
/*ctor*/ SchedGraphEdge(); // DO NOT IMPLEMENT
|
/*ctor*/ SchedGraphEdge(); // DO NOT IMPLEMENT
|
||||||
@@ -160,7 +148,6 @@ public:
|
|||||||
unsigned int getNodeId () const { return nodeId; }
|
unsigned int getNodeId () const { return nodeId; }
|
||||||
const Instruction* getInstr () const { return instr; }
|
const Instruction* getInstr () const { return instr; }
|
||||||
const MachineInstr* getMachineInstr () const { return minstr; }
|
const MachineInstr* getMachineInstr () const { return minstr; }
|
||||||
MachineOpCode getOpCode () const { return minstr->getOpCode();}
|
|
||||||
int getLatency () const { return latency; }
|
int getLatency () const { return latency; }
|
||||||
unsigned int getNumInEdges () const { return inEdges.size(); }
|
unsigned int getNumInEdges () const { return inEdges.size(); }
|
||||||
unsigned int getNumOutEdges () const { return outEdges.size(); }
|
unsigned int getNumOutEdges () const { return outEdges.size(); }
|
||||||
@@ -190,8 +177,7 @@ public:
|
|||||||
//
|
//
|
||||||
friend ostream& operator<<(ostream& os, const SchedGraphNode& node);
|
friend ostream& operator<<(ostream& os, const SchedGraphNode& node);
|
||||||
|
|
||||||
void dump (int indent=0) const { printIndent(indent);
|
void dump (int indent=0) const;
|
||||||
cout << *this; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class SchedGraph; // give access for ctor and dtor
|
friend class SchedGraph; // give access for ctor and dtor
|
||||||
@@ -386,53 +372,62 @@ private:
|
|||||||
// for <const SchedGraphNode, SchedGraphNode::const_iterator>.
|
// for <const SchedGraphNode, SchedGraphNode::const_iterator>.
|
||||||
//
|
//
|
||||||
template <class _NodeType, class _EdgeType, class _EdgeIter>
|
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:
|
protected:
|
||||||
_EdgeIter oi;
|
_EdgeIter oi;
|
||||||
public:
|
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 oi == x.oi; }
|
||||||
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
inline bool operator!=(const _Self& x) const { return !operator==(x); }
|
||||||
|
|
||||||
// operator*() differs for pred or succ iterator
|
// 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 _NodeType* operator->() const { return operator*(); }
|
||||||
|
|
||||||
inline _EdgeType* getEdge() const { return *(oi); }
|
inline _EdgeType* getEdge() const { return *(oi); }
|
||||||
|
|
||||||
inline _Self& operator++() { ++oi; return *this; } // Preincrement
|
inline _Self &operator++() { ++oi; return *this; } // Preincrement
|
||||||
// inline _Self operator++(int) { // Postincrement
|
inline _Self operator++(int) { // Postincrement
|
||||||
// _Self tmp(*this); ++*this; return tmp;
|
_Self tmp(*this); ++*this; return tmp;
|
||||||
// }
|
}
|
||||||
|
|
||||||
inline _Self& operator--() { --oi; return *this; } // Predecrement
|
inline _Self &operator--() { --oi; return *this; } // Predecrement
|
||||||
// inline _Self operator--(int) { // Postdecrement
|
inline _Self operator--(int) { // Postdecrement
|
||||||
// _Self tmp = *this; --*this; return tmp;
|
_Self tmp = *this; --*this; return tmp;
|
||||||
// }
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _NodeType, class _EdgeType, class _EdgeIter>
|
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:
|
public:
|
||||||
inline PredIterator(_EdgeIter startEdge)
|
typedef SuccIterator<_NodeType, _EdgeType, _EdgeIter> _Self;
|
||||||
: InOutIterator<_NodeType, _EdgeType, _EdgeIter>(startEdge) {}
|
|
||||||
|
|
||||||
virtual inline _NodeType* operator*() const { return (*oi)->getSrc(); }
|
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*(); }
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _NodeType, class _EdgeType, class _EdgeIter>
|
|
||||||
class SuccIterator: public InOutIterator<_NodeType, _EdgeType, _EdgeIter> {
|
|
||||||
public:
|
|
||||||
inline SuccIterator(_EdgeIter startEdge)
|
|
||||||
: InOutIterator<_NodeType, _EdgeType, _EdgeIter>(startEdge) {}
|
|
||||||
|
|
||||||
virtual inline _NodeType* operator*() const { return (*oi)->getSink(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// sg_pred_iterator
|
// sg_pred_iterator
|
||||||
// sg_pred_const_iterator
|
// sg_pred_const_iterator
|
||||||
|
Reference in New Issue
Block a user