Dale Johannesen | 72f1596 | 2007-07-13 17:31:29 +0000 | [diff] [blame] | 1 | //===----- SchedulePostRAList.cpp - list scheduler ------------------------===// |
Dale Johannesen | e7e7d0d | 2007-07-13 17:13:54 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame^] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dale Johannesen | e7e7d0d | 2007-07-13 17:13:54 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This implements a top-down list scheduler, using standard algorithms. |
| 11 | // The basic approach uses a priority queue of available nodes to schedule. |
| 12 | // One at a time, nodes are taken from the priority queue (thus in priority |
| 13 | // order), checked for legality to schedule, and emitted if legal. |
| 14 | // |
| 15 | // Nodes may not be legal to schedule either due to structural hazards (e.g. |
| 16 | // pipeline or resource constraints) or because an input to the instruction has |
| 17 | // not completed execution. |
| 18 | // |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
| 21 | #define DEBUG_TYPE "post-RA-sched" |
| 22 | #include "llvm/CodeGen/Passes.h" |
| 23 | #include "llvm/CodeGen/MachineFunctionPass.h" |
| 24 | #include "llvm/Support/Debug.h" |
| 25 | //#include "llvm/ADT/Statistic.h" |
| 26 | //#include <climits> |
| 27 | //#include <queue> |
| 28 | #include "llvm/Support/CommandLine.h" |
| 29 | using namespace llvm; |
| 30 | |
| 31 | namespace { |
| 32 | bool NoPostRAScheduling; |
| 33 | |
| 34 | // When this works it will be on by default. |
| 35 | cl::opt<bool, true> |
| 36 | DisablePostRAScheduler("disable-post-RA-scheduler", |
| 37 | cl::desc("Disable scheduling after register allocation"), |
| 38 | cl::location(NoPostRAScheduling), |
| 39 | cl::init(true)); |
| 40 | |
| 41 | class VISIBILITY_HIDDEN SchedulePostRATDList : public MachineFunctionPass { |
| 42 | public: |
| 43 | static char ID; |
| 44 | SchedulePostRATDList() : MachineFunctionPass((intptr_t)&ID) {} |
| 45 | private: |
| 46 | MachineFunction *MF; |
| 47 | const TargetMachine *TM; |
| 48 | public: |
| 49 | const char *getPassName() const { |
| 50 | return "Post RA top-down list latency scheduler (STUB)"; |
| 51 | } |
| 52 | |
| 53 | bool runOnMachineFunction(MachineFunction &Fn); |
| 54 | }; |
| 55 | char SchedulePostRATDList::ID = 0; |
| 56 | } |
| 57 | |
| 58 | bool SchedulePostRATDList::runOnMachineFunction(MachineFunction &Fn) { |
| 59 | if (NoPostRAScheduling) |
| 60 | return true; |
| 61 | |
| 62 | DOUT << "SchedulePostRATDList\n"; |
| 63 | MF = &Fn; |
| 64 | TM = &MF->getTarget(); |
| 65 | |
| 66 | // Loop over all of the basic blocks |
| 67 | for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end(); |
| 68 | MBB != MBBe; ++MBB) |
| 69 | ; |
| 70 | |
| 71 | return true; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | //===----------------------------------------------------------------------===// |
| 76 | // Public Constructor Functions |
| 77 | //===----------------------------------------------------------------------===// |
| 78 | |
| 79 | FunctionPass *llvm::createPostRAScheduler() { |
| 80 | return new SchedulePostRATDList(); |
| 81 | } |