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" 22 #include "MCTargetDesc/HexagonMCTargetDesc.h" 23 #include "llvm/CodeGen/MachineInstr.h" 24 #include "llvm/CodeGen/MachineOperand.h" 25 #include "llvm/CodeGen/ScheduleDAG.h" 26 #include "llvm/CodeGen/ScheduleDAGInstrs.h" 27 #include "llvm/Support/CommandLine.h" 28 #include "llvm/Support/ErrorHandling.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", 42 cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed, cl::init(true), 43 cl::desc("Generate V4 MEMOP in code generation for Hexagon target")); 44 45 static cl::opt<bool> DisableMemOps("disable-hexagon-memops", 46 cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed, cl::init(false), 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", 50 cl::Hidden, cl::ZeroOrMore, cl::init(false), 51 cl::desc("Generate non-chopped conversion from fp to int.")); 52 53 static cl::opt<bool> EnableBSBSched("enable-bsb-sched", 54 cl::Hidden, cl::ZeroOrMore, cl::init(true)); 55 56 static cl::opt<bool> EnableHexagonHVXDouble("enable-hexagon-hvx-double", 57 cl::Hidden, cl::ZeroOrMore, cl::init(false), 58 cl::desc("Enable Hexagon Double Vector eXtensions")); 59 60 static cl::opt<bool> EnableHexagonHVX("enable-hexagon-hvx", 61 cl::Hidden, cl::ZeroOrMore, cl::init(false), 62 cl::desc("Enable Hexagon Vector eXtensions")); 63 64 static cl::opt<bool> EnableTCLatencySched("enable-tc-latency-sched", 65 cl::Hidden, cl::ZeroOrMore, cl::init(false)); 66 67 static cl::opt<bool> EnableDotCurSched("enable-cur-sched", 68 cl::Hidden, cl::ZeroOrMore, cl::init(true), 69 cl::desc("Enable the scheduler to generate .cur")); 70 71 static cl::opt<bool> EnableVecFrwdSched("enable-evec-frwd-sched", 72 cl::Hidden, cl::ZeroOrMore, cl::init(true)); 73 74 static cl::opt<bool> DisableHexagonMISched("disable-hexagon-misched", 75 cl::Hidden, cl::ZeroOrMore, cl::init(false), 76 cl::desc("Disable Hexagon MI Scheduling")); 77 78 static cl::opt<bool> EnableSubregLiveness("hexagon-subreg-liveness", 79 cl::Hidden, cl::ZeroOrMore, cl::init(true), 80 cl::desc("Enable subregister liveness tracking for Hexagon")); 81 82 static cl::opt<bool> OverrideLongCalls("hexagon-long-calls", 83 cl::Hidden, cl::ZeroOrMore, cl::init(false), 84 cl::desc("If present, forces/disables the use of long calls")); 85 86 static cl::opt<bool> EnablePredicatedCalls("hexagon-pred-calls", 87 cl::Hidden, cl::ZeroOrMore, cl::init(false), 88 cl::desc("Consider calls to be predicable")); 89 90 static cl::opt<bool> SchedPredsCloser("sched-preds-closer", 91 cl::Hidden, cl::ZeroOrMore, cl::init(true)); 92 93 static cl::opt<bool> SchedRetvalOptimization("sched-retval-optimization", 94 cl::Hidden, cl::ZeroOrMore, cl::init(true)); 95 96 static cl::opt<bool> EnableCheckBankConflict("hexagon-check-bank-conflict", 97 cl::Hidden, cl::ZeroOrMore, cl::init(true), 98 cl::desc("Enable checking for cache bank conflicts")); 99 100 101 HexagonSubtarget::HexagonSubtarget(const Triple &TT, StringRef CPU, 102 StringRef FS, const TargetMachine &TM) 103 : HexagonGenSubtargetInfo(TT, CPU, FS), 104 CPUString(Hexagon_MC::selectHexagonCPU(TT, CPU)), 105 InstrInfo(initializeSubtargetDependencies(CPU, FS)), 106 RegInfo(getHwMode()), TLInfo(TM, *this), 107 InstrItins(getInstrItineraryForCPU(CPUString)) { 108 // Beware of the default constructor of InstrItineraryData: it will 109 // reset all members to 0. 110 assert(InstrItins.Itineraries != nullptr && "InstrItins not initialized"); 111 } 112 113 HexagonSubtarget & 114 HexagonSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) { 115 static std::map<StringRef, HexagonArchEnum> CpuTable { 116 { "hexagonv4", V4 }, 117 { "hexagonv5", V5 }, 118 { "hexagonv55", V55 }, 119 { "hexagonv60", V60 }, 120 { "hexagonv62", V62 }, 121 }; 122 123 auto FoundIt = CpuTable.find(CPUString); 124 if (FoundIt != CpuTable.end()) 125 HexagonArchVersion = FoundIt->second; 126 else 127 llvm_unreachable("Unrecognized Hexagon processor version"); 128 129 UseHVXOps = false; 130 UseHVXDblOps = false; 131 UseLongCalls = false; 132 133 UseMemOps = DisableMemOps ? false : EnableMemOps; 134 ModeIEEERndNear = EnableIEEERndNear; 135 UseBSBScheduling = hasV60TOps() && EnableBSBSched; 136 137 ParseSubtargetFeatures(CPUString, FS); 138 139 if (EnableHexagonHVX.getPosition()) 140 UseHVXOps = EnableHexagonHVX; 141 if (EnableHexagonHVXDouble.getPosition()) 142 UseHVXDblOps = EnableHexagonHVXDouble; 143 if (OverrideLongCalls.getPosition()) 144 UseLongCalls = OverrideLongCalls; 145 146 return *this; 147 } 148 149 void HexagonSubtarget::UsrOverflowMutation::apply(ScheduleDAGInstrs *DAG) { 150 for (SUnit &SU : DAG->SUnits) { 151 if (!SU.isInstr()) 152 continue; 153 SmallVector<SDep, 4> Erase; 154 for (auto &D : SU.Preds) 155 if (D.getKind() == SDep::Output && D.getReg() == Hexagon::USR_OVF) 156 Erase.push_back(D); 157 for (auto &E : Erase) 158 SU.removePred(E); 159 } 160 } 161 162 void HexagonSubtarget::HVXMemLatencyMutation::apply(ScheduleDAGInstrs *DAG) { 163 for (SUnit &SU : DAG->SUnits) { 164 // Update the latency of chain edges between v60 vector load or store 165 // instructions to be 1. These instruction cannot be scheduled in the 166 // same packet. 167 MachineInstr &MI1 = *SU.getInstr(); 168 auto *QII = static_cast<const HexagonInstrInfo*>(DAG->TII); 169 bool IsStoreMI1 = MI1.mayStore(); 170 bool IsLoadMI1 = MI1.mayLoad(); 171 if (!QII->isHVXVec(MI1) || !(IsStoreMI1 || IsLoadMI1)) 172 continue; 173 for (SDep &SI : SU.Succs) { 174 if (SI.getKind() != SDep::Order || SI.getLatency() != 0) 175 continue; 176 MachineInstr &MI2 = *SI.getSUnit()->getInstr(); 177 if (!QII->isHVXVec(MI2)) 178 continue; 179 if ((IsStoreMI1 && MI2.mayStore()) || (IsLoadMI1 && MI2.mayLoad())) { 180 SI.setLatency(1); 181 SU.setHeightDirty(); 182 // Change the dependence in the opposite direction too. 183 for (SDep &PI : SI.getSUnit()->Preds) { 184 if (PI.getSUnit() != &SU || PI.getKind() != SDep::Order) 185 continue; 186 PI.setLatency(1); 187 SI.getSUnit()->setDepthDirty(); 188 } 189 } 190 } 191 } 192 } 193 194 // Check if a call and subsequent A2_tfrpi instructions should maintain 195 // scheduling affinity. We are looking for the TFRI to be consumed in 196 // the next instruction. This should help reduce the instances of 197 // double register pairs being allocated and scheduled before a call 198 // when not used until after the call. This situation is exacerbated 199 // by the fact that we allocate the pair from the callee saves list, 200 // leading to excess spills and restores. 201 bool HexagonSubtarget::CallMutation::shouldTFRICallBind( 202 const HexagonInstrInfo &HII, const SUnit &Inst1, 203 const SUnit &Inst2) const { 204 if (Inst1.getInstr()->getOpcode() != Hexagon::A2_tfrpi) 205 return false; 206 207 // TypeXTYPE are 64 bit operations. 208 unsigned Type = HII.getType(*Inst2.getInstr()); 209 return Type == HexagonII::TypeS_2op || Type == HexagonII::TypeS_3op || 210 Type == HexagonII::TypeALU64 || Type == HexagonII::TypeM; 211 } 212 213 void HexagonSubtarget::CallMutation::apply(ScheduleDAGInstrs *DAG) { 214 SUnit* LastSequentialCall = nullptr; 215 unsigned VRegHoldingRet = 0; 216 unsigned RetRegister; 217 SUnit* LastUseOfRet = nullptr; 218 auto &TRI = *DAG->MF.getSubtarget().getRegisterInfo(); 219 auto &HII = *DAG->MF.getSubtarget<HexagonSubtarget>().getInstrInfo(); 220 221 // Currently we only catch the situation when compare gets scheduled 222 // before preceding call. 223 for (unsigned su = 0, e = DAG->SUnits.size(); su != e; ++su) { 224 // Remember the call. 225 if (DAG->SUnits[su].getInstr()->isCall()) 226 LastSequentialCall = &DAG->SUnits[su]; 227 // Look for a compare that defines a predicate. 228 else if (DAG->SUnits[su].getInstr()->isCompare() && LastSequentialCall) 229 DAG->SUnits[su].addPred(SDep(LastSequentialCall, SDep::Barrier)); 230 // Look for call and tfri* instructions. 231 else if (SchedPredsCloser && LastSequentialCall && su > 1 && su < e-1 && 232 shouldTFRICallBind(HII, DAG->SUnits[su], DAG->SUnits[su+1])) 233 DAG->SUnits[su].addPred(SDep(&DAG->SUnits[su-1], SDep::Barrier)); 234 // Prevent redundant register copies between two calls, which are caused by 235 // both the return value and the argument for the next call being in %R0. 236 // Example: 237 // 1: <call1> 238 // 2: %VregX = COPY %R0 239 // 3: <use of %VregX> 240 // 4: %R0 = ... 241 // 5: <call2> 242 // The scheduler would often swap 3 and 4, so an additional register is 243 // needed. This code inserts a Barrier dependence between 3 & 4 to prevent 244 // this. The same applies for %D0 and %V0/%W0, which are also handled. 245 else if (SchedRetvalOptimization) { 246 const MachineInstr *MI = DAG->SUnits[su].getInstr(); 247 if (MI->isCopy() && (MI->readsRegister(Hexagon::R0, &TRI) || 248 MI->readsRegister(Hexagon::V0, &TRI))) { 249 // %vregX = COPY %R0 250 VRegHoldingRet = MI->getOperand(0).getReg(); 251 RetRegister = MI->getOperand(1).getReg(); 252 LastUseOfRet = nullptr; 253 } else if (VRegHoldingRet && MI->readsVirtualRegister(VRegHoldingRet)) 254 // <use of %vregX> 255 LastUseOfRet = &DAG->SUnits[su]; 256 else if (LastUseOfRet && MI->definesRegister(RetRegister, &TRI)) 257 // %R0 = ... 258 DAG->SUnits[su].addPred(SDep(LastUseOfRet, SDep::Barrier)); 259 } 260 } 261 } 262 263 void HexagonSubtarget::BankConflictMutation::apply(ScheduleDAGInstrs *DAG) { 264 if (!EnableCheckBankConflict) 265 return; 266 267 const auto &HII = static_cast<const HexagonInstrInfo&>(*DAG->TII); 268 269 // Create artificial edges between loads that could likely cause a bank 270 // conflict. Since such loads would normally not have any dependency 271 // between them, we cannot rely on existing edges. 272 for (unsigned i = 0, e = DAG->SUnits.size(); i != e; ++i) { 273 SUnit &S0 = DAG->SUnits[i]; 274 MachineInstr &L0 = *S0.getInstr(); 275 if (!L0.mayLoad() || L0.mayStore() || 276 HII.getAddrMode(L0) != HexagonII::BaseImmOffset) 277 continue; 278 int Offset0; 279 unsigned Size0; 280 unsigned Base0 = HII.getBaseAndOffset(L0, Offset0, Size0); 281 // Is the access size is longer than the L1 cache line, skip the check. 282 if (Base0 == 0 || Size0 >= 32) 283 continue; 284 // Scan only up to 32 instructions ahead (to avoid n^2 complexity). 285 for (unsigned j = i+1, m = std::min(i+32, e); j != m; ++j) { 286 SUnit &S1 = DAG->SUnits[j]; 287 MachineInstr &L1 = *S1.getInstr(); 288 if (!L1.mayLoad() || L1.mayStore() || 289 HII.getAddrMode(L1) != HexagonII::BaseImmOffset) 290 continue; 291 int Offset1; 292 unsigned Size1; 293 unsigned Base1 = HII.getBaseAndOffset(L1, Offset1, Size1); 294 if (Base1 == 0 || Size1 >= 32 || Base0 != Base1) 295 continue; 296 // Check bits 3 and 4 of the offset: if they differ, a bank conflict 297 // is unlikely. 298 if (((Offset0 ^ Offset1) & 0x18) != 0) 299 continue; 300 // Bits 3 and 4 are the same, add an artificial edge and set extra 301 // latency. 302 SDep A(&S0, SDep::Artificial); 303 A.setLatency(1); 304 S1.addPred(A, true); 305 } 306 } 307 } 308 309 /// \brief Perform target specific adjustments to the latency of a schedule 310 /// dependency. 311 void HexagonSubtarget::adjustSchedDependency(SUnit *Src, SUnit *Dst, 312 SDep &Dep) const { 313 MachineInstr *SrcInst = Src->getInstr(); 314 MachineInstr *DstInst = Dst->getInstr(); 315 if (!Src->isInstr() || !Dst->isInstr()) 316 return; 317 318 const HexagonInstrInfo *QII = getInstrInfo(); 319 320 // Instructions with .new operands have zero latency. 321 SmallSet<SUnit *, 4> ExclSrc; 322 SmallSet<SUnit *, 4> ExclDst; 323 if (QII->canExecuteInBundle(*SrcInst, *DstInst) && 324 isBestZeroLatency(Src, Dst, QII, ExclSrc, ExclDst)) { 325 Dep.setLatency(0); 326 return; 327 } 328 329 if (!hasV60TOps()) 330 return; 331 332 // If it's a REG_SEQUENCE, use its destination instruction to determine 333 // the correct latency. 334 if (DstInst->isRegSequence() && Dst->NumSuccs == 1) { 335 unsigned RSeqReg = DstInst->getOperand(0).getReg(); 336 MachineInstr *RSeqDst = Dst->Succs[0].getSUnit()->getInstr(); 337 unsigned UseIdx = -1; 338 for (unsigned OpNum = 0; OpNum < RSeqDst->getNumOperands(); OpNum++) { 339 const MachineOperand &MO = RSeqDst->getOperand(OpNum); 340 if (MO.isReg() && MO.getReg() && MO.isUse() && MO.getReg() == RSeqReg) { 341 UseIdx = OpNum; 342 break; 343 } 344 } 345 unsigned RSeqLatency = (InstrInfo.getOperandLatency(&InstrItins, *SrcInst, 346 0, *RSeqDst, UseIdx)); 347 Dep.setLatency(RSeqLatency); 348 } 349 350 // Try to schedule uses near definitions to generate .cur. 351 ExclSrc.clear(); 352 ExclDst.clear(); 353 if (EnableDotCurSched && QII->isToBeScheduledASAP(*SrcInst, *DstInst) && 354 isBestZeroLatency(Src, Dst, QII, ExclSrc, ExclDst)) { 355 Dep.setLatency(0); 356 return; 357 } 358 359 updateLatency(*SrcInst, *DstInst, Dep); 360 } 361 362 void HexagonSubtarget::getPostRAMutations( 363 std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const { 364 Mutations.push_back(llvm::make_unique<UsrOverflowMutation>()); 365 Mutations.push_back(llvm::make_unique<HVXMemLatencyMutation>()); 366 Mutations.push_back(llvm::make_unique<BankConflictMutation>()); 367 } 368 369 void HexagonSubtarget::getSMSMutations( 370 std::vector<std::unique_ptr<ScheduleDAGMutation>> &Mutations) const { 371 Mutations.push_back(llvm::make_unique<UsrOverflowMutation>()); 372 Mutations.push_back(llvm::make_unique<HVXMemLatencyMutation>()); 373 } 374 375 // Pin the vtable to this file. 376 void HexagonSubtarget::anchor() {} 377 378 bool HexagonSubtarget::enableMachineScheduler() const { 379 if (DisableHexagonMISched.getNumOccurrences()) 380 return !DisableHexagonMISched; 381 return true; 382 } 383 384 bool HexagonSubtarget::usePredicatedCalls() const { 385 return EnablePredicatedCalls; 386 } 387 388 void HexagonSubtarget::updateLatency(MachineInstr &SrcInst, 389 MachineInstr &DstInst, SDep &Dep) const { 390 if (Dep.isArtificial()) { 391 Dep.setLatency(1); 392 return; 393 } 394 395 if (!hasV60TOps()) 396 return; 397 398 auto &QII = static_cast<const HexagonInstrInfo&>(*getInstrInfo()); 399 400 // BSB scheduling. 401 if (QII.isHVXVec(SrcInst) || useBSBScheduling()) 402 Dep.setLatency((Dep.getLatency() + 1) >> 1); 403 } 404 405 void HexagonSubtarget::restoreLatency(SUnit *Src, SUnit *Dst) const { 406 MachineInstr *SrcI = Src->getInstr(); 407 for (auto &I : Src->Succs) { 408 if (!I.isAssignedRegDep() || I.getSUnit() != Dst) 409 continue; 410 unsigned DepR = I.getReg(); 411 int DefIdx = -1; 412 for (unsigned OpNum = 0; OpNum < SrcI->getNumOperands(); OpNum++) { 413 const MachineOperand &MO = SrcI->getOperand(OpNum); 414 if (MO.isReg() && MO.isDef() && MO.getReg() == DepR) 415 DefIdx = OpNum; 416 } 417 assert(DefIdx >= 0 && "Def Reg not found in Src MI"); 418 MachineInstr *DstI = Dst->getInstr(); 419 for (unsigned OpNum = 0; OpNum < DstI->getNumOperands(); OpNum++) { 420 const MachineOperand &MO = DstI->getOperand(OpNum); 421 if (MO.isReg() && MO.isUse() && MO.getReg() == DepR) { 422 int Latency = (InstrInfo.getOperandLatency(&InstrItins, *SrcI, 423 DefIdx, *DstI, OpNum)); 424 425 // For some instructions (ex: COPY), we might end up with < 0 latency 426 // as they don't have any Itinerary class associated with them. 427 if (Latency <= 0) 428 Latency = 1; 429 430 I.setLatency(Latency); 431 updateLatency(*SrcI, *DstI, I); 432 } 433 } 434 435 // Update the latency of opposite edge too. 436 for (auto &J : Dst->Preds) { 437 if (J.getSUnit() != Src) 438 continue; 439 J.setLatency(I.getLatency()); 440 } 441 } 442 } 443 444 /// Change the latency between the two SUnits. 445 void HexagonSubtarget::changeLatency(SUnit *Src, SUnit *Dst, unsigned Lat) 446 const { 447 for (auto &I : Src->Succs) { 448 if (I.getSUnit() != Dst) 449 continue; 450 SDep T = I; 451 I.setLatency(Lat); 452 453 // Update the latency of opposite edge too. 454 T.setSUnit(Src); 455 auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T); 456 assert(F != Dst->Preds.end()); 457 F->setLatency(I.getLatency()); 458 } 459 } 460 461 /// If the SUnit has a zero latency edge, return the other SUnit. 462 static SUnit *getZeroLatency(SUnit *N, SmallVector<SDep, 4> &Deps) { 463 for (auto &I : Deps) 464 if (I.isAssignedRegDep() && I.getLatency() == 0 && 465 !I.getSUnit()->getInstr()->isPseudo()) 466 return I.getSUnit(); 467 return nullptr; 468 } 469 470 // Return true if these are the best two instructions to schedule 471 // together with a zero latency. Only one dependence should have a zero 472 // latency. If there are multiple choices, choose the best, and change 473 // the others, if needed. 474 bool HexagonSubtarget::isBestZeroLatency(SUnit *Src, SUnit *Dst, 475 const HexagonInstrInfo *TII, SmallSet<SUnit*, 4> &ExclSrc, 476 SmallSet<SUnit*, 4> &ExclDst) const { 477 MachineInstr &SrcInst = *Src->getInstr(); 478 MachineInstr &DstInst = *Dst->getInstr(); 479 480 // Ignore Boundary SU nodes as these have null instructions. 481 if (Dst->isBoundaryNode()) 482 return false; 483 484 if (SrcInst.isPHI() || DstInst.isPHI()) 485 return false; 486 487 if (!TII->isToBeScheduledASAP(SrcInst, DstInst) && 488 !TII->canExecuteInBundle(SrcInst, DstInst)) 489 return false; 490 491 // The architecture doesn't allow three dependent instructions in the same 492 // packet. So, if the destination has a zero latency successor, then it's 493 // not a candidate for a zero latency predecessor. 494 if (getZeroLatency(Dst, Dst->Succs) != nullptr) 495 return false; 496 497 // Check if the Dst instruction is the best candidate first. 498 SUnit *Best = nullptr; 499 SUnit *DstBest = nullptr; 500 SUnit *SrcBest = getZeroLatency(Dst, Dst->Preds); 501 if (SrcBest == nullptr || Src->NodeNum >= SrcBest->NodeNum) { 502 // Check that Src doesn't have a better candidate. 503 DstBest = getZeroLatency(Src, Src->Succs); 504 if (DstBest == nullptr || Dst->NodeNum <= DstBest->NodeNum) 505 Best = Dst; 506 } 507 if (Best != Dst) 508 return false; 509 510 // The caller frequently adds the same dependence twice. If so, then 511 // return true for this case too. 512 if ((Src == SrcBest && Dst == DstBest ) || 513 (SrcBest == nullptr && Dst == DstBest) || 514 (Src == SrcBest && Dst == nullptr)) 515 return true; 516 517 // Reassign the latency for the previous bests, which requires setting 518 // the dependence edge in both directions. 519 if (SrcBest != nullptr) { 520 if (!hasV60TOps()) 521 changeLatency(SrcBest, Dst, 1); 522 else 523 restoreLatency(SrcBest, Dst); 524 } 525 if (DstBest != nullptr) { 526 if (!hasV60TOps()) 527 changeLatency(Src, DstBest, 1); 528 else 529 restoreLatency(Src, DstBest); 530 } 531 532 // Attempt to find another opprotunity for zero latency in a different 533 // dependence. 534 if (SrcBest && DstBest) 535 // If there is an edge from SrcBest to DstBst, then try to change that 536 // to 0 now. 537 changeLatency(SrcBest, DstBest, 0); 538 else if (DstBest) { 539 // Check if the previous best destination instruction has a new zero 540 // latency dependence opportunity. 541 ExclSrc.insert(Src); 542 for (auto &I : DstBest->Preds) 543 if (ExclSrc.count(I.getSUnit()) == 0 && 544 isBestZeroLatency(I.getSUnit(), DstBest, TII, ExclSrc, ExclDst)) 545 changeLatency(I.getSUnit(), DstBest, 0); 546 } else if (SrcBest) { 547 // Check if previous best source instruction has a new zero latency 548 // dependence opportunity. 549 ExclDst.insert(Dst); 550 for (auto &I : SrcBest->Succs) 551 if (ExclDst.count(I.getSUnit()) == 0 && 552 isBestZeroLatency(SrcBest, I.getSUnit(), TII, ExclSrc, ExclDst)) 553 changeLatency(SrcBest, I.getSUnit(), 0); 554 } 555 556 return true; 557 } 558 559 unsigned HexagonSubtarget::getL1CacheLineSize() const { 560 return 32; 561 } 562 563 unsigned HexagonSubtarget::getL1PrefetchDistance() const { 564 return 32; 565 } 566 567 bool HexagonSubtarget::enableSubRegLiveness() const { 568 return EnableSubregLiveness; 569 } 570