2007-12-04 22:23:35 +00:00
|
|
|
//===-- SPUHazardRecognizers.cpp - Cell Hazard Recognizer Impls -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-12-04 22:23:35 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements hazard recognizers for scheduling on Cell SPU
|
|
|
|
// processors.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "sched"
|
|
|
|
|
|
|
|
#include "SPUHazardRecognizers.h"
|
|
|
|
#include "SPU.h"
|
|
|
|
#include "SPUInstrInfo.h"
|
2009-01-15 22:18:12 +00:00
|
|
|
#include "llvm/CodeGen/ScheduleDAG.h"
|
|
|
|
#include "llvm/CodeGen/SelectionDAGNodes.h"
|
2007-12-04 22:23:35 +00:00
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-23 06:49:22 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2007-12-04 22:23:35 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Cell SPU hazard recognizer
|
|
|
|
//
|
|
|
|
// This is the pipeline hazard recognizer for the Cell SPU processor. It does
|
|
|
|
// very little right now.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
SPUHazardRecognizer::SPUHazardRecognizer(const TargetInstrInfo &tii) :
|
|
|
|
TII(tii),
|
|
|
|
EvenOdd(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Return the pipeline hazard type encountered or generated by this
|
|
|
|
/// instruction. Currently returns NoHazard.
|
|
|
|
///
|
|
|
|
/// \return NoHazard
|
2009-01-15 22:18:12 +00:00
|
|
|
ScheduleHazardRecognizer::HazardType
|
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.
Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.
Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.
Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.
ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.
ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 05:03:26 +00:00
|
|
|
SPUHazardRecognizer::getHazardType(SUnit *SU, int Stalls)
|
2007-12-04 22:23:35 +00:00
|
|
|
{
|
|
|
|
// Initial thoughts on how to do this, but this code cannot work unless the
|
|
|
|
// function's prolog and epilog code are also being scheduled so that we can
|
|
|
|
// accurately determine which pipeline is being scheduled.
|
|
|
|
#if 0
|
Various bits of framework needed for precise machine-level selection
DAG scheduling during isel. Most new functionality is currently
guarded by -enable-sched-cycles and -enable-sched-hazard.
Added InstrItineraryData::IssueWidth field, currently derived from
ARM itineraries, but could be initialized differently on other targets.
Added ScheduleHazardRecognizer::MaxLookAhead to indicate whether it is
active, and if so how many cycles of state it holds.
Added SchedulingPriorityQueue::HasReadyFilter to allowing gating entry
into the scheduler's available queue.
ScoreboardHazardRecognizer now accesses the ScheduleDAG in order to
get information about it's SUnits, provides RecedeCycle for bottom-up
scheduling, correctly computes scoreboard depth, tracks IssueCount, and
considers potential stall cycles when checking for hazards.
ScheduleDAGRRList now models machine cycles and hazards (under
flags). It tracks MinAvailableCycle, drives the hazard recognizer and
priority queue's ready filter, manages a new PendingQueue, properly
accounts for stall cycles, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-24 05:03:26 +00:00
|
|
|
assert(Stalls == 0 && "SPU hazards don't yet support scoreboard lookahead");
|
|
|
|
|
2009-01-15 22:18:12 +00:00
|
|
|
const SDNode *Node = SU->getNode()->getFlaggedMachineNode();
|
|
|
|
ScheduleHazardRecognizer::HazardType retval = NoHazard;
|
2007-12-04 22:23:35 +00:00
|
|
|
bool mustBeOdd = false;
|
|
|
|
|
|
|
|
switch (Node->getOpcode()) {
|
|
|
|
case SPU::LQDv16i8:
|
|
|
|
case SPU::LQDv8i16:
|
|
|
|
case SPU::LQDv4i32:
|
|
|
|
case SPU::LQDv4f32:
|
|
|
|
case SPU::LQDv2f64:
|
|
|
|
case SPU::LQDr128:
|
|
|
|
case SPU::LQDr64:
|
|
|
|
case SPU::LQDr32:
|
|
|
|
case SPU::LQDr16:
|
|
|
|
case SPU::LQAv16i8:
|
|
|
|
case SPU::LQAv8i16:
|
|
|
|
case SPU::LQAv4i32:
|
|
|
|
case SPU::LQAv4f32:
|
|
|
|
case SPU::LQAv2f64:
|
|
|
|
case SPU::LQAr128:
|
|
|
|
case SPU::LQAr64:
|
|
|
|
case SPU::LQAr32:
|
|
|
|
case SPU::LQXv4i32:
|
|
|
|
case SPU::LQXr128:
|
|
|
|
case SPU::LQXr64:
|
|
|
|
case SPU::LQXr32:
|
|
|
|
case SPU::LQXr16:
|
|
|
|
case SPU::STQDv16i8:
|
|
|
|
case SPU::STQDv8i16:
|
|
|
|
case SPU::STQDv4i32:
|
|
|
|
case SPU::STQDv4f32:
|
|
|
|
case SPU::STQDv2f64:
|
|
|
|
case SPU::STQDr128:
|
|
|
|
case SPU::STQDr64:
|
|
|
|
case SPU::STQDr32:
|
|
|
|
case SPU::STQDr16:
|
|
|
|
case SPU::STQDr8:
|
|
|
|
case SPU::STQAv16i8:
|
|
|
|
case SPU::STQAv8i16:
|
|
|
|
case SPU::STQAv4i32:
|
|
|
|
case SPU::STQAv4f32:
|
|
|
|
case SPU::STQAv2f64:
|
|
|
|
case SPU::STQAr128:
|
|
|
|
case SPU::STQAr64:
|
|
|
|
case SPU::STQAr32:
|
|
|
|
case SPU::STQAr16:
|
|
|
|
case SPU::STQAr8:
|
|
|
|
case SPU::STQXv16i8:
|
|
|
|
case SPU::STQXv8i16:
|
|
|
|
case SPU::STQXv4i32:
|
|
|
|
case SPU::STQXv4f32:
|
|
|
|
case SPU::STQXv2f64:
|
|
|
|
case SPU::STQXr128:
|
|
|
|
case SPU::STQXr64:
|
|
|
|
case SPU::STQXr32:
|
|
|
|
case SPU::STQXr16:
|
|
|
|
case SPU::STQXr8:
|
|
|
|
case SPU::RET:
|
|
|
|
mustBeOdd = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
// Assume that this instruction can be on the even pipe
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mustBeOdd && !EvenOdd)
|
|
|
|
retval = Hazard;
|
|
|
|
|
2009-08-23 06:49:22 +00:00
|
|
|
DEBUG(errs() << "SPUHazardRecognizer EvenOdd " << EvenOdd << " Hazard "
|
|
|
|
<< retval << "\n");
|
2007-12-04 22:23:35 +00:00
|
|
|
EvenOdd ^= 1;
|
|
|
|
return retval;
|
|
|
|
#else
|
|
|
|
return NoHazard;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-01-15 22:18:12 +00:00
|
|
|
void SPUHazardRecognizer::EmitInstruction(SUnit *SU)
|
2007-12-04 22:23:35 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SPUHazardRecognizer::AdvanceCycle()
|
|
|
|
{
|
2009-08-23 06:49:22 +00:00
|
|
|
DEBUG(errs() << "SPUHazardRecognizer::AdvanceCycle\n");
|
2007-12-04 22:23:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SPUHazardRecognizer::EmitNoop()
|
|
|
|
{
|
|
|
|
AdvanceCycle();
|
|
|
|
}
|