1 //===-- SPUHazardRecognizers.cpp - Cell Hazard Recognizer Impls -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements hazard recognizers for scheduling on Cell SPU
13 //===----------------------------------------------------------------------===//
15 #define DEBUG_TYPE "sched"
17 #include "SPUHazardRecognizers.h"
19 #include "SPUInstrInfo.h"
20 #include "llvm/CodeGen/ScheduleDAG.h"
21 #include "llvm/CodeGen/SelectionDAGNodes.h"
22 #include "llvm/Support/Debug.h"
23 #include "llvm/Support/raw_ostream.h"
26 //===----------------------------------------------------------------------===//
27 // Cell SPU hazard recognizer
29 // This is the pipeline hazard recognizer for the Cell SPU processor. It does
30 // very little right now.
31 //===----------------------------------------------------------------------===//
33 SPUHazardRecognizer::SPUHazardRecognizer(const TargetInstrInfo
&tii
) :
39 /// Return the pipeline hazard type encountered or generated by this
40 /// instruction. Currently returns NoHazard.
43 ScheduleHazardRecognizer::HazardType
44 SPUHazardRecognizer::getHazardType(SUnit
*SU
)
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.
50 const SDNode
*Node
= SU
->getNode()->getFlaggedMachineNode();
51 ScheduleHazardRecognizer::HazardType retval
= NoHazard
;
52 bool mustBeOdd
= false;
54 switch (Node
->getOpcode()) {
111 // Assume that this instruction can be on the even pipe
115 if (mustBeOdd
&& !EvenOdd
)
118 DEBUG(errs() << "SPUHazardRecognizer EvenOdd " << EvenOdd
<< " Hazard "
127 void SPUHazardRecognizer::EmitInstruction(SUnit
*SU
)
131 void SPUHazardRecognizer::AdvanceCycle()
133 DEBUG(errs() << "SPUHazardRecognizer::AdvanceCycle\n");
136 void SPUHazardRecognizer::EmitNoop()