25#define DEBUG_TYPE "post-RA-sched"
29 Resources->clearResources();
34 PrefVectorStoreNew =
nullptr;
41 if (!
MI || TII->isZeroCost(
MI->getOpcode()))
44 if (!Resources->canReserveResources(*
MI)) {
47 if (isNewStore(*
MI)) {
52 MF->CreateMachineInstr(TII->get(TII->getDotNewOp(*
MI)),
54 if (Resources->canReserveResources(*NewMI))
58 MF->deleteMachineInstr(NewMI);
63 if (SU == UsesDotCur && DotCurPNum != (
int)PacketNum) {
64 LLVM_DEBUG(
dbgs() <<
"*** .cur Hazard in cycle " << PacketNum <<
", "
74 Resources->clearResources();
75 if (DotCurPNum != -1 && DotCurPNum != (
int)PacketNum) {
80 PrefVectorStoreNew =
nullptr;
96 if (PrefVectorStoreNew !=
nullptr && PrefVectorStoreNew != SU)
100 return UsesDotCur && ((SU == UsesDotCur) ^ (DotCurPNum == (int)PacketNum));
106 if (!
TII->mayBeNewStore(
MI))
123 if (TII->isZeroCost(
MI->getOpcode()))
126 if (!Resources->canReserveResources(*
MI) || isNewStore(*
MI)) {
129 assert(TII->mayBeNewStore(*
MI) &&
"Expecting .new store");
132 MF->CreateMachineInstr(TII->get(TII->getDotNewOp(*
MI)),
134 if (Resources->canReserveResources(*NewMI))
135 Resources->reserveResources(*NewMI);
137 Resources->reserveResources(*
MI);
138 MF->deleteMachineInstr(NewMI);
140 Resources->reserveResources(*
MI);
147 if (TII->mayBeCurLoad(*
MI))
148 for (
auto &S : SU->
Succs)
149 if (S.isAssignedRegDep() && S.getLatency() == 0 &&
150 S.getSUnit()->NumPredsLeft == 1) {
151 UsesDotCur = S.getSUnit();
152 DotCurPNum = PacketNum;
155 if (SU == UsesDotCur) {
156 UsesDotCur =
nullptr;
160 UsesLoad =
MI->mayLoad();
162 if (TII->isHVXVec(*
MI) && !
MI->mayLoad() && !
MI->mayStore())
163 for (
auto &S : SU->
Succs)
164 if (S.isAssignedRegDep() && S.getLatency() == 0 &&
165 TII->mayBeNewStore(*S.getSUnit()->getInstr()) &&
166 Resources->canReserveResources(*S.getSUnit()->getInstr())) {
167 PrefVectorStoreNew = S.getSUnit();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const HexagonInstrInfo * TII
void Reset() override
This callback is invoked when a new block of instructions is about to be scheduled.
void AdvanceCycle() override
This callback is invoked whenever the next top-down instruction to be scheduled cannot issue in the c...
bool ShouldPreferAnother(SUnit *) override
This callback may be invoked if getHazardType returns NoHazard.
HazardType getHazardType(SUnit *SU, int stalls) override
Return the hazard type of emitting this node.
void EmitInstruction(SUnit *) override
This callback is invoked when an instruction is emitted to be scheduled, to advance the hazard state.
Representation of each machine instruction.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
LLVM_ABI void insert(mop_iterator InsertBefore, ArrayRef< MachineOperand > Ops)
Inserts Ops BEFORE It. Can untie/retie tied operands.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Register getReg() const
getReg - Returns the register number.
Scheduling unit. This is a node in the scheduling DAG.
bool isInstr() const
Returns true if this SUnit refers to a machine instruction as opposed to an SDNode.
SmallVector< SDep, 4 > Succs
All sunit successors.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
bool contains(const T &V) const
Check if the SmallSet contains the given element.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.