dca430257cb323307aaffaa1823dd0ef22f2a51f
[oota-llvm.git] / lib / CodeGen / SelectionDAG / ScheduleDAGList.cpp
1 //===-- ScheduleDAGSimple.cpp - Implement a list scheduler for isel DAG ---===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Evan Cheng and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This implements a simple two pass scheduler.  The first pass attempts to push
11 // backward any lengthy instructions and critical paths.  The second pass packs
12 // instructions into semi-optimal time slots.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #define DEBUG_TYPE "sched"
17 #include "llvm/CodeGen/ScheduleDAG.h"
18 #include "llvm/CodeGen/SelectionDAG.h"
19 #include "llvm/Target/TargetMachine.h"
20 #include "llvm/Target/TargetInstrInfo.h"
21 #include <algorithm>
22 #include <queue>
23 using namespace llvm;
24
25
26 namespace llvm {
27 /// Sorting functions for ready queue.
28 struct LSSortPred : public std::binary_function<SDOperand, SDOperand, bool> {
29   bool operator()(const SDOperand* left, const SDOperand* right) const {
30     return true;
31   }
32 };
33
34 /// ScheduleDAGList - List scheduler.
35
36 class ScheduleDAGList : public ScheduleDAG {
37 private:
38   LSSortPred &Cmp;
39
40   // Ready queue
41   std::priority_queue<SDOperand*, std::vector<SDOperand*>, LSSortPred> Ready;
42                       
43 public:
44   ScheduleDAGList(SelectionDAG &dag, MachineBasicBlock *bb,
45                   const TargetMachine &tm, LSSortPred cmp)
46     : ScheduleDAG(listSchedulingBURR, dag, bb, tm), Cmp(cmp), Ready(Cmp)
47   {};
48
49   void Schedule();
50 };
51 }  // end namespace llvm
52
53 void ScheduleDAGList::Schedule() {
54 }
55   
56
57 llvm::ScheduleDAG*
58 llvm::createBURRListDAGScheduler(SelectionDAG &DAG,
59                                  MachineBasicBlock *BB) {
60   return new ScheduleDAGList(DAG, BB, DAG.getTarget(), LSSortPred());
61 }