Lines Matching +full:tightly +full:- +full:coupled
1 //===- TargetPassConfig.cpp - Target independent code generation passes ---===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===---------------------------------------------------------------------===//
58 EnableIPRA("enable-ipra", cl::init(false), cl::Hidden,
61 static cl::opt<bool> DisablePostRASched("disable-post-ra", cl::Hidden,
63 static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden,
65 static cl::opt<bool> DisableTailDuplicate("disable-tail-duplicate", cl::Hidden,
67 static cl::opt<bool> DisableEarlyTailDup("disable-early-taildup", cl::Hidden,
68 cl::desc("Disable pre-register allocation tail duplication"));
69 static cl::opt<bool> DisableBlockPlacement("disable-block-placement",
70 cl::Hidden, cl::desc("Disable probability-driven block placement"));
71 static cl::opt<bool> EnableBlockPlacementStats("enable-block-placement-stats",
72 cl::Hidden, cl::desc("Collect probability-driven block placement stats"));
73 static cl::opt<bool> DisableSSC("disable-ssc", cl::Hidden,
75 static cl::opt<bool> DisableMachineDCE("disable-machine-dce", cl::Hidden,
77 static cl::opt<bool> DisableEarlyIfConversion("disable-early-ifcvt", cl::Hidden,
78 cl::desc("Disable Early If-conversion"));
79 static cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden,
81 static cl::opt<bool> DisableMachineCSE("disable-machine-cse", cl::Hidden,
84 "optimize-regalloc", cl::Hidden,
86 static cl::opt<bool> DisablePostRAMachineLICM("disable-postra-machine-licm",
89 static cl::opt<bool> DisableMachineSink("disable-machine-sink", cl::Hidden,
91 static cl::opt<bool> DisablePostRAMachineSink("disable-postra-machine-sink",
94 static cl::opt<bool> DisableLSR("disable-lsr", cl::Hidden,
96 static cl::opt<bool> DisableConstantHoisting("disable-constant-hoisting",
98 static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden,
100 static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden,
102 static cl::opt<bool> DisablePartialLibcallInlining("disable-partial-libcall-inlining",
105 "disable-atexit-based-global-dtor-lowering", cl::Hidden,
106 cl::desc("For MachO, disable atexit()-based global destructor lowering"));
108 "enable-implicit-null-checks",
111 static cl::opt<bool> DisableMergeICmps("disable-mergeicmps",
114 static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden,
115 cl::desc("Print LLVM IR produced by the loop-reduce pass"));
117 PrintISelInput("print-isel-input", cl::Hidden,
120 VerifyMachineCode("verify-machineinstrs", cl::Hidden,
123 DebugifyAndStripAll("debugify-and-strip-all-safe", cl::Hidden,
128 "debugify-check-and-strip-all-safe", cl::Hidden,
135 "enable-machine-outliner", cl::desc("Enable the machine outliner"),
146 static cl::opt<bool> DisableCFIFixup("disable-cfi-fixup", cl::Hidden,
149 // FastISel is enabled by default with -fast, and we wish to be
150 // able to enable or disable fast-isel independently from -O0.
152 EnableFastISelOption("fast-isel", cl::Hidden,
156 "global-isel", cl::Hidden,
162 PrintAfterISel("print-after-isel", cl::init(false), cl::Hidden,
166 "global-isel-abort", cl::Hidden,
178 "disable-ra-fsprofile-loader", cl::init(false), cl::Hidden,
183 "disable-layout-fsprofile-loader", cl::init(false), cl::Hidden,
187 FSProfileFile("fs-profile-file", cl::init(""), cl::value_desc("filename"),
191 "fs-remapping-file", cl::init(""), cl::value_desc("filename"),
194 // Temporary option to allow experimenting with MachineScheduler as a post-RA
200 "misched-postra", cl::Hidden,
205 static cl::opt<bool> EarlyLiveIntervals("early-live-intervals", cl::Hidden,
209 "disable-replace-with-vec-lib", cl::Hidden,
215 static const char StartAfterOptName[] = "start-after";
216 static const char StartBeforeOptName[] = "start-before";
217 static const char StopAfterOptName[] = "stop-after";
218 static const char StopBeforeOptName[] = "stop-before";
223 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
228 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
233 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
238 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
242 "enable-split-machine-functions", cl::Hidden,
248 "disable-expand-reductions", cl::init(false), cl::Hidden,
253 "disable-select-optimize", cl::init(true), cl::Hidden,
254 cl::desc("Disable the select-optimization pass from running"));
256 /// Enable garbage-collecting empty basic blocks.
258 GCEmptyBlocks("gc-empty-basic-blocks", cl::init(false), cl::Hidden,
259 cl::desc("Enable garbage-collecting empty basic blocks"));
263 /// i.e. -disable-mypass=false has no effect.
276 /// to addPass(). It may be a target-specific ID in the case that the target
336 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption(); in getFSProfileFile()
337 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse) in getFSProfileFile()
339 return PGOOpt->ProfileFile; in getFSProfileFile()
347 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption(); in getFSRemappingFile()
348 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse) in getFSRemappingFile()
350 return PGOOpt->ProfileRemappingFile; in getFSRemappingFile()
353 //===---------------------------------------------------------------------===//
355 //===---------------------------------------------------------------------===//
423 return PI ? PI->getTypeInfo() : nullptr; in getPassIDFromName()
604 return TM->getOptLevel(); in getOptLevel()
613 TargetPassID != InsertedPassID.getInstance()->getPassID())) && in insertPass()
615 Impl->InsertedPasses.emplace_back(TargetPassID, InsertedPassID); in insertPass()
618 /// createPassConfig - Create a pass configuration object to be used by
652 if (!PassNames[Idx]->empty()) { in getLimitedCodeGenPipelineReason()
669 Impl->TargetPasses[StandardID] = TargetID; in substitutePass()
674 I = Impl->TargetPasses.find(ID); in getPassSubstitution()
675 if (I == Impl->TargetPasses.end()) in getPassSubstitution()
677 return I->second; in getPassSubstitution()
699 AnalysisID PassID = P->getPassID(); in addPass()
707 // Construct banner message before PM->add() as that may delete the pass. in addPass()
709 std::string("After ") + std::string(P->getPassName()); in addPass()
711 PM->add(P); in addPass()
714 PM->add(P); in addPass()
718 for (const auto &IP : Impl->InsertedPasses) in addPass()
753 AnalysisID FinalID = P->getPassID(); in addPass()
766 PM->add(createMachineFunctionPrinterPass(dbgs(), Banner)); in addPrintPass()
773 Verify = TM->isMachineVerifierClean(); in addVerifyPass()
776 PM->add(createMachineVerifierPass(Banner)); in addVerifyPass()
780 PM->add(createDebugifyMachineModulePass()); in addDebugifyPass()
784 PM->add(createStripDebugMachineModulePass(/*OnlyDebugified=*/true)); in addStripDebugPass()
788 PM->add(createCheckDebugMachineModulePass()); in addCheckDebugPass()
813 // coming from the front-end and/or optimizer is valid. in addIRPasses()
821 // support "obvious" type-punning idioms. in addIRPasses()
837 // into optimally-sized loads and compares. The transforms are enabled by a in addIRPasses()
852 if (TM->getTargetTriple().isOSBinFormatMachO() && in addIRPasses()
879 // that stores/loads element one-by-one if the appropriate mask bit is set. in addIRPasses()
898 const MCAsmInfo *MCAI = TM->getMCAsmInfo(); in addPassesToHandleExceptions()
900 switch (MCAI->getExceptionHandlingType()) { in addPassesToHandleExceptions()
902 // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both in addPassesToHandleExceptions()
917 // We support using both GCC-style and MSVC-style exceptions on Windows, so in addPassesToHandleExceptions()
974 // Enable FastISel with -fast-isel, but allow that to be overridden. in addCoreISelPasses()
975 TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE); in addCoreISelPasses()
984 (TM->Options.EnableGlobalISel && in addCoreISelPasses()
987 else if (TM->getOptLevel() == CodeGenOptLevel::None && in addCoreISelPasses()
988 TM->getO0WantsFastISel()) in addCoreISelPasses()
993 // Set consistently TM->Options.EnableFastISel and EnableGlobalISel. in addCoreISelPasses()
995 TM->setFastISel(true); in addCoreISelPasses()
996 TM->setGlobalISel(false); in addCoreISelPasses()
998 TM->setFastISel(false); in addCoreISelPasses()
999 TM->setGlobalISel(true); in addCoreISelPasses()
1003 // analyses needing to be re-run. This can result in being unable to in addCoreISelPasses()
1009 // and -run-pass seem to be unaffected. The majority of GlobalISel in addCoreISelPasses()
1010 // testing uses -run-pass so this probably isn't too bad. in addCoreISelPasses()
1043 // not-yet-supported input. in addCoreISelPasses()
1050 // Expand pseudo-instructions emitted by ISel. Don't run the verifier before in addCoreISelPasses()
1061 if (TM->useEmulatedTLS()) in addISelPasses()
1064 PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); in addISelPasses()
1076 /// -regalloc=... command line option.
1083 /// Add the complete set of target-independent postISel code generator passes.
1091 /// target-specific fixups just before or after major stages. Additionally,
1100 /// before/after any target-independent pass. But it's currently overkill.
1113 if (TM->Options.EnableIPRA) in addMachinePasses()
1116 // Run pre-ra passes. in addMachinePasses()
1120 // non-determinism that affects CodeGen and there doesn't seem to be a point in addMachinePasses()
1136 // Run register allocation and passes that are tightly coupled with it, in addMachinePasses()
1143 // Run post-ra passes. in addMachinePasses()
1168 // Run pre-sched2 passes. in addMachinePasses()
1178 !TM->targetSchedulesPostRAScheduling()) { in addMachinePasses()
1200 if (TM->Options.EnableIPRA) in addMachinePasses()
1213 if (TM->Options.EnableMachineOutliner && in addMachinePasses()
1219 RunOnAllFunctions || TM->Options.SupportsDefaultOutlining; in addMachinePasses()
1232 TM->getBBSectionsType() != llvm::BasicBlockSection::None; in addMachinePasses()
1235 // splitter if -basic-block-sections is requested. in addMachinePasses()
1236 if (!NeedsBBSections && (TM->Options.EnableMachineFunctionSplitter || in addMachinePasses()
1256 if (NeedsBBSections || TM->Options.BBAddrMap) { in addMachinePasses()
1257 if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) { in addMachinePasses()
1259 TM->getBBSectionsFuncListBuf())); in addMachinePasses()
1267 if (!DisableCFIFixup && TM->Options.EnableCFIFixup) in addMachinePasses()
1270 PM->add(createStackFrameLayoutAnalysisPass()); in addMachinePasses()
1280 // Pre-ra tail duplication. in addMachineSSAOptimization()
1302 // like if-conversion. Such passes will typically need dominator trees and in addMachineSSAOptimization()
1312 // Clean-up the dead code that may have been generated by peephole in addMachineSSAOptimization()
1317 //===---------------------------------------------------------------------===//
1319 //===---------------------------------------------------------------------===//
1328 llvm_unreachable("Invalid optimize-regalloc state"); in getOptimizeRegAlloc()
1337 "pick register allocator based on -O option",
1351 /// allocation may still override this for per-target regalloc
1352 /// selection. But -regalloc=... always takes precedence.
1378 // With no -regalloc= override, ask the target for a regalloc pass. in createRegAllocPass()
1410 // Regalloc scoring for ML-driven eviction - noop except when learning a new in addRegAssignAndRewriteOptimized()
1417 /// has not be overriden on the command line with '-regalloc=...'
1422 /// Add the minimum set of target-independent passes that are required for
1431 /// Add standard target-independent passes that are tightly coupled with
1450 // after it with -stop-before/-stop-after. in addOptimizedRegAlloc()
1474 // Perform stack slot coloring and post-ra machine LICM. in addOptimizedRegAlloc()
1485 // Run post-ra machine LICM to hoist reloads / remats. in addOptimizedRegAlloc()
1492 //===---------------------------------------------------------------------===//
1494 //===---------------------------------------------------------------------===//
1508 if (!TM->requiresStructuredCFG()) in addMachineLateOptimization()
1539 //===---------------------------------------------------------------------===//
1541 //===---------------------------------------------------------------------===//
1543 return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable; in isGlobalISelAbortEnabled()
1547 return TM->Options.GlobalISelAbort == GlobalISelAbortMode::DisableWithDiag; in reportDiagnosticWhenGlobalISelFallback()