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 /// Return the pipeline hazard type encountered or generated by this
34 /// instruction. Currently returns NoHazard.
37 ScheduleHazardRecognizer::HazardType
38 SPUHazardRecognizer::getHazardType(SUnit *SU, int Stalls)
40 // Initial thoughts on how to do this, but this code cannot work unless the
41 // function's prolog and epilog code are also being scheduled so that we can
42 // accurately determine which pipeline is being scheduled.
44 assert(Stalls == 0 && "SPU hazards don't yet support scoreboard lookahead");
46 const SDNode *Node = SU->getNode()->getFlaggedMachineNode();
47 ScheduleHazardRecognizer::HazardType retval = NoHazard;
48 bool mustBeOdd = false;
50 switch (Node->getOpcode()) {
107 // Assume that this instruction can be on the even pipe
111 if (mustBeOdd && !EvenOdd)
114 DEBUG(errs() << "SPUHazardRecognizer EvenOdd " << EvenOdd << " Hazard "
123 void SPUHazardRecognizer::EmitInstruction(SUnit *SU)
127 void SPUHazardRecognizer::AdvanceCycle()
129 DEBUG(errs() << "SPUHazardRecognizer::AdvanceCycle\n");
132 void SPUHazardRecognizer::EmitNoop()