class SchedGraphNode: public NonCopyable {
-private:
- unsigned int nodeId;
- const BasicBlock* bb;
+ unsigned nodeId;
+ MachineBasicBlock *MBB;
const MachineInstr* minstr;
std::vector<SchedGraphEdge*> inEdges;
std::vector<SchedGraphEdge*> outEdges;
//
// Accessor methods
//
- unsigned int getNodeId () const { return nodeId; }
- const MachineInstr* getMachineInstr () const { return minstr; }
- const 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(); }
+ unsigned getNodeId () const { return nodeId; }
+ const MachineInstr* getMachineInstr () const { return minstr; }
+ const MachineOpCode getOpCode () const { return minstr->getOpCode(); }
+ int getLatency () const { return latency; }
+ unsigned getNumInEdges () const { return inEdges.size(); }
+ unsigned getNumOutEdges () const { return outEdges.size(); }
bool isDummyNode () const { return (minstr == NULL); }
- const BasicBlock* getBB () const { return bb; }
+ MachineBasicBlock &getMachineBasicBlock() const { return *MBB; }
int getOrigIndexInBB() const { return origIndexInBB; }
//
// disable default constructor and provide a ctor for single-block graphs
/*ctor*/ SchedGraphNode(); // DO NOT IMPLEMENT
- /*ctor*/ SchedGraphNode (unsigned int _nodeId,
- const BasicBlock* _bb,
- const MachineInstr* _minstr,
+ /*ctor*/ SchedGraphNode (unsigned nodeId,
+ MachineBasicBlock *mbb,
int indexInBB,
- const TargetMachine& _target);
+ const TargetMachine& Target);
/*dtor*/ ~SchedGraphNode ();
};
public NonCopyable,
private hash_map<const MachineInstr*, SchedGraphNode*>
{
-private:
- std::vector<const BasicBlock*> bbVec; // basic blocks included in the graph
+ MachineBasicBlock &MBB; // basic blocks for this graph
SchedGraphNode* graphRoot; // the root and leaf are not inserted
SchedGraphNode* graphLeaf; // in the hash_map (see getNumNodes())
//
// Accessor methods
//
- const std::vector<const BasicBlock*>& getBasicBlocks() const { return bbVec; }
- const unsigned int getNumNodes() const { return size()+2; }
+ MachineBasicBlock &getBasicBlock() const { return MBB; }
+ unsigned getNumNodes() const { return size()+2; }
SchedGraphNode* getRoot() const { return graphRoot; }
SchedGraphNode* getLeaf() const { return graphLeaf; }
friend class SchedGraphSet; // give access to ctor
// disable default constructor and provide a ctor for single-block graphs
- /*ctor*/ SchedGraph (); // DO NOT IMPLEMENT
- /*ctor*/ SchedGraph (const BasicBlock* bb,
+ /*ctor*/ SchedGraph (MachineBasicBlock &bb,
const TargetMachine& target);
/*dtor*/ ~SchedGraph ();
//
void buildGraph (const TargetMachine& target);
- void buildNodesforBB (const TargetMachine& target,
- const BasicBlock* bb,
+ void buildNodesForBB (const TargetMachine& target,
+ MachineBasicBlock &MBB,
std::vector<SchedGraphNode*>& memNod,
RegToRefVecMap& regToRefVecMap,
ValueToDefVecMap& valueToDefVecMap);