33 unsigned Opcode =
MCID.getOpcode();
34 if (Opcode == ARM::VMOVRS || Opcode == ARM::VMOVRRD)
37 return MI->readsRegister(
DefMI->getOperand(0).getReg(), &
TRI);
43 assert(Stalls == 0 &&
"ARM hazards don't support scoreboard lookahead");
47 if (!
MI->isDebugInstr()) {
59 if (!LastMI->isBarrier() &&
60 !(
TII.getSubtarget().hasMuxedUnits() && LastMI->mayLoadOrStore()) &&
63 if (
I != LastMI->getParent()->begin()) {
69 if (
TII.isFpMLxInstruction(
DefMI->getOpcode()) &&
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() &&
220 Offset0 = MF.getFrameInfo().getObjectOffset(FS0->getFrameIndex());
221 Offset1 = MF.getFrameInfo().getObjectOffset(FS1->getFrameIndex());
222 return CheckOffsets(Offset0, Offset1);
226 if (BasePseudoVal0 && BasePseudoVal1 &&
227 BasePseudoVal0->kind() == BasePseudoVal1->kind() &&
228 BasePseudoVal0->isConstantPool() && AssumeITCMBankConflict)
237 if (!
getBaseOffset(L0, SP, SPOffset0) || SP->getReg().id() != ARM::SP)
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
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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)
const HexagonInstrInfo * TII
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.
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.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.