diff options
author | Tanya Lattner <tonic@nondot.org> | 2003-08-27 02:42:58 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2003-08-27 02:42:58 +0000 |
commit | c50ee556e5ecda3fc33d27f83b39f890010dee12 (patch) | |
tree | f548e41d0563ed0d21731bc5f882ddad2de92a78 /lib/Target/SparcV9/InstrSched/SchedGraph.h | |
parent | 99b28e632f194cd0014ea8bde930b0b72d0ccc6e (diff) |
*** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8153 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/InstrSched/SchedGraph.h')
-rw-r--r-- | lib/Target/SparcV9/InstrSched/SchedGraph.h | 128 |
1 files changed, 60 insertions, 68 deletions
diff --git a/lib/Target/SparcV9/InstrSched/SchedGraph.h b/lib/Target/SparcV9/InstrSched/SchedGraph.h index 82e5dd619b..4e67f40d57 100644 --- a/lib/Target/SparcV9/InstrSched/SchedGraph.h +++ b/lib/Target/SparcV9/InstrSched/SchedGraph.h @@ -14,11 +14,12 @@ #ifndef LLVM_CODEGEN_SCHEDGRAPH_H #define LLVM_CODEGEN_SCHEDGRAPH_H +#include "llvm/CodeGen/SchedGraphCommon.h" #include "llvm/CodeGen/MachineInstr.h" -#include "Support/GraphTraits.h" -#include "Support/hash_map" #include "llvm/Transforms/Scalar.h" -#include "llvm/CodeGen/SchedGraphCommon.h" +#include "Support/hash_map" +#include "Support/GraphTraits.h" + class RegToRefVecMap; class ValueToDefVecMap; @@ -31,21 +32,23 @@ class SchedGraphNode : public SchedGraphNodeCommon { const MachineInstr *MI; - SchedGraphNode (unsigned nodeId, MachineBasicBlock *mbb, - int indexInBB, const TargetMachine& Target); - ~SchedGraphNode (); + SchedGraphNode(unsigned nodeId, MachineBasicBlock *mbb, int indexInBB, + const TargetMachine& Target); + ~SchedGraphNode(); friend class SchedGraph; // give access for ctor and dtor friend class SchedGraphEdge; // give access for adding edges public: + // Accessor methods - const MachineInstr* getMachineInstr () const { return MI; } - const MachineOpCode getOpCode () const { return MI->getOpCode(); } - bool isDummyNode () const { return (MI == NULL); } - MachineBasicBlock &getMachineBasicBlock() const { return *MBB; } + const MachineInstr* getMachineInstr() const { return MI; } + const MachineOpCode getOpCode() const { return MI->getOpCode(); } + bool isDummyNode() const { return (MI == NULL); } + MachineBasicBlock &getMachineBasicBlock() const { return *MBB; } - int getOrigIndexInBB() const { return origIndexInBB; } + int getOrigIndexInBB() const { return origIndexInBB; } + void print(std::ostream &os) const; }; class SchedGraph : public SchedGraphCommon { @@ -56,15 +59,15 @@ public: typedef hash_map<const MachineInstr*, SchedGraphNode*>::const_iterator iterator; typedef hash_map<const MachineInstr*, SchedGraphNode*>::const_iterator const_iterator; - MachineBasicBlock& getBasicBlock() const{return MBB;} - const unsigned int getNumNodes() const { return GraphMap.size()+2; } + MachineBasicBlock& getBasicBlock() const{return MBB;} + const unsigned int getNumNodes() const { return GraphMap.size()+2; } SchedGraphNode* getGraphNodeForInstr(const MachineInstr* MI) const { const_iterator onePair = find(MI); return (onePair != end())? onePair->second : NULL; } // Debugging support - void dump () const; + void dump() const; protected: SchedGraph(MachineBasicBlock& mbb, const TargetMachine& TM); @@ -89,12 +92,9 @@ protected: private: friend class SchedGraphSet; // give access to ctor - - - + inline void noteGraphNodeForInstr (const MachineInstr* minstr, - SchedGraphNode* node) - { + SchedGraphNode* node) { assert((*this)[minstr] == NULL); (*this)[minstr] = node; } @@ -102,50 +102,46 @@ private: // // Graph builder // - void buildGraph (const TargetMachine& target); + void buildGraph(const TargetMachine& target); - void buildNodesForBB (const TargetMachine& target, - MachineBasicBlock &MBB, - std::vector<SchedGraphNode*>& memNV, - std::vector<SchedGraphNode*>& callNV, - RegToRefVecMap& regToRefVecMap, - ValueToDefVecMap& valueToDefVecMap); + void buildNodesForBB(const TargetMachine& target,MachineBasicBlock &MBB, + std::vector<SchedGraphNode*>& memNV, + std::vector<SchedGraphNode*>& callNV, + RegToRefVecMap& regToRefVecMap, + ValueToDefVecMap& valueToDefVecMap); - void findDefUseInfoAtInstr (const TargetMachine& target, - SchedGraphNode* node, - std::vector<SchedGraphNode*>& memNV, - std::vector<SchedGraphNode*>& callNV, - RegToRefVecMap& regToRefVecMap, - ValueToDefVecMap& valueToDefVecMap); - + void findDefUseInfoAtInstr(const TargetMachine& target, SchedGraphNode* node, + std::vector<SchedGraphNode*>& memNV, + std::vector<SchedGraphNode*>& callNV, + RegToRefVecMap& regToRefVecMap, + ValueToDefVecMap& valueToDefVecMap); - void addEdgesForInstruction(const MachineInstr& minstr, - const ValueToDefVecMap& valueToDefVecMap, - const TargetMachine& target); + void addEdgesForInstruction(const MachineInstr& minstr, + const ValueToDefVecMap& valueToDefVecMap, + const TargetMachine& target); - void addCDEdges (const TerminatorInst* term, - const TargetMachine& target); + void addCDEdges(const TerminatorInst* term, const TargetMachine& target); - void addMemEdges (const std::vector<SchedGraphNode*>& memNod, - const TargetMachine& target); + void addMemEdges(const std::vector<SchedGraphNode*>& memNod, + const TargetMachine& target); - void addCallCCEdges (const std::vector<SchedGraphNode*>& memNod, - MachineBasicBlock& bbMvec, - const TargetMachine& target); - void addCallDepEdges (const std::vector<SchedGraphNode*>& callNV, - const TargetMachine& target); + void addCallCCEdges(const std::vector<SchedGraphNode*>& memNod, + MachineBasicBlock& bbMvec, + const TargetMachine& target); + + void addCallDepEdges(const std::vector<SchedGraphNode*>& callNV, + const TargetMachine& target); - void addMachineRegEdges (RegToRefVecMap& regToRefVecMap, - const TargetMachine& target); + void addMachineRegEdges(RegToRefVecMap& regToRefVecMap, + const TargetMachine& target); - void addEdgesForValue (SchedGraphNode* refNode, - const RefVec& defVec, - const Value* defValue, - bool refNodeIsDef, - bool refNodeIsDefAndUse, - const TargetMachine& target); - void addDummyEdges(); + void addEdgesForValue(SchedGraphNode* refNode, const RefVec& defVec, + const Value* defValue, bool refNodeIsDef, + bool refNodeIsDefAndUse, + const TargetMachine& target); + + void addDummyEdges(); }; @@ -156,7 +152,7 @@ class SchedGraphSet { std::vector<SchedGraph*> Graphs; // Graph builder - void buildGraphsForMethod (const Function *F, const TargetMachine& target); + void buildGraphsForMethod(const Function *F, const TargetMachine& target); inline void addGraph(SchedGraph* graph) { assert(graph != NULL); @@ -164,7 +160,7 @@ class SchedGraphSet { } public: - SchedGraphSet(const Function * function, const TargetMachine& target); + SchedGraphSet(const Function *function, const TargetMachine& target); ~SchedGraphSet(); //iterators @@ -200,7 +196,7 @@ public: // operator*() differs for pred or succ iterator inline _NodeType* operator*() const { return (_NodeType*)(*oi)->getSrc(); } - inline _NodeType* operator->() const { return operator*(); } + inline _NodeType* operator->() const { return operator*(); } inline _EdgeType* getEdge() const { return *(oi); } @@ -228,7 +224,7 @@ public: inline bool operator!=(const _Self& x) const { return !operator==(x); } inline _NodeType* operator*() const { return (_NodeType*)(*oi)->getSink(); } - inline _NodeType* operator->() const { return operator*(); } + inline _NodeType* operator->() const { return operator*(); } inline _EdgeType* getEdge() const { return *(oi); } @@ -252,16 +248,16 @@ typedef SGPredIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator> typedef SGPredIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator> sg_pred_const_iterator; -inline sg_pred_iterator pred_begin( SchedGraphNode *N) { +inline sg_pred_iterator pred_begin(SchedGraphNode *N) { return sg_pred_iterator(N->beginInEdges()); } -inline sg_pred_iterator pred_end( SchedGraphNode *N) { +inline sg_pred_iterator pred_end(SchedGraphNode *N) { return sg_pred_iterator(N->endInEdges()); } inline sg_pred_const_iterator pred_begin(const SchedGraphNode *N) { return sg_pred_const_iterator(N->beginInEdges()); } -inline sg_pred_const_iterator pred_end( const SchedGraphNode *N) { +inline sg_pred_const_iterator pred_end(const SchedGraphNode *N) { return sg_pred_const_iterator(N->endInEdges()); } @@ -275,16 +271,16 @@ typedef SGSuccIterator<SchedGraphNode, SchedGraphEdge, SchedGraphNode::iterator> typedef SGSuccIterator<const SchedGraphNode, const SchedGraphEdge,SchedGraphNode::const_iterator> sg_succ_const_iterator; -inline sg_succ_iterator succ_begin( SchedGraphNode *N) { +inline sg_succ_iterator succ_begin(SchedGraphNode *N) { return sg_succ_iterator(N->beginOutEdges()); } -inline sg_succ_iterator succ_end( SchedGraphNode *N) { +inline sg_succ_iterator succ_end(SchedGraphNode *N) { return sg_succ_iterator(N->endOutEdges()); } inline sg_succ_const_iterator succ_begin(const SchedGraphNode *N) { return sg_succ_const_iterator(N->beginOutEdges()); } -inline sg_succ_const_iterator succ_end( const SchedGraphNode *N) { +inline sg_succ_const_iterator succ_end(const SchedGraphNode *N) { return sg_succ_const_iterator(N->endOutEdges()); } @@ -319,8 +315,4 @@ template <> struct GraphTraits<const SchedGraph*> { } }; - -std::ostream &operator<<(std::ostream& os, const SchedGraphEdge& edge); -std::ostream &operator<<(std::ostream &os, const SchedGraphNode& node); - #endif |