Go to the documentation of this file.
25 #define DEBUG_TYPE "machine-scheduler"
27 STATISTIC(NumFused,
"Number of instr pairs fused");
48 const SUnit *CurrentSU = &SU;
49 while ((CurrentSU =
getPredClusterSU(*CurrentSU)) && Num < FuseLimit) Num ++;
50 return Num < FuseLimit;
79 "Currently we only support chaining together two instructions");
83 if (
SI.getSUnit() == &SecondSU)
87 if (
SI.getSUnit() == &FirstSU)
98 if (&SecondSU != &DAG.
ExitSU)
102 SU == &DAG.
ExitSU || SU == &SecondSU || SU->
isPred(&SecondSU))
111 if (&FirstSU != &DAG.
EntrySU) {
123 if (&SecondSU == &DAG.
ExitSU) {
125 if (SU.
Succs.empty())
158 scheduleAdjacentImpl(*DAG, ISU);
162 scheduleAdjacentImpl(*DAG, DAG->
ExitSU);
199 std::unique_ptr<ScheduleDAGMutation>
207 std::unique_ptr<ScheduleDAGMutation>
This is an optimization pass for GlobalISel generic memory operations.
@ Artificial
Arbitrary strong DAG edge (no real dependence).
std::unique_ptr< ScheduleDAGMutation > createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent)
Create a DAG scheduling mutation to pair branch instructions with one of their predecessors back to b...
@ Anti
A register anti-dependence (aka WAR).
bool addEdge(SUnit *SuccSU, const SDep &PredDep)
Add a DAG edge to the given SU with the given predecessor dependence data.
SmallVector< SDep, 4 > Succs
All sunit successors.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isBoundaryNode() const
Boundary nodes are placeholders for the boundary of the scheduling region.
TargetInstrInfo - Interface to description of machine instruction set.
void apply(Opt *O, const Mod &M, const Mods &... Ms)
const HexagonInstrInfo * TII
bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, SUnit &SecondSU)
Create an artificial edge between FirstSU and SecondSU.
@ Output
A register output-dependence (aka WAW).
std::unique_ptr< ScheduleDAGMutation > createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent)
Create a DAG scheduling mutation to pair instructions back to back for instructions that benefit acco...
static bool shouldScheduleAdjacent(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)
Check if the instr pair, FirstMI and SecondMI, should be fused together.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool isPred(const SUnit *N) const
Tests if node N is a predecessor of this node.
Representation of each machine instruction.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
initializer< Ty > init(const Ty &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StandardInstrumentations SI(Debug, VerifyEach)
StringRef getName(unsigned Opcode) const
Returns the name for the instructions with the given opcode.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
MachineFunction & MF
Machine function.
SUnit EntrySU
Special node for the region entry.
static cl::opt< bool > EnableMacroFusion("misched-fusion", cl::Hidden, cl::desc("Enable scheduling for macro fusion."), cl::init(true))
TargetSubtargetInfo - Generic base class for all target subtargets.
bool hasLessThanNumFused(const SUnit &SU, unsigned FuseLimit)
Checks if the number of cluster edges between SU and its predecessors is less than FuseLimit.
std::vector< SUnit > SUnits
The scheduling units.
static SUnit * getPredClusterSU(const SUnit &SU)
const TargetInstrInfo * TII
Target instruction information.
bool isWeak() const
Tests if this a weak dependence.
Kind getKind() const
Returns an enum value representing the kind of the dependence.
bool isSucc(const SUnit *N) const
Tests if node N is a successor of this node.
void dumpNodeName(const SUnit &SU) const
@ Cluster
Weak DAG edge linking a chain of clustered instrs.
Mutate the DAG as a postpass after normal DAG building.
static bool isHazard(const SDep &Dep)
SmallVector< SDep, 4 > Preds
All sunit predecessors.
Scheduling unit. This is a node in the scheduling DAG.
A ScheduleDAG for scheduling lists of MachineInstr.
STATISTIC(NumFused, "Number of instr pairs fused")
SUnit ExitSU
Special node for the region exit.
std::function< bool(const TargetInstrInfo &TII, const TargetSubtargetInfo &TSI, const MachineInstr *FirstMI, const MachineInstr &SecondMI)> ShouldSchedulePredTy
Check if the instr pair, FirstMI and SecondMI, should be fused together.