27 unsigned Opcode =
MCID.getOpcode();
28 if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD)
31 return MI->readsRegister(
DefMI->getOperand(0).getReg(), &
TRI);
37 assert(Stalls == 0 &&
"ARM hazards don't support scoreboard lookahead");
41 if (!
MI->isDebugInstr()) {
53 if (!LastMI->isBarrier() &&
54 !(
TII.getSubtarget().hasMuxedUnits() && LastMI->mayLoadOrStore()) &&
57 if (
I != LastMI->getParent()->begin()) {
63 if (
TII.isFpMLxInstruction(
DefMI->getOpcode()) &&
64 (
TII.canCauseFpMLxStall(
MI->getOpcode()) ||
83 if (!
MI->isDebugInstr()) {
90 if (FpMLxStalls && --FpMLxStalls == 0)
121 BaseOp = &
MI.getOperand(1);
126 ?
MI.getOperand(3).getImm()
127 :
MI.getOperand(2).getImm();
133 BaseOp = &
MI.getOperand(1);
138 BaseOp = &
MI.getOperand(2);
143 ?
MI.getOperand(4).getImm()
144 :
MI.getOperand(3).getImm();
152 BaseOp = &
MI.getOperand(1);
153 Offset =
MI.getOperand(2).isImm() ?
MI.getOperand(2).getImm() : 0;
154 return MI.getOperand(2).isImm();
160 const ScheduleDAG *DAG, int64_t DataMask,
bool AssumeITCMBankConflict)
161 : MF(DAG->MF), DL(DAG->MF.getDataLayout()), DataMask(DataMask),
162 AssumeITCMBankConflict(AssumeITCMBankConflict) {
167ARMBankConflictHazardRecognizer::CheckOffsets(
unsigned O0,
unsigned O1) {
178 auto BaseVal0 = MO0->getValue();
179 auto BasePseudoVal0 = MO0->getPseudoValue();
182 if (!MO0->getSize().hasValue() || MO0->getSize().getValue() > 4)
185 bool SPvalid =
false;
187 int64_t SPOffset0 = 0;
189 for (
auto L1 : Accesses) {
190 auto MO1 = *L1->memoperands().begin();
191 auto BaseVal1 = MO1->getValue();
192 auto BasePseudoVal1 = MO1->getPseudoValue();
196 if (BaseVal0 && BaseVal1) {
197 const Value *Ptr0, *Ptr1;
200 if (Ptr0 == Ptr1 && Ptr0)
201 return CheckOffsets(Offset0, Offset1);
204 if (BasePseudoVal0 && BasePseudoVal1 &&
205 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
210 Offset0 = MF.getFrameInfo().getObjectOffset(FS0->getFrameIndex());
211 Offset1 = MF.getFrameInfo().getObjectOffset(FS1->getFrameIndex());
212 return CheckOffsets(Offset0, Offset1);
216 if (BasePseudoVal0 && BasePseudoVal1 &&
217 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
218 BasePseudoVal0->isConstantPool() && AssumeITCMBankConflict)
227 if (!
getBaseOffset(L0, SP, SPOffset0) || SP->getReg().id() != ARM::SP)
235 return CheckOffsets(SPOffset0, SPOffset1);
246 if (!
MI.mayLoad() ||
MI.mayStore() ||
MI.getNumMemOperands() != 1)
249 auto MO = *
MI.memoperands().begin();
253 Accesses.push_back(&
MI);
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
static bool getBaseOffset(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset)
static bool hasRAWHazard(MachineInstr *DefMI, MachineInstr *MI, const TargetRegisterInfo &TRI)
Register const TargetRegisterInfo * TRI
void Reset() override
Reset - This callback is invoked when a new block of instructions is about to be schedule.
void AdvanceCycle() override
AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot...
void EmitInstruction(SUnit *SU) override
EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard stat...
ARMBankConflictHazardRecognizer(const ScheduleDAG *DAG, int64_t DDM, bool ABC)
void RecedeCycle() override
RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot...
HazardType getHazardType(SUnit *SU, int Stalls) override
getHazardType - Return the hazard type of emitting this node.
void EmitInstruction(SUnit *SU) override
EmitInstruction - This callback is invoked when an instruction is emitted, to advance the hazard stat...
void RecedeCycle() override
RecedeCycle - This callback is invoked whenever the next bottom-up instruction to be scheduled cannot...
void AdvanceCycle() override
AdvanceCycle - This callback is invoked whenever the next top-down instruction to be scheduled cannot...
void Reset() override
Reset - This callback is invoked when a new block of instructions is about to be schedule.
HazardType getHazardType(SUnit *SU, int Stalls) override
getHazardType - Return the hazard type of emitting this node.
TypeSize getValue() const
Describe properties that are true of each instruction in the target description file.
MachineInstrBundleIterator< MachineInstr > iterator
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Representation of each machine instruction.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
unsigned getNumMemOperands() const
Return the number of memory operands.
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
constexpr unsigned id() const
Scheduling unit. This is a node in the scheduling DAG.
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
unsigned MaxLookAhead
MaxLookAhead - Indicate the number of cycles in the scoreboard state.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Value * GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset, const DataLayout &DL, bool AllowNonInbounds=true)
Analyze the specified pointer to see if it can be expressed as a base pointer plus a constant offset.
@ O1
Optimize quickly without destroying debuggability.
@ O0
Disable as many optimizations as possible.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.