34 if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD)
43 assert(Stalls == 0 &&
"ARM hazards don't support scoreboard lookahead");
47 if (!
MI->isDebugInstr()) {
70 (
TII.canCauseFpMLxStall(
MI->getOpcode()) ||
89 if (!
MI->isDebugInstr()) {
96 if (FpMLxStalls && --FpMLxStalls == 0)
127 BaseOp = &
MI.getOperand(1);
132 ?
MI.getOperand(3).getImm()
133 :
MI.getOperand(2).getImm();
139 BaseOp = &
MI.getOperand(1);
144 BaseOp = &
MI.getOperand(2);
149 ?
MI.getOperand(4).getImm()
150 :
MI.getOperand(3).getImm();
158 BaseOp = &
MI.getOperand(1);
159 Offset =
MI.getOperand(2).isImm() ?
MI.getOperand(2).getImm() : 0;
160 return MI.getOperand(2).isImm();
166 const ScheduleDAG *DAG, int64_t CPUBankMask,
bool CPUAssumeITCMConflict)
167 : MF(DAG->MF),
DL(DAG->MF.getDataLayout()),
172 : CPUAssumeITCMConflict) {
177ARMBankConflictHazardRecognizer::CheckOffsets(
unsigned O0,
unsigned O1) {
188 auto BaseVal0 = MO0->getValue();
189 auto BasePseudoVal0 = MO0->getPseudoValue();
192 if (!MO0->getSize().hasValue() || MO0->getSize().getValue() > 4)
195 bool SPvalid =
false;
197 int64_t SPOffset0 = 0;
199 for (
auto L1 : Accesses) {
200 auto MO1 = *L1->memoperands().begin();
201 auto BaseVal1 = MO1->getValue();
202 auto BasePseudoVal1 = MO1->getPseudoValue();
206 if (BaseVal0 && BaseVal1) {
207 const Value *Ptr0, *Ptr1;
210 if (Ptr0 == Ptr1 && Ptr0)
211 return CheckOffsets(Offset0, Offset1);
214 if (BasePseudoVal0 && BasePseudoVal1 &&
215 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
218 auto FS0 = cast<FixedStackPseudoSourceValue>(BasePseudoVal0);
219 auto FS1 = cast<FixedStackPseudoSourceValue>(BasePseudoVal1);
222 return CheckOffsets(Offset0, Offset1);
226 if (BasePseudoVal0 && BasePseudoVal1 &&
227 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
228 BasePseudoVal0->isConstantPool() && AssumeITCMBankConflict)
245 return CheckOffsets(SPOffset0, SPOffset1);
256 if (!
MI.mayLoad() ||
MI.mayStore() ||
MI.getNumMemOperands() != 1)
259 auto MO = *
MI.memoperands().begin();
263 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.