LLVM  6.0.0svn
HexagonSubtarget.cpp
Go to the documentation of this file.
1 //===- HexagonSubtarget.cpp - Hexagon Subtarget Information ---------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Hexagon specific subclass of TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "Hexagon.h"
15 #include "HexagonInstrInfo.h"
16 #include "HexagonRegisterInfo.h"
17 #include "HexagonSubtarget.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallSet.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
29 #include <algorithm>
30 #include <cassert>
31 #include <map>
32 
33 using namespace llvm;
34 
35 #define DEBUG_TYPE "hexagon-subtarget"
36 
37 #define GET_SUBTARGETINFO_CTOR
38 #define GET_SUBTARGETINFO_TARGET_DESC
39 #include "HexagonGenSubtargetInfo.inc"
40 
41 static cl::opt<bool> EnableMemOps("enable-hexagon-memops",
43  cl::desc("Generate V4 MEMOP in code generation for Hexagon target"));
44 
45 static cl::opt<bool> DisableMemOps("disable-hexagon-memops",
47  cl::desc("Do not generate V4 MEMOP in code generation for Hexagon target"));
48 
49 static cl::opt<bool> EnableIEEERndNear("enable-hexagon-ieee-rnd-near",
51  cl::desc("Generate non-chopped conversion from fp to int."));
52 
53 static cl::opt<bool> EnableBSBSched("enable-bsb-sched",
55 
56 static cl::opt<bool> EnableTCLatencySched("enable-tc-latency-sched",
58 
59 static cl::opt<bool> EnableDotCurSched("enable-cur-sched",
61  cl::desc("Enable the scheduler to generate .cur"));
62 
63 static cl::opt<bool> EnableVecFrwdSched("enable-evec-frwd-sched",
65 
66 static cl::opt<bool> DisableHexagonMISched("disable-hexagon-misched",
68  cl::desc("Disable Hexagon MI Scheduling"));
69 
70 static cl::opt<bool> EnableSubregLiveness("hexagon-subreg-liveness",
72  cl::desc("Enable subregister liveness tracking for Hexagon"));
73 
74 static cl::opt<bool> OverrideLongCalls("hexagon-long-calls",
76  cl::desc("If present, forces/disables the use of long calls"));
77 
78 static cl::opt<bool> EnablePredicatedCalls("hexagon-pred-calls",
80  cl::desc("Consider calls to be predicable"));
81 
82 static cl::opt<bool> SchedPredsCloser("sched-preds-closer",
84 
85 static cl::opt<bool> SchedRetvalOptimization("sched-retval-optimization",
87 
88 static cl::opt<bool> EnableCheckBankConflict("hexagon-check-bank-conflict",
90  cl::desc("Enable checking for cache bank conflicts"));
91 
92 
94  StringRef FS, const TargetMachine &TM)
95  : HexagonGenSubtargetInfo(TT, CPU, FS),
96  CPUString(Hexagon_MC::selectHexagonCPU(TT, CPU)),
97  InstrInfo(initializeSubtargetDependencies(CPU, FS)),
98  RegInfo(getHwMode()), TLInfo(TM, *this),
99  InstrItins(getInstrItineraryForCPU(CPUString)) {
100  // Beware of the default constructor of InstrItineraryData: it will
101  // reset all members to 0.
102  assert(InstrItins.Itineraries != nullptr && "InstrItins not initialized");
103 }
104 
107  static std::map<StringRef, Hexagon::ArchEnum> CpuTable{
108  {"hexagonv4", Hexagon::ArchEnum::V4},
109  {"hexagonv5", Hexagon::ArchEnum::V5},
110  {"hexagonv55", Hexagon::ArchEnum::V55},
111  {"hexagonv60", Hexagon::ArchEnum::V60},
112  {"hexagonv62", Hexagon::ArchEnum::V62},
113  };
114 
115  auto FoundIt = CpuTable.find(CPUString);
116  if (FoundIt != CpuTable.end())
117  HexagonArchVersion = FoundIt->second;
118  else
119  llvm_unreachable("Unrecognized Hexagon processor version");
120 
121  UseHVX128BOps = false;
122  UseHVX64BOps = false;
123  UseLongCalls = false;
124 
125  UseMemOps = DisableMemOps ? false : EnableMemOps;
126  ModeIEEERndNear = EnableIEEERndNear;
128 
129  ParseSubtargetFeatures(CPUString, FS);
130 
131  if (OverrideLongCalls.getPosition())
132  UseLongCalls = OverrideLongCalls;
133 
134  return *this;
135 }
136 
138  for (SUnit &SU : DAG->SUnits) {
139  if (!SU.isInstr())
140  continue;
141  SmallVector<SDep, 4> Erase;
142  for (auto &D : SU.Preds)
143  if (D.getKind() == SDep::Output && D.getReg() == Hexagon::USR_OVF)
144  Erase.push_back(D);
145  for (auto &E : Erase)
146  SU.removePred(E);
147  }
148 }
149 
151  for (SUnit &SU : DAG->SUnits) {
152  // Update the latency of chain edges between v60 vector load or store
153  // instructions to be 1. These instruction cannot be scheduled in the
154  // same packet.
155  MachineInstr &MI1 = *SU.getInstr();
156  auto *QII = static_cast<const HexagonInstrInfo*>(DAG->TII);
157  bool IsStoreMI1 = MI1.mayStore();
158  bool IsLoadMI1 = MI1.mayLoad();
159  if (!QII->isHVXVec(MI1) || !(IsStoreMI1 || IsLoadMI1))
160  continue;
161  for (SDep &SI : SU.Succs) {
162  if (SI.getKind() != SDep::Order || SI.getLatency() != 0)
163  continue;
164  MachineInstr &MI2 = *SI.getSUnit()->getInstr();
165  if (!QII->isHVXVec(MI2))
166  continue;
167  if ((IsStoreMI1 && MI2.mayStore()) || (IsLoadMI1 && MI2.mayLoad())) {
168  SI.setLatency(1);
169  SU.setHeightDirty();
170  // Change the dependence in the opposite direction too.
171  for (SDep &PI : SI.getSUnit()->Preds) {
172  if (PI.getSUnit() != &SU || PI.getKind() != SDep::Order)
173  continue;
174  PI.setLatency(1);
175  SI.getSUnit()->setDepthDirty();
176  }
177  }
178  }
179  }
180 }
181 
182 // Check if a call and subsequent A2_tfrpi instructions should maintain
183 // scheduling affinity. We are looking for the TFRI to be consumed in
184 // the next instruction. This should help reduce the instances of
185 // double register pairs being allocated and scheduled before a call
186 // when not used until after the call. This situation is exacerbated
187 // by the fact that we allocate the pair from the callee saves list,
188 // leading to excess spills and restores.
189 bool HexagonSubtarget::CallMutation::shouldTFRICallBind(
190  const HexagonInstrInfo &HII, const SUnit &Inst1,
191  const SUnit &Inst2) const {
192  if (Inst1.getInstr()->getOpcode() != Hexagon::A2_tfrpi)
193  return false;
194 
195  // TypeXTYPE are 64 bit operations.
196  unsigned Type = HII.getType(*Inst2.getInstr());
197  return Type == HexagonII::TypeS_2op || Type == HexagonII::TypeS_3op ||
198  Type == HexagonII::TypeALU64 || Type == HexagonII::TypeM;
199 }
200 
202  SUnit* LastSequentialCall = nullptr;
203  unsigned VRegHoldingRet = 0;
204  unsigned RetRegister;
205  SUnit* LastUseOfRet = nullptr;
206  auto &TRI = *DAG->MF.getSubtarget().getRegisterInfo();
207  auto &HII = *DAG->MF.getSubtarget<HexagonSubtarget>().getInstrInfo();
208 
209  // Currently we only catch the situation when compare gets scheduled
210  // before preceding call.
211  for (unsigned su = 0, e = DAG->SUnits.size(); su != e; ++su) {
212  // Remember the call.
213  if (DAG->SUnits[su].getInstr()->isCall())
214  LastSequentialCall = &DAG->SUnits[su];
215  // Look for a compare that defines a predicate.
216  else if (DAG->SUnits[su].getInstr()->isCompare() && LastSequentialCall)
217  DAG->SUnits[su].addPred(SDep(LastSequentialCall, SDep::Barrier));
218  // Look for call and tfri* instructions.
219  else if (SchedPredsCloser && LastSequentialCall && su > 1 && su < e-1 &&
220  shouldTFRICallBind(HII, DAG->SUnits[su], DAG->SUnits[su+1]))
221  DAG->SUnits[su].addPred(SDep(&DAG->SUnits[su-1], SDep::Barrier));
222  // Prevent redundant register copies between two calls, which are caused by
223  // both the return value and the argument for the next call being in %R0.
224  // Example:
225  // 1: <call1>
226  // 2: %VregX = COPY %R0
227  // 3: <use of %VregX>
228  // 4: %R0 = ...
229  // 5: <call2>
230  // The scheduler would often swap 3 and 4, so an additional register is
231  // needed. This code inserts a Barrier dependence between 3 & 4 to prevent
232  // this. The same applies for %D0 and %V0/%W0, which are also handled.
233  else if (SchedRetvalOptimization) {
234  const MachineInstr *MI = DAG->SUnits[su].getInstr();
235  if (MI->isCopy() && (MI->readsRegister(Hexagon::R0, &TRI) ||
236  MI->readsRegister(Hexagon::V0, &TRI))) {
237  // %vregX = COPY %R0
238  VRegHoldingRet = MI->getOperand(0).getReg();
239  RetRegister = MI->getOperand(1).getReg();
240  LastUseOfRet = nullptr;
241  } else if (VRegHoldingRet && MI->readsVirtualRegister(VRegHoldingRet))
242  // <use of %vregX>
243  LastUseOfRet = &DAG->SUnits[su];
244  else if (LastUseOfRet && MI->definesRegister(RetRegister, &TRI))
245  // %R0 = ...
246  DAG->SUnits[su].addPred(SDep(LastUseOfRet, SDep::Barrier));
247  }
248  }
249 }
250 
253  return;
254 
255  const auto &HII = static_cast<const HexagonInstrInfo&>(*DAG->TII);
256 
257  // Create artificial edges between loads that could likely cause a bank
258  // conflict. Since such loads would normally not have any dependency
259  // between them, we cannot rely on existing edges.
260  for (unsigned i = 0, e = DAG->SUnits.size(); i != e; ++i) {
261  SUnit &S0 = DAG->SUnits[i];
262  MachineInstr &L0 = *S0.getInstr();
263  if (!L0.mayLoad() || L0.mayStore() ||
265  continue;
266  int Offset0;
267  unsigned Size0;
268  unsigned Base0 = HII.getBaseAndOffset(L0, Offset0, Size0);
269  // Is the access size is longer than the L1 cache line, skip the check.
270  if (Base0 == 0 || Size0 >= 32)
271  continue;
272  // Scan only up to 32 instructions ahead (to avoid n^2 complexity).
273  for (unsigned j = i+1, m = std::min(i+32, e); j != m; ++j) {
274  SUnit &S1 = DAG->SUnits[j];
275  MachineInstr &L1 = *S1.getInstr();
276  if (!L1.mayLoad() || L1.mayStore() ||
278  continue;
279  int Offset1;
280  unsigned Size1;
281  unsigned Base1 = HII.getBaseAndOffset(L1, Offset1, Size1);
282  if (Base1 == 0 || Size1 >= 32 || Base0 != Base1)
283  continue;
284  // Check bits 3 and 4 of the offset: if they differ, a bank conflict
285  // is unlikely.
286  if (((Offset0 ^ Offset1) & 0x18) != 0)
287  continue;
288  // Bits 3 and 4 are the same, add an artificial edge and set extra
289  // latency.
290  SDep A(&S0, SDep::Artificial);
291  A.setLatency(1);
292  S1.addPred(A, true);
293  }
294  }
295 }
296 
297 /// \brief Perform target specific adjustments to the latency of a schedule
298 /// dependency.
300  SDep &Dep) const {
301  MachineInstr *SrcInst = Src->getInstr();
302  MachineInstr *DstInst = Dst->getInstr();
303  if (!Src->isInstr() || !Dst->isInstr())
304  return;
305 
306  const HexagonInstrInfo *QII = getInstrInfo();
307 
308  // Instructions with .new operands have zero latency.
309  SmallSet<SUnit *, 4> ExclSrc;
310  SmallSet<SUnit *, 4> ExclDst;
311  if (QII->canExecuteInBundle(*SrcInst, *DstInst) &&
312  isBestZeroLatency(Src, Dst, QII, ExclSrc, ExclDst)) {
313  Dep.setLatency(0);
314  return;
315  }
316 
317  if (!hasV60TOps())
318  return;
319 
320  // If it's a REG_SEQUENCE, use its destination instruction to determine
321  // the correct latency.
322  if (DstInst->isRegSequence() && Dst->NumSuccs == 1) {
323  unsigned RSeqReg = DstInst->getOperand(0).getReg();
324  MachineInstr *RSeqDst = Dst->Succs[0].getSUnit()->getInstr();
325  unsigned UseIdx = -1;
326  for (unsigned OpNum = 0; OpNum < RSeqDst->getNumOperands(); OpNum++) {
327  const MachineOperand &MO = RSeqDst->getOperand(OpNum);
328  if (MO.isReg() && MO.getReg() && MO.isUse() && MO.getReg() == RSeqReg) {
329  UseIdx = OpNum;
330  break;
331  }
332  }
333  unsigned RSeqLatency = (InstrInfo.getOperandLatency(&InstrItins, *SrcInst,
334  0, *RSeqDst, UseIdx));
335  Dep.setLatency(RSeqLatency);
336  }
337 
338  // Try to schedule uses near definitions to generate .cur.
339  ExclSrc.clear();
340  ExclDst.clear();
341  if (EnableDotCurSched && QII->isToBeScheduledASAP(*SrcInst, *DstInst) &&
342  isBestZeroLatency(Src, Dst, QII, ExclSrc, ExclDst)) {
343  Dep.setLatency(0);
344  return;
345  }
346 
347  updateLatency(*SrcInst, *DstInst, Dep);
348 }
349 
351  std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
352  Mutations.push_back(llvm::make_unique<UsrOverflowMutation>());
353  Mutations.push_back(llvm::make_unique<HVXMemLatencyMutation>());
354  Mutations.push_back(llvm::make_unique<BankConflictMutation>());
355 }
356 
358  std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const {
359  Mutations.push_back(llvm::make_unique<UsrOverflowMutation>());
360  Mutations.push_back(llvm::make_unique<HVXMemLatencyMutation>());
361 }
362 
363 // Pin the vtable to this file.
364 void HexagonSubtarget::anchor() {}
365 
367  if (DisableHexagonMISched.getNumOccurrences())
368  return !DisableHexagonMISched;
369  return true;
370 }
371 
373  return EnablePredicatedCalls;
374 }
375 
376 void HexagonSubtarget::updateLatency(MachineInstr &SrcInst,
377  MachineInstr &DstInst, SDep &Dep) const {
378  if (Dep.isArtificial()) {
379  Dep.setLatency(1);
380  return;
381  }
382 
383  if (!hasV60TOps())
384  return;
385 
386  auto &QII = static_cast<const HexagonInstrInfo&>(*getInstrInfo());
387 
388  // BSB scheduling.
389  if (QII.isHVXVec(SrcInst) || useBSBScheduling())
390  Dep.setLatency((Dep.getLatency() + 1) >> 1);
391 }
392 
393 void HexagonSubtarget::restoreLatency(SUnit *Src, SUnit *Dst) const {
394  MachineInstr *SrcI = Src->getInstr();
395  for (auto &I : Src->Succs) {
396  if (!I.isAssignedRegDep() || I.getSUnit() != Dst)
397  continue;
398  unsigned DepR = I.getReg();
399  int DefIdx = -1;
400  for (unsigned OpNum = 0; OpNum < SrcI->getNumOperands(); OpNum++) {
401  const MachineOperand &MO = SrcI->getOperand(OpNum);
402  if (MO.isReg() && MO.isDef() && MO.getReg() == DepR)
403  DefIdx = OpNum;
404  }
405  assert(DefIdx >= 0 && "Def Reg not found in Src MI");
406  MachineInstr *DstI = Dst->getInstr();
407  for (unsigned OpNum = 0; OpNum < DstI->getNumOperands(); OpNum++) {
408  const MachineOperand &MO = DstI->getOperand(OpNum);
409  if (MO.isReg() && MO.isUse() && MO.getReg() == DepR) {
410  int Latency = (InstrInfo.getOperandLatency(&InstrItins, *SrcI,
411  DefIdx, *DstI, OpNum));
412 
413  // For some instructions (ex: COPY), we might end up with < 0 latency
414  // as they don't have any Itinerary class associated with them.
415  if (Latency <= 0)
416  Latency = 1;
417 
418  I.setLatency(Latency);
419  updateLatency(*SrcI, *DstI, I);
420  }
421  }
422 
423  // Update the latency of opposite edge too.
424  for (auto &J : Dst->Preds) {
425  if (J.getSUnit() != Src)
426  continue;
427  J.setLatency(I.getLatency());
428  }
429  }
430 }
431 
432 /// Change the latency between the two SUnits.
433 void HexagonSubtarget::changeLatency(SUnit *Src, SUnit *Dst, unsigned Lat)
434  const {
435  for (auto &I : Src->Succs) {
436  if (I.getSUnit() != Dst)
437  continue;
438  SDep T = I;
439  I.setLatency(Lat);
440 
441  // Update the latency of opposite edge too.
442  T.setSUnit(Src);
443  auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T);
444  assert(F != Dst->Preds.end());
445  F->setLatency(I.getLatency());
446  }
447 }
448 
449 /// If the SUnit has a zero latency edge, return the other SUnit.
451  for (auto &I : Deps)
452  if (I.isAssignedRegDep() && I.getLatency() == 0 &&
453  !I.getSUnit()->getInstr()->isPseudo())
454  return I.getSUnit();
455  return nullptr;
456 }
457 
458 // Return true if these are the best two instructions to schedule
459 // together with a zero latency. Only one dependence should have a zero
460 // latency. If there are multiple choices, choose the best, and change
461 // the others, if needed.
462 bool HexagonSubtarget::isBestZeroLatency(SUnit *Src, SUnit *Dst,
463  const HexagonInstrInfo *TII, SmallSet<SUnit*, 4> &ExclSrc,
464  SmallSet<SUnit*, 4> &ExclDst) const {
465  MachineInstr &SrcInst = *Src->getInstr();
466  MachineInstr &DstInst = *Dst->getInstr();
467 
468  // Ignore Boundary SU nodes as these have null instructions.
469  if (Dst->isBoundaryNode())
470  return false;
471 
472  if (SrcInst.isPHI() || DstInst.isPHI())
473  return false;
474 
475  if (!TII->isToBeScheduledASAP(SrcInst, DstInst) &&
476  !TII->canExecuteInBundle(SrcInst, DstInst))
477  return false;
478 
479  // The architecture doesn't allow three dependent instructions in the same
480  // packet. So, if the destination has a zero latency successor, then it's
481  // not a candidate for a zero latency predecessor.
482  if (getZeroLatency(Dst, Dst->Succs) != nullptr)
483  return false;
484 
485  // Check if the Dst instruction is the best candidate first.
486  SUnit *Best = nullptr;
487  SUnit *DstBest = nullptr;
488  SUnit *SrcBest = getZeroLatency(Dst, Dst->Preds);
489  if (SrcBest == nullptr || Src->NodeNum >= SrcBest->NodeNum) {
490  // Check that Src doesn't have a better candidate.
491  DstBest = getZeroLatency(Src, Src->Succs);
492  if (DstBest == nullptr || Dst->NodeNum <= DstBest->NodeNum)
493  Best = Dst;
494  }
495  if (Best != Dst)
496  return false;
497 
498  // The caller frequently adds the same dependence twice. If so, then
499  // return true for this case too.
500  if ((Src == SrcBest && Dst == DstBest ) ||
501  (SrcBest == nullptr && Dst == DstBest) ||
502  (Src == SrcBest && Dst == nullptr))
503  return true;
504 
505  // Reassign the latency for the previous bests, which requires setting
506  // the dependence edge in both directions.
507  if (SrcBest != nullptr) {
508  if (!hasV60TOps())
509  changeLatency(SrcBest, Dst, 1);
510  else
511  restoreLatency(SrcBest, Dst);
512  }
513  if (DstBest != nullptr) {
514  if (!hasV60TOps())
515  changeLatency(Src, DstBest, 1);
516  else
517  restoreLatency(Src, DstBest);
518  }
519 
520  // Attempt to find another opprotunity for zero latency in a different
521  // dependence.
522  if (SrcBest && DstBest)
523  // If there is an edge from SrcBest to DstBst, then try to change that
524  // to 0 now.
525  changeLatency(SrcBest, DstBest, 0);
526  else if (DstBest) {
527  // Check if the previous best destination instruction has a new zero
528  // latency dependence opportunity.
529  ExclSrc.insert(Src);
530  for (auto &I : DstBest->Preds)
531  if (ExclSrc.count(I.getSUnit()) == 0 &&
532  isBestZeroLatency(I.getSUnit(), DstBest, TII, ExclSrc, ExclDst))
533  changeLatency(I.getSUnit(), DstBest, 0);
534  } else if (SrcBest) {
535  // Check if previous best source instruction has a new zero latency
536  // dependence opportunity.
537  ExclDst.insert(Dst);
538  for (auto &I : SrcBest->Succs)
539  if (ExclDst.count(I.getSUnit()) == 0 &&
540  isBestZeroLatency(SrcBest, I.getSUnit(), TII, ExclSrc, ExclDst))
541  changeLatency(SrcBest, I.getSUnit(), 0);
542  }
543 
544  return true;
545 }
546 
548  return 32;
549 }
550 
552  return 32;
553 }
554 
556  return EnableSubregLiveness;
557 }
void apply(ScheduleDAGInstrs *DAG) override
static SUnit * getZeroLatency(SUnit *N, SmallVector< SDep, 4 > &Deps)
If the SUnit has a zero latency edge, return the other SUnit.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Function Alias Analysis false
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getReg() const
getReg - Returns the register number.
Hexagon::ArchEnum HexagonArchVersion
StringRef selectHexagonCPU(const Triple &TT, StringRef CPU)
bool isRegSequence() const
Definition: MachineInstr.h:849
void setSUnit(SUnit *SU)
Definition: ScheduleDAG.h:493
void getSMSMutations(std::vector< std::unique_ptr< ScheduleDAGMutation >> &Mutations) const override
F(f)
void removePred(const SDep &D)
Removes the specified edge as a pred of the current node if it exists.
static cl::opt< bool > EnableIEEERndNear("enable-hexagon-ieee-rnd-near", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Generate non-chopped conversion from fp to int."))
bool isPHI() const
Definition: MachineInstr.h:826
HexagonSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
unsigned getL1CacheLineSize() const
SmallVector< SDep, 4 > Preds
All sunit predecessors.
Definition: ScheduleDAG.h:261
bool isToBeScheduledASAP(const MachineInstr &MI1, const MachineInstr &MI2) const
static cl::opt< bool > EnableTCLatencySched("enable-tc-latency-sched", cl::Hidden, cl::ZeroOrMore, cl::init(false))
MachineFunction & MF
Machine function.
Definition: ScheduleDAG.h:570
unsigned NumSuccs
of SDep::Data sucss.
Definition: ScheduleDAG.h:272
unsigned getLatency() const
Returns the latency value for this edge, which roughly means the minimum number of cycles that must e...
Definition: ScheduleDAG.h:143
const HexagonInstrInfo * TII
unsigned getNumOperands() const
Access to explicit operands of the instruction.
Definition: MachineInstr.h:293
const InstrItinerary * Itineraries
Array of itineraries selected.
static cl::opt< bool > OverrideLongCalls("hexagon-long-calls", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("If present, forces/disables the use of long calls"))
bool canExecuteInBundle(const MachineInstr &First, const MachineInstr &Second) const
Can these instructions execute at the same time in a bundle.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition: MachineInstr.h:290
A register output-dependence (aka WAW).
Definition: ScheduleDAG.h:56
unsigned getBaseAndOffset(const MachineInstr &MI, int &Offset, unsigned &AccessSize) const
void clear()
Definition: SmallSet.h:119
unsigned getL1PrefetchDistance() const
HexagonSubtarget(const Triple &TT, StringRef CPU, StringRef FS, const TargetMachine &TM)
#define T
static cl::opt< bool > DisableMemOps("disable-hexagon-memops", cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed, cl::init(false), cl::desc("Do not generate V4 MEMOP in code generation for Hexagon target"))
static cl::opt< bool > EnableMemOps("enable-hexagon-memops", cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed, cl::init(true), cl::desc("Generate V4 MEMOP in code generation for Hexagon target"))
SUnit * getSUnit() const
Definition: ScheduleDAG.h:490
bool isBoundaryNode() const
Boundary nodes are placeholders for the boundary of the scheduling region.
Definition: ScheduleDAG.h:349
Scheduling dependency.
Definition: ScheduleDAG.h:50
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
Definition: MachineInstr.h:639
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:406
void setDepthDirty()
Sets a flag in this node to indicate that its stored Depth value will require recomputation the next ...
MachineInstr * getInstr() const
Returns the representative MachineInstr for this SUnit.
Definition: ScheduleDAG.h:378
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
bool isArtificial() const
Tests if this is an Order dependence that is marked as "artificial", meaning it isn&#39;t necessary for c...
Definition: ScheduleDAG.h:201
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
bool readsVirtualRegister(unsigned Reg) const
Return true if the MachineInstr reads the specified virtual register.
Definition: MachineInstr.h:935
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void apply(ScheduleDAGInstrs *DAG) override
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition: SmallSet.h:36
static cl::opt< bool > EnableCheckBankConflict("hexagon-check-bank-conflict", cl::Hidden, cl::ZeroOrMore, cl::init(true), cl::desc("Enable checking for cache bank conflicts"))
unsigned getAddrMode(const MachineInstr &MI) const
void apply(ScheduleDAGInstrs *DAG) override
void apply(ScheduleDAGInstrs *DAG) override
static cl::opt< bool > EnableSubregLiveness("hexagon-subreg-liveness", cl::Hidden, cl::ZeroOrMore, cl::init(true), cl::desc("Enable subregister liveness tracking for Hexagon"))
bool definesRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr fully defines the specified register.
Definition: MachineInstr.h:957
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn&#39;t already there.
Definition: SmallSet.h:81
static cl::opt< bool > EnablePredicatedCalls("hexagon-pred-calls", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Consider calls to be predicable"))
bool isCopy() const
Definition: MachineInstr.h:857
Any other ordering dependency.
Definition: ScheduleDAG.h:57
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:834
static cl::opt< bool > SchedPredsCloser("sched-preds-closer", cl::Hidden, cl::ZeroOrMore, cl::init(true))
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
An unknown scheduling barrier.
Definition: ScheduleDAG.h:70
bool enableMachineScheduler() const override
static cl::opt< bool > SchedRetvalOptimization("sched-retval-optimization", cl::Hidden, cl::ZeroOrMore, cl::init(true))
void getPostRAMutations(std::vector< std::unique_ptr< ScheduleDAGMutation >> &Mutations) const override
MachineOperand class - Representation of each machine instruction operand.
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:864
bool UseBSBScheduling
True if the target should use Back-Skip-Back scheduling.
uint64_t getType(const MachineInstr &MI) const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool enableSubRegLiveness() const override
bool readsRegister(unsigned Reg, const TargetRegisterInfo *TRI=nullptr) const
Return true if the MachineInstr reads the specified register.
Definition: MachineInstr.h:927
void adjustSchedDependency(SUnit *def, SUnit *use, SDep &dep) const override
Perform target specific adjustments to the latency of a schedule dependency.
void setLatency(unsigned Lat)
Sets the latency for this edge.
Definition: ScheduleDAG.h:148
A ScheduleDAG for scheduling lists of MachineInstr.
Representation of each machine instruction.
Definition: MachineInstr.h:59
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
static cl::opt< bool > EnableVecFrwdSched("enable-evec-frwd-sched", cl::Hidden, cl::ZeroOrMore, cl::init(true))
#define I(x, y, z)
Definition: MD5.cpp:58
#define N
const TargetInstrInfo * TII
Target instruction information.
Definition: ScheduleDAG.h:568
Kind getKind() const
Returns an enum value representing the kind of the dependence.
Definition: ScheduleDAG.h:496
int getOperandLatency(const InstrItineraryData *ItinData, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
getOperandLatency - Compute and return the use operand latency of a given pair of def and use...
bool isReg() const
isReg - Tests if this is a MO_Register operand.
unsigned NodeNum
Entry # of node in the node vector.
Definition: ScheduleDAG.h:269
void setHeightDirty()
Sets a flag in this node to indicate that its stored Height value will require recomputation the next...
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
Definition: MachineInstr.h:626
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool addPred(const SDep &D, bool Required=true)
Adds the specified edge as a pred of the current node if not already.
const HexagonInstrInfo * getInstrInfo() const override
SmallVector< SDep, 4 > Succs
All sunit successors.
Definition: ScheduleDAG.h:262
Arbitrary strong DAG edge (no real dependence).
Definition: ScheduleDAG.h:73
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:57
IRTranslator LLVM IR MI
static cl::opt< bool > EnableBSBSched("enable-bsb-sched", cl::Hidden, cl::ZeroOrMore, cl::init(true))
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
static cl::opt< bool > DisableHexagonMISched("disable-hexagon-misched", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Disable Hexagon MI Scheduling"))
std::vector< SUnit > SUnits
The scheduling units.
Definition: ScheduleDAG.h:572
const MachineOperand & getOperand(unsigned i) const
Definition: MachineInstr.h:295
bool isInstr() const
Returns true if this SUnit refers to a machine instruction as opposed to an SDNode.
Definition: ScheduleDAG.h:367
Scheduling unit. This is a node in the scheduling DAG.
Definition: ScheduleDAG.h:247
static cl::opt< bool > EnableDotCurSched("enable-cur-sched", cl::Hidden, cl::ZeroOrMore, cl::init(true), cl::desc("Enable the scheduler to generate .cur"))
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
Definition: SmallSet.h:65