36 if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD)
45 assert(Stalls == 0 &&
"ARM hazards don't support scoreboard lookahead");
49 if (!
MI->isDebugInstr()) {
72 (
TII.canCauseFpMLxStall(
MI->getOpcode()) ||
91 if (!
MI->isDebugInstr()) {
98 if (FpMLxStalls && --FpMLxStalls == 0)
129 BaseOp = &
MI.getOperand(1);
134 ?
MI.getOperand(3).getImm()
135 :
MI.getOperand(2).getImm();
141 BaseOp = &
MI.getOperand(1);
146 BaseOp = &
MI.getOperand(2);
151 ?
MI.getOperand(4).getImm()
152 :
MI.getOperand(3).getImm();
160 BaseOp = &
MI.getOperand(1);
161 Offset =
MI.getOperand(2).isImm() ?
MI.getOperand(2).getImm() : 0;
162 return MI.getOperand(2).isImm();
168 const ScheduleDAG *DAG, int64_t CPUBankMask,
bool CPUAssumeITCMConflict)
169 : MF(DAG->MF),
DL(DAG->MF.getDataLayout()),
174 : CPUAssumeITCMConflict) {
179ARMBankConflictHazardRecognizer::CheckOffsets(
unsigned O0,
unsigned O1) {
190 auto BaseVal0 = MO0->getValue();
191 auto BasePseudoVal0 = MO0->getPseudoValue();
194 if (!MO0->getSize().hasValue() || MO0->getSize().getValue() > 4)
197 bool SPvalid =
false;
199 int64_t SPOffset0 = 0;
201 for (
auto L1 : Accesses) {
202 auto MO1 = *L1->memoperands().begin();
203 auto BaseVal1 = MO1->getValue();
204 auto BasePseudoVal1 = MO1->getPseudoValue();
208 if (BaseVal0 && BaseVal1) {
209 const Value *Ptr0, *Ptr1;
212 if (Ptr0 == Ptr1 && Ptr0)
213 return CheckOffsets(Offset0, Offset1);
216 if (BasePseudoVal0 && BasePseudoVal1 &&
217 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
220 auto FS0 = cast<FixedStackPseudoSourceValue>(BasePseudoVal0);
221 auto FS1 = cast<FixedStackPseudoSourceValue>(BasePseudoVal1);
224 return CheckOffsets(Offset0, Offset1);
228 if (BasePseudoVal0 && BasePseudoVal1 &&
229 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
230 BasePseudoVal0->isConstantPool() && AssumeITCMBankConflict)
247 return CheckOffsets(SPOffset0, SPOffset1);
258 if (!
MI.mayLoad() ||
MI.mayStore() ||
MI.getNumMemOperands() != 1)
261 auto MO = *
MI.memoperands().begin();
265 Accesses.push_back(&
MI);
MachineInstrBuilder MachineInstrBuilder & DefMI
static bool getBaseOffset(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset)
static cl::opt< int > DataBankMask("arm-data-bank-mask", cl::init(-1), cl::Hidden)
static cl::opt< bool > AssumeITCMConflict("arm-assume-itcm-bankconflict", cl::init(false), cl::Hidden)
static bool hasRAWHazard(MachineInstr *DefMI, MachineInstr *MI, const TargetRegisterInfo &TRI)
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
const HexagonInstrInfo * TII
unsigned const TargetRegisterInfo * TRI
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
unsigned getOpcode() const
Return the opcode number for this descriptor.
int64_t getObjectOffset(int ObjectIdx) const
Return the assigned stack offset of the specified object from the incoming stack pointer.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
const MachineBasicBlock * getParent() const
bool isBarrier(QueryType Type=AnyInBundle) const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
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.
const MachineOperand & getOperand(unsigned i) const
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...
virtual const TargetInstrInfo * getInstrInfo() const
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
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.