-// $Id$ -*-C++-*-
-//***************************************************************************
-// File:
-// SchedPriorities.h
+//===-- SchedPriorities.h - Encapsulate scheduling heuristics -------------===//
//
-// Purpose:
-// Encapsulate heuristics for instruction scheduling.
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// Strategy:
// Priority ordering rules:
// (3) Instruction that has the maximum number of dependent instructions.
// Note that rules 2 and 3 are only used if issue conflicts prevent
// choosing a higher priority instruction by rule 1.
-//
-// History:
-// 7/30/01 - Vikram Adve - Created
-//**************************************************************************/
+//
+//===----------------------------------------------------------------------===//
#include "SchedPriorities.h"
-#include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
+#include "llvm/CodeGen/FunctionLiveVarInfo.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/Support/CFG.h"
#include "Support/PostOrderIterator.h"
using std::cerr;
+std::ostream &operator<<(std::ostream &os, const NodeDelayPair* nd) {
+ return os << "Delay for node " << nd->node->getNodeId()
+ << " = " << (long)nd->delay << "\n";
+}
+
+
SchedPriorities::SchedPriorities(const Function *, const SchedGraph *G,
FunctionLiveVarInfo &LVI)
: curTime(0), graph(G), methodLiveVarInfo(LVI),
for (SchedGraphNode::const_iterator E=node->beginOutEdges();
E != node->endOutEdges(); ++E)
{
- cycles_t sinkDelay = getNodeDelay((*E)->getSink());
+ cycles_t sinkDelay = getNodeDelay((SchedGraphNode*)(*E)->getSink());
nodeDelay = std::max(nodeDelay, sinkDelay + (*E)->getMinDelay());
}
}
void
SchedPriorities::initializeReadyHeap(const SchedGraph* graph)
{
- const SchedGraphNode* graphRoot = graph->getRoot();
+ const SchedGraphNode* graphRoot = (const SchedGraphNode*)graph->getRoot();
assert(graphRoot->getMachineInstr() == NULL && "Expect dummy root");
// Insert immediate successors of dummy root, which are the actual roots
for (SchedGraphNode::const_iterator E=node->beginOutEdges();
E != node->endOutEdges(); ++E)
{
- cycles_t& etime = getEarliestReadyTimeForNodeRef((*E)->getSink());
+ cycles_t& etime = getEarliestReadyTimeForNodeRef((SchedGraphNode*)(*E)->getSink());
etime = std::max(etime, curTime + (*E)->getMinDelay());
}
}
// else check if instruction is a last use and save it in the hash_map
bool hasLastUse = false;
- const BasicBlock* bb = graphNode->getBB();
+ const BasicBlock* bb = graphNode->getMachineBasicBlock().getBasicBlock();
const ValueSet &LVs = LVI.getLiveVarSetBeforeMInst(MI, bb);
for (MachineInstr::const_val_op_iterator OI = MI->begin(), OE = MI->end();