mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Hoist the HazardRecognizer out of the ScheduleDAGList.cpp file to where
targets can implement them. Make the top-down scheduler non-g5-specific. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26568 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -41,7 +41,53 @@ namespace llvm {
|
|||||||
simpleScheduling, // Two pass, min. critical path, max. utilization.
|
simpleScheduling, // Two pass, min. critical path, max. utilization.
|
||||||
simpleNoItinScheduling, // Same as above exact using generic latency.
|
simpleNoItinScheduling, // Same as above exact using generic latency.
|
||||||
listSchedulingBURR, // Bottom up reg reduction list scheduling.
|
listSchedulingBURR, // Bottom up reg reduction list scheduling.
|
||||||
listSchedulingG5 // G5-specific scheduler. FIXME: parameterize better
|
listSchedulingTD // Top-down list scheduler.
|
||||||
|
};
|
||||||
|
|
||||||
|
/// HazardRecognizer - This determines whether or not an instruction can be
|
||||||
|
/// issued this cycle, and whether or not a noop needs to be inserted to handle
|
||||||
|
/// the hazard.
|
||||||
|
class HazardRecognizer {
|
||||||
|
public:
|
||||||
|
virtual ~HazardRecognizer();
|
||||||
|
|
||||||
|
enum HazardType {
|
||||||
|
NoHazard, // This instruction can be emitted at this cycle.
|
||||||
|
Hazard, // This instruction can't be emitted at this cycle.
|
||||||
|
NoopHazard, // This instruction can't be emitted, and needs noops.
|
||||||
|
};
|
||||||
|
|
||||||
|
/// StartBasicBlock - This is called when a new basic block is started.
|
||||||
|
///
|
||||||
|
virtual void StartBasicBlock() {}
|
||||||
|
|
||||||
|
/// getHazardType - Return the hazard type of emitting this node. There are
|
||||||
|
/// three possible results. Either:
|
||||||
|
/// * NoHazard: it is legal to issue this instruction on this cycle.
|
||||||
|
/// * Hazard: issuing this instruction would stall the machine. If some
|
||||||
|
/// other instruction is available, issue it first.
|
||||||
|
/// * NoopHazard: issuing this instruction would break the program. If
|
||||||
|
/// some other instruction can be issued, do so, otherwise issue a noop.
|
||||||
|
virtual HazardType getHazardType(SDNode *Node) {
|
||||||
|
return NoHazard;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// EmitInstruction - This callback is invoked when an instruction is
|
||||||
|
/// emitted, to advance the hazard state.
|
||||||
|
virtual void EmitInstruction(SDNode *Node) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// AdvanceCycle - This callback is invoked when no instructions can be
|
||||||
|
/// issued on this cycle without a hazard. This should increment the
|
||||||
|
/// internal state of the hazard recognizer so that previously "Hazard"
|
||||||
|
/// instructions will now not be hazards.
|
||||||
|
virtual void AdvanceCycle() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// EmitNoop - This callback is invoked when a noop was added to the
|
||||||
|
/// instruction stream.
|
||||||
|
virtual void EmitNoop() {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
@ -363,11 +409,11 @@ namespace llvm {
|
|||||||
ScheduleDAG* createBURRListDAGScheduler(SelectionDAG &DAG,
|
ScheduleDAG* createBURRListDAGScheduler(SelectionDAG &DAG,
|
||||||
MachineBasicBlock *BB);
|
MachineBasicBlock *BB);
|
||||||
|
|
||||||
/// createTDG5ListDAGScheduler - This creates a top-down list scheduler for
|
/// createTDListDAGScheduler - This creates a top-down list scheduler with
|
||||||
/// the PowerPC G5. FIXME: pull the priority function out into the PPC
|
/// the specified hazard recognizer.
|
||||||
/// backend!
|
ScheduleDAG* createTDListDAGScheduler(SelectionDAG &DAG,
|
||||||
ScheduleDAG* createTDG5ListDAGScheduler(SelectionDAG &DAG,
|
MachineBasicBlock *BB,
|
||||||
MachineBasicBlock *BB);
|
HazardRecognizer &HR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,6 +28,7 @@ namespace llvm {
|
|||||||
class MachineInstr;
|
class MachineInstr;
|
||||||
class TargetLowering;
|
class TargetLowering;
|
||||||
class FunctionLoweringInfo;
|
class FunctionLoweringInfo;
|
||||||
|
class HazardRecognizer;
|
||||||
|
|
||||||
/// SelectionDAGISel - This is the common base class used for SelectionDAG-based
|
/// SelectionDAGISel - This is the common base class used for SelectionDAG-based
|
||||||
/// pattern-matching instruction selectors.
|
/// pattern-matching instruction selectors.
|
||||||
@ -61,6 +62,10 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// GetTargetHazardRecognizer - Return the hazard recognizer to use for this
|
||||||
|
/// target when scheduling the DAG.
|
||||||
|
virtual HazardRecognizer &GetTargetHazardRecognizer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Pick a safe ordering and emit instructions for each target node in the
|
/// Pick a safe ordering and emit instructions for each target node in the
|
||||||
/// graph.
|
/// graph.
|
||||||
|
Reference in New Issue
Block a user