blob: 41981d3ff145d922237d31b340d36750358f19ba [file] [log] [blame]
Dale Johannesen72f15962007-07-13 17:31:29 +00001//===----- SchedulePostRAList.cpp - list scheduler ------------------------===//
Dale Johannesene7e7d0d2007-07-13 17:13:54 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dale Johannesene7e7d0d2007-07-13 17:13:54 +00007//
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"
Chris Lattner459525d2008-01-14 19:00:06 +000024#include "llvm/Support/Compiler.h"
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000025#include "llvm/Support/Debug.h"
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000026using namespace llvm;
27
28namespace {
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000029 class VISIBILITY_HIDDEN SchedulePostRATDList : public MachineFunctionPass {
30 public:
31 static char ID;
Dan Gohmanae73dc12008-09-04 17:05:41 +000032 SchedulePostRATDList() : MachineFunctionPass(&ID) {}
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000033 private:
34 MachineFunction *MF;
35 const TargetMachine *TM;
36 public:
37 const char *getPassName() const {
38 return "Post RA top-down list latency scheduler (STUB)";
39 }
40
41 bool runOnMachineFunction(MachineFunction &Fn);
42 };
43 char SchedulePostRATDList::ID = 0;
44}
45
46bool SchedulePostRATDList::runOnMachineFunction(MachineFunction &Fn) {
Dale Johannesene7e7d0d2007-07-13 17:13:54 +000047 DOUT << "SchedulePostRATDList\n";
48 MF = &Fn;
49 TM = &MF->getTarget();
50
51 // Loop over all of the basic blocks
52 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
53 MBB != MBBe; ++MBB)
54 ;
55
56 return true;
57}
58
59
60//===----------------------------------------------------------------------===//
61// Public Constructor Functions
62//===----------------------------------------------------------------------===//
63
64FunctionPass *llvm::createPostRAScheduler() {
65 return new SchedulePostRATDList();
66}