blob: e4787ebfc31e4ccb60e8407247c8e573c1f4c272 [file] [log] [blame]
Scott Michel266bc8f2007-12-04 22:23:35 +00001//===-- SPUHazardRecognizers.cpp - Cell Hazard Recognizer Impls -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by a team from the Computer Systems Research
6// Department at The Aerospace Corporation.
7//
8// See README.txt for details.
9//
10//===----------------------------------------------------------------------===//
11//
12// This file implements hazard recognizers for scheduling on Cell SPU
13// processors.
14//
15//===----------------------------------------------------------------------===//
16
17#define DEBUG_TYPE "sched"
18
19#include "SPUHazardRecognizers.h"
20#include "SPU.h"
21#include "SPUInstrInfo.h"
22#include "llvm/Support/Debug.h"
23
24using namespace llvm;
25
26//===----------------------------------------------------------------------===//
27// Cell SPU hazard recognizer
28//
29// This is the pipeline hazard recognizer for the Cell SPU processor. It does
30// very little right now.
31//===----------------------------------------------------------------------===//
32
33SPUHazardRecognizer::SPUHazardRecognizer(const TargetInstrInfo &tii) :
34 TII(tii),
35 EvenOdd(0)
36{
37}
38
39/// Return the pipeline hazard type encountered or generated by this
40/// instruction. Currently returns NoHazard.
41///
42/// \return NoHazard
43HazardRecognizer::HazardType
44SPUHazardRecognizer::getHazardType(SDNode *Node)
45{
46 // Initial thoughts on how to do this, but this code cannot work unless the
47 // function's prolog and epilog code are also being scheduled so that we can
48 // accurately determine which pipeline is being scheduled.
49#if 0
50 HazardRecognizer::HazardType retval = NoHazard;
51 bool mustBeOdd = false;
52
53 switch (Node->getOpcode()) {
54 case SPU::LQDv16i8:
55 case SPU::LQDv8i16:
56 case SPU::LQDv4i32:
57 case SPU::LQDv4f32:
58 case SPU::LQDv2f64:
59 case SPU::LQDr128:
60 case SPU::LQDr64:
61 case SPU::LQDr32:
62 case SPU::LQDr16:
63 case SPU::LQAv16i8:
64 case SPU::LQAv8i16:
65 case SPU::LQAv4i32:
66 case SPU::LQAv4f32:
67 case SPU::LQAv2f64:
68 case SPU::LQAr128:
69 case SPU::LQAr64:
70 case SPU::LQAr32:
71 case SPU::LQXv4i32:
72 case SPU::LQXr128:
73 case SPU::LQXr64:
74 case SPU::LQXr32:
75 case SPU::LQXr16:
76 case SPU::STQDv16i8:
77 case SPU::STQDv8i16:
78 case SPU::STQDv4i32:
79 case SPU::STQDv4f32:
80 case SPU::STQDv2f64:
81 case SPU::STQDr128:
82 case SPU::STQDr64:
83 case SPU::STQDr32:
84 case SPU::STQDr16:
85 case SPU::STQDr8:
86 case SPU::STQAv16i8:
87 case SPU::STQAv8i16:
88 case SPU::STQAv4i32:
89 case SPU::STQAv4f32:
90 case SPU::STQAv2f64:
91 case SPU::STQAr128:
92 case SPU::STQAr64:
93 case SPU::STQAr32:
94 case SPU::STQAr16:
95 case SPU::STQAr8:
96 case SPU::STQXv16i8:
97 case SPU::STQXv8i16:
98 case SPU::STQXv4i32:
99 case SPU::STQXv4f32:
100 case SPU::STQXv2f64:
101 case SPU::STQXr128:
102 case SPU::STQXr64:
103 case SPU::STQXr32:
104 case SPU::STQXr16:
105 case SPU::STQXr8:
106 case SPU::RET:
107 mustBeOdd = true;
108 break;
109 default:
110 // Assume that this instruction can be on the even pipe
111 break;
112 }
113
114 if (mustBeOdd && !EvenOdd)
115 retval = Hazard;
116
117 DOUT << "SPUHazardRecognizer EvenOdd " << EvenOdd << " Hazard " << retval << "\n";
118 EvenOdd ^= 1;
119 return retval;
120#else
121 return NoHazard;
122#endif
123}
124
125void SPUHazardRecognizer::EmitInstruction(SDNode *Node)
126{
127}
128
129void SPUHazardRecognizer::AdvanceCycle()
130{
131 DOUT << "SPUHazardRecognizer::AdvanceCycle\n";
132}
133
134void SPUHazardRecognizer::EmitNoop()
135{
136 AdvanceCycle();
137}