LLVM 22.0.0git
TargetPassConfig.cpp
Go to the documentation of this file.
1//===- TargetPassConfig.cpp - Target independent code generation passes ---===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines interfaces to access the target independent code
10// generation passes provided by the LLVM backend.
11//
12//===---------------------------------------------------------------------===//
13
15#include "llvm/ADT/DenseMap.h"
17#include "llvm/ADT/StringRef.h"
28#include "llvm/CodeGen/Passes.h"
33#include "llvm/IR/Verifier.h"
35#include "llvm/MC/MCAsmInfo.h"
37#include "llvm/Pass.h"
41#include "llvm/Support/Debug.h"
53#include <cassert>
54#include <optional>
55#include <string>
56
57using namespace llvm;
58
59static cl::opt<bool>
60 EnableIPRA("enable-ipra", cl::init(false), cl::Hidden,
61 cl::desc("Enable interprocedural register allocation "
62 "to reduce load/store at procedure calls."));
64 cl::desc("Disable Post Regalloc Scheduler"));
65static cl::opt<bool> DisableBranchFold("disable-branch-fold", cl::Hidden,
66 cl::desc("Disable branch folding"));
67static cl::opt<bool> DisableTailDuplicate("disable-tail-duplicate", cl::Hidden,
68 cl::desc("Disable tail duplication"));
69static cl::opt<bool> DisableEarlyTailDup("disable-early-taildup", cl::Hidden,
70 cl::desc("Disable pre-register allocation tail duplication"));
71static cl::opt<bool> DisableBlockPlacement("disable-block-placement",
72 cl::Hidden, cl::desc("Disable probability-driven block placement"));
73static cl::opt<bool> EnableBlockPlacementStats("enable-block-placement-stats",
74 cl::Hidden, cl::desc("Collect probability-driven block placement stats"));
75static cl::opt<bool> DisableSSC("disable-ssc", cl::Hidden,
76 cl::desc("Disable Stack Slot Coloring"));
77static cl::opt<bool> DisableMachineDCE("disable-machine-dce", cl::Hidden,
78 cl::desc("Disable Machine Dead Code Elimination"));
80 cl::desc("Disable Early If-conversion"));
81static cl::opt<bool> DisableMachineLICM("disable-machine-licm", cl::Hidden,
82 cl::desc("Disable Machine LICM"));
83static cl::opt<bool> DisableMachineCSE("disable-machine-cse", cl::Hidden,
84 cl::desc("Disable Machine Common Subexpression Elimination"));
86 "optimize-regalloc", cl::Hidden,
87 cl::desc("Enable optimized register allocation compilation path."));
88static cl::opt<bool> DisablePostRAMachineLICM("disable-postra-machine-licm",
90 cl::desc("Disable Machine LICM"));
91static cl::opt<bool> DisableMachineSink("disable-machine-sink", cl::Hidden,
92 cl::desc("Disable Machine Sinking"));
93static cl::opt<bool> DisablePostRAMachineSink("disable-postra-machine-sink",
95 cl::desc("Disable PostRA Machine Sinking"));
96static cl::opt<bool> DisableLSR("disable-lsr", cl::Hidden,
97 cl::desc("Disable Loop Strength Reduction Pass"));
98static cl::opt<bool> DisableConstantHoisting("disable-constant-hoisting",
99 cl::Hidden, cl::desc("Disable ConstantHoisting"));
100static cl::opt<bool> DisableCGP("disable-cgp", cl::Hidden,
101 cl::desc("Disable Codegen Prepare"));
102static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden,
103 cl::desc("Disable Copy Propagation pass"));
104static cl::opt<bool> DisablePartialLibcallInlining("disable-partial-libcall-inlining",
105 cl::Hidden, cl::desc("Disable Partial Libcall Inlining"));
107 "disable-atexit-based-global-dtor-lowering", cl::Hidden,
108 cl::desc("For MachO, disable atexit()-based global destructor lowering"));
110 "enable-implicit-null-checks",
111 cl::desc("Fold null checks into faulting memory operations"),
112 cl::init(false), cl::Hidden);
113static cl::opt<bool> DisableMergeICmps("disable-mergeicmps",
114 cl::desc("Disable MergeICmps Pass"),
115 cl::init(false), cl::Hidden);
116static cl::opt<bool>
117 PrintISelInput("print-isel-input", cl::Hidden,
118 cl::desc("Print LLVM IR input to isel pass"));
120 VerifyMachineCode("verify-machineinstrs", cl::Hidden,
121 cl::desc("Verify generated machine code"));
123 DebugifyAndStripAll("debugify-and-strip-all-safe", cl::Hidden,
124 cl::desc("Debugify MIR before and Strip debug after "
125 "each pass except those known to be unsafe "
126 "when debug info is present"));
128 "debugify-check-and-strip-all-safe", cl::Hidden,
129 cl::desc(
130 "Debugify MIR before, by checking and stripping the debug info after, "
131 "each pass except those known to be unsafe when debug info is "
132 "present"));
133// Enable or disable the MachineOutliner.
135 "enable-machine-outliner", cl::desc("Enable the machine outliner"),
139 "Run on all functions guaranteed to be beneficial"),
140 clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo",
141 "Outline cold code only. If a code block does not have "
142 "profile data, optimistically assume it is cold."),
143 clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo",
144 "Outline cold code only. If a code block does not have "
145 "profile, data, conservatively assume it is hot."),
146 clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"),
147 // Sentinel value for unspecified option.
150 "enable-global-merge-func", cl::Hidden,
151 cl::desc("Enable global merge functions that are based on hash function"));
152// Disable the pass to fix unwind information. Whether the pass is included in
153// the pipeline is controlled via the target options, this option serves as
154// manual override.
155static cl::opt<bool> DisableCFIFixup("disable-cfi-fixup", cl::Hidden,
156 cl::desc("Disable the CFI fixup pass"));
157// Enable or disable FastISel. Both options are needed, because
158// FastISel is enabled by default with -fast, and we wish to be
159// able to enable or disable fast-isel independently from -O0.
162 cl::desc("Enable the \"fast\" instruction selector"));
163
165 "global-isel", cl::Hidden,
166 cl::desc("Enable the \"global\" instruction selector"));
167
168// FIXME: remove this after switching to NPM or GlobalISel, whichever gets there
169// first...
170static cl::opt<bool>
171 PrintAfterISel("print-after-isel", cl::init(false), cl::Hidden,
172 cl::desc("Print machine instrs after ISel"));
173
175 "global-isel-abort", cl::Hidden,
176 cl::desc("Enable abort calls when \"global\" instruction selection "
177 "fails to lower/select an instruction"),
179 clEnumValN(GlobalISelAbortMode::Disable, "0", "Disable the abort"),
180 clEnumValN(GlobalISelAbortMode::Enable, "1", "Enable the abort"),
182 "Disable the abort but emit a diagnostic on failure")));
183
184// Disable MIRProfileLoader before RegAlloc. This is for for debugging and
185// tuning purpose.
187 "disable-ra-fsprofile-loader", cl::init(false), cl::Hidden,
188 cl::desc("Disable MIRProfileLoader before RegAlloc"));
189// Disable MIRProfileLoader before BloackPlacement. This is for for debugging
190// and tuning purpose.
192 "disable-layout-fsprofile-loader", cl::init(false), cl::Hidden,
193 cl::desc("Disable MIRProfileLoader before BlockPlacement"));
194// Specify FSProfile file name.
196 FSProfileFile("fs-profile-file", cl::init(""), cl::value_desc("filename"),
197 cl::desc("Flow Sensitive profile file name."), cl::Hidden);
198// Specify Remapping file for FSProfile.
200 "fs-remapping-file", cl::init(""), cl::value_desc("filename"),
201 cl::desc("Flow Sensitive profile remapping file name."), cl::Hidden);
202
203// Temporary option to allow experimenting with MachineScheduler as a post-RA
204// scheduler. Targets can "properly" enable this with
205// substitutePass(&PostRASchedulerID, &PostMachineSchedulerID).
206// Targets can return true in targetSchedulesPostRAScheduling() and
207// insert a PostRA scheduling pass wherever it wants.
209 "misched-postra", cl::Hidden,
210 cl::desc(
211 "Run MachineScheduler post regalloc (independent of preRA sched)"));
212
213// Experimental option to run live interval analysis early.
214static cl::opt<bool> EarlyLiveIntervals("early-live-intervals", cl::Hidden,
215 cl::desc("Run live interval analysis earlier in the pipeline"));
216
218 "disable-replace-with-vec-lib", cl::Hidden,
219 cl::desc("Disable replace with vector math call pass"));
220
221/// Option names for limiting the codegen pipeline.
222/// Those are used in error reporting and we didn't want
223/// to duplicate their names all over the place.
224static const char StartAfterOptName[] = "start-after";
225static const char StartBeforeOptName[] = "start-before";
226static const char StopAfterOptName[] = "stop-after";
227static const char StopBeforeOptName[] = "stop-before";
228
231 cl::desc("Resume compilation after a specific pass"),
232 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
233
236 cl::desc("Resume compilation before a specific pass"),
237 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
238
241 cl::desc("Stop compilation after a specific pass"),
242 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
243
246 cl::desc("Stop compilation before a specific pass"),
247 cl::value_desc("pass-name"), cl::init(""), cl::Hidden);
248
249/// Enable the machine function splitter pass.
251 "enable-split-machine-functions", cl::Hidden,
252 cl::desc("Split out cold blocks from machine functions based on profile "
253 "information."));
254
255/// Disable the expand reductions pass for testing.
257 "disable-expand-reductions", cl::init(false), cl::Hidden,
258 cl::desc("Disable the expand reduction intrinsics pass from running"));
259
260/// Disable the select optimization pass.
262 "disable-select-optimize", cl::init(true), cl::Hidden,
263 cl::desc("Disable the select-optimization pass from running"));
264
265/// Enable garbage-collecting empty basic blocks.
266static cl::opt<bool>
267 GCEmptyBlocks("gc-empty-basic-blocks", cl::init(false), cl::Hidden,
268 cl::desc("Enable garbage-collecting empty basic blocks"));
269
270static cl::opt<bool>
271 SplitStaticData("split-static-data", cl::Hidden, cl::init(false),
272 cl::desc("Split static data sections into hot and cold "
273 "sections using profile information"));
274
276 "emit-bb-hash",
277 cl::desc(
278 "Emit the hash of basic block in the SHT_LLVM_BB_ADDR_MAP section."),
279 cl::init(false), cl::Optional);
280
281/// Allow standard passes to be disabled by command line options. This supports
282/// simple binary flags that either suppress the pass or do nothing.
283/// i.e. -disable-mypass=false has no effect.
284/// These should be converted to boolOrDefault in order to use applyOverride.
286 bool Override) {
287 if (Override)
288 return IdentifyingPassPtr();
289 return PassID;
290}
291
292/// Allow standard passes to be disabled by the command line, regardless of who
293/// is adding the pass.
294///
295/// StandardID is the pass identified in the standard pass pipeline and provided
296/// to addPass(). It may be a target-specific ID in the case that the target
297/// directly adds its own pass, but in that case we harmlessly fall through.
298///
299/// TargetID is the pass that the target has configured to override StandardID.
300///
301/// StandardID may be a pseudo ID. In that case TargetID is the name of the real
302/// pass to run. This allows multiple options to control a single pass depending
303/// on where in the pipeline that pass is added.
305 IdentifyingPassPtr TargetID) {
306 if (StandardID == &PostRASchedulerID)
307 return applyDisable(TargetID, DisablePostRASched);
308
309 if (StandardID == &BranchFolderPassID)
310 return applyDisable(TargetID, DisableBranchFold);
311
312 if (StandardID == &TailDuplicateLegacyID)
313 return applyDisable(TargetID, DisableTailDuplicate);
314
315 if (StandardID == &EarlyTailDuplicateLegacyID)
316 return applyDisable(TargetID, DisableEarlyTailDup);
317
318 if (StandardID == &MachineBlockPlacementID)
319 return applyDisable(TargetID, DisableBlockPlacement);
320
321 if (StandardID == &StackSlotColoringID)
322 return applyDisable(TargetID, DisableSSC);
323
324 if (StandardID == &DeadMachineInstructionElimID)
325 return applyDisable(TargetID, DisableMachineDCE);
326
327 if (StandardID == &EarlyIfConverterLegacyID)
328 return applyDisable(TargetID, DisableEarlyIfConversion);
329
330 if (StandardID == &EarlyMachineLICMID)
331 return applyDisable(TargetID, DisableMachineLICM);
332
333 if (StandardID == &MachineCSELegacyID)
334 return applyDisable(TargetID, DisableMachineCSE);
335
336 if (StandardID == &MachineLICMID)
337 return applyDisable(TargetID, DisablePostRAMachineLICM);
338
339 if (StandardID == &MachineSinkingLegacyID)
340 return applyDisable(TargetID, DisableMachineSink);
341
342 if (StandardID == &PostRAMachineSinkingID)
343 return applyDisable(TargetID, DisablePostRAMachineSink);
344
345 if (StandardID == &MachineCopyPropagationID)
346 return applyDisable(TargetID, DisableCopyProp);
347
348 return TargetID;
349}
350
351// Find the FSProfile file name. The internal option takes the precedence
352// before getting from TargetMachine.
353static std::string getFSProfileFile(const TargetMachine *TM) {
354 if (!FSProfileFile.empty())
355 return FSProfileFile.getValue();
356 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
357 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
358 return std::string();
359 return PGOOpt->ProfileFile;
360}
361
362// Find the Profile remapping file name. The internal option takes the
363// precedence before getting from TargetMachine.
364static std::string getFSRemappingFile(const TargetMachine *TM) {
365 if (!FSRemappingFile.empty())
366 return FSRemappingFile.getValue();
367 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
368 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
369 return std::string();
370 return PGOOpt->ProfileRemappingFile;
371}
372
373//===---------------------------------------------------------------------===//
374/// TargetPassConfig
375//===---------------------------------------------------------------------===//
376
377INITIALIZE_PASS(TargetPassConfig, "targetpassconfig",
378 "Target Pass Configuration", false, false)
380
381namespace {
382
386
389
391 assert(InsertedPassID.isValid() && "Illegal Pass ID!");
392 if (InsertedPassID.isInstance())
393 return InsertedPassID.getInstance();
394 Pass *NP = Pass::createPass(InsertedPassID.getID());
395 assert(NP && "Pass ID not registered");
396 return NP;
397 }
398};
399
400} // end anonymous namespace
401
402namespace llvm {
403
405
407public:
408 // List of passes explicitly substituted by this target. Normally this is
409 // empty, but it is a convenient way to suppress or replace specific passes
410 // that are part of a standard pass pipeline without overridding the entire
411 // pipeline. This mechanism allows target options to inherit a standard pass's
412 // user interface. For example, a target may disable a standard pass by
413 // default by substituting a pass ID of zero, and the user may still enable
414 // that standard pass with an explicit command line option.
416
417 /// Store the pairs of <AnalysisID, AnalysisID> of which the second pass
418 /// is inserted after each instance of the first one.
420};
421
422} // end namespace llvm
423
424// Out of line virtual method.
428
430 if (PassName.empty())
431 return nullptr;
432
434 const PassInfo *PI = PR.getPassInfo(PassName);
435 if (!PI)
437 Twine("\" pass is not registered."));
438 return PI;
439}
440
442 const PassInfo *PI = getPassInfo(PassName);
443 return PI ? PI->getTypeInfo() : nullptr;
444}
445
446static std::pair<StringRef, unsigned>
448 StringRef Name, InstanceNumStr;
449 std::tie(Name, InstanceNumStr) = PassName.split(',');
450
451 unsigned InstanceNum = 0;
452 if (!InstanceNumStr.empty() && InstanceNumStr.getAsInteger(10, InstanceNum))
453 reportFatalUsageError("invalid pass instance specifier " + PassName);
454
455 return std::make_pair(Name, InstanceNum);
456}
457
458void TargetPassConfig::setStartStopPasses() {
459 StringRef StartBeforeName;
460 std::tie(StartBeforeName, StartBeforeInstanceNum) =
462
463 StringRef StartAfterName;
464 std::tie(StartAfterName, StartAfterInstanceNum) =
466
467 StringRef StopBeforeName;
468 std::tie(StopBeforeName, StopBeforeInstanceNum)
470
471 StringRef StopAfterName;
472 std::tie(StopAfterName, StopAfterInstanceNum)
474
475 StartBefore = getPassIDFromName(StartBeforeName);
476 StartAfter = getPassIDFromName(StartAfterName);
477 StopBefore = getPassIDFromName(StopBeforeName);
478 StopAfter = getPassIDFromName(StopAfterName);
479 if (StartBefore && StartAfter)
480 reportFatalUsageError(Twine(StartBeforeOptName) + Twine(" and ") +
481 Twine(StartAfterOptName) + Twine(" specified!"));
482 if (StopBefore && StopAfter)
483 reportFatalUsageError(Twine(StopBeforeOptName) + Twine(" and ") +
484 Twine(StopAfterOptName) + Twine(" specified!"));
485 Started = (StartAfter == nullptr) && (StartBefore == nullptr);
486}
487
530
558
561 auto [StartBefore, StartBeforeInstanceNum] =
563 auto [StartAfter, StartAfterInstanceNum] =
565 auto [StopBefore, StopBeforeInstanceNum] =
567 auto [StopAfter, StopAfterInstanceNum] =
569
570 if (!StartBefore.empty() && !StartAfter.empty())
572 Twine(StartBeforeOptName) + " and " + StartAfterOptName + " specified!",
573 std::make_error_code(std::errc::invalid_argument));
574 if (!StopBefore.empty() && !StopAfter.empty())
576 Twine(StopBeforeOptName) + " and " + StopAfterOptName + " specified!",
577 std::make_error_code(std::errc::invalid_argument));
578
579 StartStopInfo Result;
580 Result.StartPass = StartBefore.empty() ? StartAfter : StartBefore;
581 Result.StopPass = StopBefore.empty() ? StopAfter : StopBefore;
582 Result.StartInstanceNum =
583 StartBefore.empty() ? StartAfterInstanceNum : StartBeforeInstanceNum;
584 Result.StopInstanceNum =
585 StopBefore.empty() ? StopAfterInstanceNum : StopBeforeInstanceNum;
586 Result.StartAfter = !StartAfter.empty();
587 Result.StopAfter = !StopAfter.empty();
588 Result.StartInstanceNum += Result.StartInstanceNum == 0;
589 Result.StopInstanceNum += Result.StopInstanceNum == 0;
590 return Result;
591}
592
593// Out of line constructor provides default values for pass options and
594// registers all common codegen passes.
596 : ImmutablePass(ID), PM(&PM), TM(&TM) {
597 Impl = new PassConfigImpl();
598
600 // Register all target independent codegen passes to activate their PassIDs,
601 // including this pass itself.
603
604 // Also register alias analysis passes required by codegen passes.
607
608 if (EnableIPRA.getNumOccurrences()) {
609 TM.Options.EnableIPRA = EnableIPRA;
610 } else {
611 // If not explicitly specified, use target default.
612 TM.Options.EnableIPRA |= TM.useIPRA();
613 }
614
615 if (TM.Options.EnableIPRA)
617
618 if (EnableGlobalISelAbort.getNumOccurrences())
619 TM.Options.GlobalISelAbort = EnableGlobalISelAbort;
620
621 setStartStopPasses();
622}
623
625 return TM->getOptLevel();
626}
627
628/// Insert InsertedPassID pass after TargetPassID.
630 IdentifyingPassPtr InsertedPassID) {
631 assert(((!InsertedPassID.isInstance() &&
632 TargetPassID != InsertedPassID.getID()) ||
633 (InsertedPassID.isInstance() &&
634 TargetPassID != InsertedPassID.getInstance()->getPassID())) &&
635 "Insert a pass after itself!");
636 Impl->InsertedPasses.emplace_back(TargetPassID, InsertedPassID);
637}
638
639/// createPassConfig - Create a pass configuration object to be used by
640/// addPassToEmitX methods for generating a pipeline of CodeGen passes.
641///
642/// Targets may override this to extend TargetPassConfig.
647
649 : ImmutablePass(ID) {
650 reportFatalUsageError("trying to construct TargetPassConfig without a target "
651 "machine. Scheduling a CodeGen pass without a target "
652 "triple set?");
653}
654
658
663
666 return std::string();
667 std::string Res;
668 static cl::opt<std::string> *PassNames[] = {&StartAfterOpt, &StartBeforeOpt,
670 static const char *OptNames[] = {StartAfterOptName, StartBeforeOptName,
672 bool IsFirst = true;
673 for (int Idx = 0; Idx < 4; ++Idx)
674 if (!PassNames[Idx]->empty()) {
675 if (!IsFirst)
676 Res += " and ";
677 IsFirst = false;
678 Res += OptNames[Idx];
679 }
680 return Res;
681}
682
683// Helper to verify the analysis is really immutable.
684void TargetPassConfig::setOpt(bool &Opt, bool Val) {
685 assert(!Initialized && "PassConfig is immutable");
686 Opt = Val;
687}
688
690 IdentifyingPassPtr TargetID) {
691 Impl->TargetPasses[StandardID] = TargetID;
692}
693
696 I = Impl->TargetPasses.find(ID);
697 if (I == Impl->TargetPasses.end())
698 return ID;
699 return I->second;
700}
701
704 IdentifyingPassPtr FinalPtr = overridePass(ID, TargetID);
705 return !FinalPtr.isValid() || FinalPtr.isInstance() ||
706 FinalPtr.getID() != ID;
707}
708
709/// Add a pass to the PassManager if that pass is supposed to be run. If the
710/// Started/Stopped flags indicate either that the compilation should start at
711/// a later pass or that it should stop after an earlier pass, then do not add
712/// the pass. Finally, compare the current pass against the StartAfter
713/// and StopAfter options and change the Started/Stopped flags accordingly.
715 assert(!Initialized && "PassConfig is immutable");
716
717 // Cache the Pass ID here in case the pass manager finds this pass is
718 // redundant with ones already scheduled / available, and deletes it.
719 // Fundamentally, once we add the pass to the manager, we no longer own it
720 // and shouldn't reference it.
721 AnalysisID PassID = P->getPassID();
722
723 if (StartBefore == PassID && StartBeforeCount++ == StartBeforeInstanceNum)
724 Started = true;
725 if (StopBefore == PassID && StopBeforeCount++ == StopBeforeInstanceNum)
726 Stopped = true;
727 if (Started && !Stopped) {
728 if (AddingMachinePasses) {
729 // Construct banner message before PM->add() as that may delete the pass.
730 std::string Banner =
731 std::string("After ") + std::string(P->getPassName());
733 PM->add(P);
734 addMachinePostPasses(Banner);
735 } else {
736 PM->add(P);
737 }
738
739 // Add the passes after the pass P if there is any.
740 for (const auto &IP : Impl->InsertedPasses)
741 if (IP.TargetPassID == PassID)
742 addPass(IP.getInsertedPass());
743 } else {
744 delete P;
745 }
746
747 if (StopAfter == PassID && StopAfterCount++ == StopAfterInstanceNum)
748 Stopped = true;
749
750 if (StartAfter == PassID && StartAfterCount++ == StartAfterInstanceNum)
751 Started = true;
752 if (Stopped && !Started)
753 reportFatalUsageError("Cannot stop compilation after pass that is not run");
754}
755
756/// Add a CodeGen pass at this point in the pipeline after checking for target
757/// and command line overrides.
758///
759/// addPass cannot return a pointer to the pass instance because is internal the
760/// PassManager and the instance we create here may already be freed.
762 IdentifyingPassPtr TargetID = getPassSubstitution(PassID);
763 IdentifyingPassPtr FinalPtr = overridePass(PassID, TargetID);
764 if (!FinalPtr.isValid())
765 return nullptr;
766
767 Pass *P;
768 if (FinalPtr.isInstance())
769 P = FinalPtr.getInstance();
770 else {
771 P = Pass::createPass(FinalPtr.getID());
772 if (!P)
773 llvm_unreachable("Pass ID not registered");
774 }
775 AnalysisID FinalID = P->getPassID();
776 addPass(P); // Ends the lifetime of P.
777
778 return FinalID;
779}
780
781void TargetPassConfig::printAndVerify(const std::string &Banner) {
782 addPrintPass(Banner);
783 addVerifyPass(Banner);
784}
785
786void TargetPassConfig::addPrintPass(const std::string &Banner) {
787 if (PrintAfterISel)
788 PM->add(createMachineFunctionPrinterPass(dbgs(), Banner));
789}
790
791void TargetPassConfig::addVerifyPass(const std::string &Banner) {
793#ifdef EXPENSIVE_CHECKS
795 Verify = TM->isMachineVerifierClean();
796#endif
797 if (Verify)
798 PM->add(createMachineVerifierPass(Banner));
799}
800
804
806 PM->add(createStripDebugMachineModulePass(/*OnlyDebugified=*/true));
807}
808
812
814 if (AllowDebugify && DebugifyIsSafe &&
818}
819
820void TargetPassConfig::addMachinePostPasses(const std::string &Banner) {
821 if (DebugifyIsSafe) {
825 } else if (DebugifyAndStripAll == cl::BOU_TRUE)
827 }
828 addVerifyPass(Banner);
829}
830
831/// Add common target configurable passes that perform LLVM IR to IR transforms
832/// following machine independent optimization.
834 // Before running any passes, run the verifier to determine if the input
835 // coming from the front-end and/or optimizer is valid.
836 if (!DisableVerify)
838
840 // Basic AliasAnalysis support.
841 // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
842 // BasicAliasAnalysis wins if they disagree. This is intended to help
843 // support "obvious" type-punning idioms.
847
848 // Run loop strength reduction before anything else.
849 if (!DisableLSR) {
854 }
855
856 // The MergeICmpsPass tries to create memcmp calls by grouping sequences of
857 // loads and compares. ExpandMemCmpPass then tries to expand those calls
858 // into optimally-sized loads and compares. The transforms are enabled by a
859 // target lowering hook.
863 }
864
865 // Run GC lowering passes for builtin collectors
866 // TODO: add a pass insertion point here
869
870 // For MachO, lower @llvm.global_dtors into @llvm.global_ctors with
871 // __cxa_atexit() calls to avoid emitting the deprecated __mod_term_func.
872 if (TM->getTargetTriple().isOSBinFormatMachO() &&
875
876 // Make sure that no unreachable blocks are instruction selected.
878
879 // Prepare expensive constants for SelectionDAG.
882
885
888
889 // Instrument function entry after all inlining.
891
892 // Add scalarization of target's unsupported masked memory intrinsics pass.
893 // the unsupported intrinsic will be replaced with a chain of basic blocks,
894 // that stores/loads element one-by-one if the appropriate mask bit is set.
896
897 // Expand reduction intrinsics into shuffle sequences if the target wants to.
898 // Allow disabling it for testing purposes.
901
902 // Convert conditional moves to conditional jumps when profitable.
905
908
909 if (TM->getTargetTriple().isOSWindows())
911}
912
913/// Turn exception handling constructs into something the code generators can
914/// handle.
916 const MCAsmInfo *MCAI = TM->getMCAsmInfo();
917 assert(MCAI && "No MCAsmInfo");
918 switch (MCAI->getExceptionHandlingType()) {
920 // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
921 // Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
922 // catch info can get misplaced when a selector ends up more than one block
923 // removed from the parent invoke(s). This could happen when a landing
924 // pad is shared by multiple invokes and is also a target of a normal
925 // edge from elsewhere.
927 [[fallthrough]];
933 break;
935 // We support using both GCC-style and MSVC-style exceptions on Windows, so
936 // add both preparation passes. Each pass will only actually run if it
937 // recognizes the personality function.
940 break;
942 // Wasm EH uses Windows EH instructions, but it does not need to demote PHIs
943 // on catchpads and cleanuppads because it does not outline them into
944 // funclets. Catchswitch blocks are not lowered in SelectionDAG, so we
945 // should remove PHIs there.
946 addPass(createWinEHPass(/*DemoteCatchSwitchPHIOnly=*/true));
948 break;
951
952 // The lower invoke pass may create unreachable code. Remove it.
954 break;
955 }
956}
957
958/// Add pass to prepare the LLVM IR for code generation. This should be done
959/// before exception handling preparation passes.
964
965/// Add common passes that perform LLVM IR to IR transforms in preparation for
966/// instruction selection.
968 addPreISel();
969
970 // Force codegen to run according to the callgraph.
973
976
978
979 // Add both the safe stack and the stack protection passes: each of them will
980 // only protect functions that have corresponding attributes.
983
984 if (PrintISelInput)
986 dbgs(), "\n\n*** Final LLVM Code input to ISel ***\n"));
987
988 // All passes which modify the LLVM IR are now complete; run the verifier
989 // to ensure that the IR is valid.
990 if (!DisableVerify)
992}
993
995 // Enable FastISel with -fast-isel, but allow that to be overridden.
996 TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE);
997
998 // Determine an instruction selector.
999 enum class SelectorType { SelectionDAG, FastISel, GlobalISel };
1000 SelectorType Selector;
1001
1003 Selector = SelectorType::FastISel;
1005 (TM->Options.EnableGlobalISel &&
1007 Selector = SelectorType::GlobalISel;
1008 else if (TM->getOptLevel() == CodeGenOptLevel::None &&
1009 TM->getO0WantsFastISel())
1010 Selector = SelectorType::FastISel;
1011 else
1012 Selector = SelectorType::SelectionDAG;
1013
1014 // Set consistently TM->Options.EnableFastISel and EnableGlobalISel.
1015 if (Selector == SelectorType::FastISel) {
1016 TM->setFastISel(true);
1017 TM->setGlobalISel(false);
1018 } else if (Selector == SelectorType::GlobalISel) {
1019 TM->setFastISel(false);
1020 TM->setGlobalISel(true);
1021 }
1022
1023 // FIXME: Injecting into the DAGISel pipeline seems to cause issues with
1024 // analyses needing to be re-run. This can result in being unable to
1025 // schedule passes (particularly with 'Function Alias Analysis
1026 // Results'). It's not entirely clear why but AFAICT this seems to be
1027 // due to one FunctionPassManager not being able to use analyses from a
1028 // previous one. As we're injecting a ModulePass we break the usual
1029 // pass manager into two. GlobalISel with the fallback path disabled
1030 // and -run-pass seem to be unaffected. The majority of GlobalISel
1031 // testing uses -run-pass so this probably isn't too bad.
1032 SaveAndRestore SavedDebugifyIsSafe(DebugifyIsSafe);
1033 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
1034 DebugifyIsSafe = false;
1035
1036 // Add instruction selector passes for global isel if enabled.
1037 if (Selector == SelectorType::GlobalISel) {
1038 SaveAndRestore SavedAddingMachinePasses(AddingMachinePasses, true);
1039 if (addIRTranslator())
1040 return true;
1041
1043
1045 return true;
1046
1047 // Before running the register bank selector, ask the target if it
1048 // wants to run some passes.
1050
1051 if (addRegBankSelect())
1052 return true;
1053
1055
1057 return true;
1058 }
1059
1060 // Pass to reset the MachineFunction if the ISel failed. Outside of the above
1061 // if so that the verifier is not added to it.
1062 if (Selector == SelectorType::GlobalISel)
1065
1066 // Run the SDAG InstSelector, providing a fallback path when we do not want to
1067 // abort on not-yet-supported input.
1068 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
1069 if (addInstSelector())
1070 return true;
1071
1072 // Expand pseudo-instructions emitted by ISel. Don't run the verifier before
1073 // FinalizeISel.
1075
1076 // Print the instruction selected machine code...
1077 printAndVerify("After Instruction Selection");
1078
1079 return false;
1080}
1081
1097
1098/// -regalloc=... command line option.
1099static FunctionPass *useDefaultRegisterAllocator() { return nullptr; }
1103 cl::desc("Register allocator to use"));
1104
1105/// Add the complete set of target-independent postISel code generator passes.
1106///
1107/// This can be read as the standard order of major LLVM CodeGen stages. Stages
1108/// with nontrivial configuration or multiple passes are broken out below in
1109/// add%Stage routines.
1110///
1111/// Any TargetPassConfig::addXX routine may be overriden by the Target. The
1112/// addPre/Post methods with empty header implementations allow injecting
1113/// target-specific fixups just before or after major stages. Additionally,
1114/// targets have the flexibility to change pass order within a stage by
1115/// overriding default implementation of add%Stage routines below. Each
1116/// technique has maintainability tradeoffs because alternate pass orders are
1117/// not well supported. addPre/Post works better if the target pass is easily
1118/// tied to a common pass. But if it has subtle dependencies on multiple passes,
1119/// the target should override the stage instead.
1120///
1121/// TODO: We could use a single addPre/Post(ID) hook to allow pass injection
1122/// before/after any target-independent pass. But it's currently overkill.
1124 AddingMachinePasses = true;
1125
1126 // Add passes that optimize machine instructions in SSA form.
1129 } else {
1130 // If the target requests it, assign local variables to stack slots relative
1131 // to one another and simplify frame index references where possible.
1133 }
1134
1135 if (TM->Options.EnableIPRA)
1137
1138 // Run pre-ra passes.
1140
1141 // Debugifying the register allocator passes seems to provoke some
1142 // non-determinism that affects CodeGen and there doesn't seem to be a point
1143 // where it becomes safe again so stop debugifying here.
1144 DebugifyIsSafe = false;
1145
1146 // Add a FSDiscriminator pass right before RA, so that we could get
1147 // more precise SampleFDO profile for RA.
1151 const std::string ProfileFile = getFSProfileFile(TM);
1152 if (!ProfileFile.empty() && !DisableRAFSProfileLoader)
1155 nullptr));
1156 }
1157
1158 // Run register allocation and passes that are tightly coupled with it,
1159 // including phi elimination and scheduling.
1160 if (getOptimizeRegAlloc())
1162 else
1164
1165 // Run post-ra passes.
1167
1169
1171
1172 // Insert prolog/epilog code. Eliminate abstract frame index references...
1176 }
1177
1178 // Prolog/Epilog inserter needs a TargetMachine to instantiate. But only
1179 // do so if it hasn't been disabled, substituted, or overridden.
1182
1183 /// Add passes that optimize machine instructions after register allocation.
1186
1187 // Expand pseudo instructions before second scheduling pass.
1189
1190 // Run pre-sched2 passes.
1191 addPreSched2();
1192
1195
1196 // Second pass scheduler.
1197 // Let Target optionally insert this pass by itself at some other
1198 // point.
1200 !TM->targetSchedulesPostRAScheduling()) {
1201 if (MISchedPostRA)
1203 else
1205 }
1206
1207 // GC
1208 addGCPasses();
1209
1210 // Basic block placement.
1213
1214 // Insert before XRay Instrumentation.
1216
1219
1221
1222 if (TM->Options.EnableIPRA)
1223 // Collect register usage information and produce a register mask of
1224 // clobbered registers, to be used to optimize call sites.
1226
1227 // FIXME: Some backends are incompatible with running the verifier after
1228 // addPreEmitPass. Maybe only pass "false" here for those targets?
1230
1235
1236 if (TM->Options.EnableMachineOutliner &&
1240 TM->Options.SupportsDefaultOutlining)
1242 }
1243
1244 if (GCEmptyBlocks)
1246
1250
1251 if (TM->Options.EnableMachineFunctionSplitter ||
1253 TM->Options.EnableStaticDataPartitioning) {
1254 const std::string ProfileFile = getFSProfileFile(TM);
1255 if (!ProfileFile.empty()) {
1258 ProfileFile, getFSRemappingFile(TM),
1260 } else {
1261 // Sample profile is given, but FSDiscriminator is not
1262 // enabled, this may result in performance regression.
1264 << "Using AutoFDO without FSDiscriminator for MFS may regress "
1265 "performance.\n";
1266 }
1267 }
1268 }
1269
1270 // Machine function splitter uses the basic block sections feature.
1271 // When used along with `-basic-block-sections=`, the basic-block-sections
1272 // feature takes precedence. This means functions eligible for
1273 // basic-block-sections optimizations (`=all`, or `=list=` with function
1274 // included in the list profile) will get that optimization instead.
1275 if (TM->Options.EnableMachineFunctionSplitter ||
1278
1279 if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
1280 // The static data splitter pass is a machine function pass. and
1281 // static data annotator pass is a module-wide pass. See the file comment
1282 // in StaticDataAnnotator.cpp for the motivation.
1285 }
1286 // We run the BasicBlockSections pass if either we need BB sections or BB
1287 // address map (or both).
1288 if (TM->getBBSectionsType() != llvm::BasicBlockSection::None ||
1289 TM->Options.BBAddrMap) {
1290 if (EmitBBHash)
1292 if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) {
1294 TM->getBBSectionsFuncListBuf()));
1296 }
1298 }
1299
1301
1302 if (!DisableCFIFixup && TM->Options.EnableCFIFixup)
1304
1306
1307 // Add passes that directly emit MI after all other MI passes.
1309
1310 AddingMachinePasses = false;
1311}
1312
1313/// Add passes that optimize machine instructions in SSA form.
1315 // Pre-ra tail duplication.
1317
1318 // Optimize PHIs before DCE: removing dead PHI cycles may make more
1319 // instructions dead.
1321
1322 // This pass merges large allocas. StackSlotColoring is a different pass
1323 // which merges spill slots.
1325
1326 // If the target requests it, assign local variables to stack slots relative
1327 // to one another and simplify frame index references where possible.
1329
1330 // With optimization, dead code should already be eliminated. However
1331 // there is one known exception: lowered code for arguments that are only
1332 // used by tail calls, where the tail calls reuse the incoming stack
1333 // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll).
1335
1336 // Allow targets to insert passes that improve instruction level parallelism,
1337 // like if-conversion. Such passes will typically need dominator trees and
1338 // loop info, just like LICM and CSE below.
1339 addILPOpts();
1340
1343
1345
1347 // Clean-up the dead code that may have been generated by peephole
1348 // rewriting.
1350}
1351
1352//===---------------------------------------------------------------------===//
1353/// Register Allocation Pass Configuration
1354//===---------------------------------------------------------------------===//
1355
1357 switch (OptimizeRegAlloc) {
1358 case cl::BOU_UNSET:
1360 case cl::BOU_TRUE: return true;
1361 case cl::BOU_FALSE: return false;
1362 }
1363 llvm_unreachable("Invalid optimize-regalloc state");
1364}
1365
1366/// A dummy default pass factory indicates whether the register allocator is
1367/// overridden on the command line.
1369
1370static RegisterRegAlloc
1372 "pick register allocator based on -O option",
1374
1379
1380/// Instantiate the default register allocator pass for this target for either
1381/// the optimized or unoptimized allocation path. This will be added to the pass
1382/// manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc
1383/// in the optimized case.
1384///
1385/// A target that uses the standard regalloc pass order for fast or optimized
1386/// allocation may still override this for per-target regalloc
1387/// selection. But -regalloc=... always takes precedence.
1389 if (Optimized)
1391 else
1393}
1394
1395/// Find and instantiate the register allocation pass requested by this target
1396/// at the current optimization level. Different register allocators are
1397/// defined as separate passes because they may require different analysis.
1398///
1399/// This helper ensures that the regalloc= option is always available,
1400/// even for targets that override the default allocator.
1401///
1402/// FIXME: When MachinePassRegistry register pass IDs instead of function ptrs,
1403/// this can be folded into addPass.
1405 // Initialize the global default.
1408
1410 if (Ctor != useDefaultRegisterAllocator)
1411 return Ctor();
1412
1413 // With no -regalloc= override, ask the target for a regalloc pass.
1414 return createTargetRegisterAllocator(Optimized);
1415}
1416
1421
1426 "Must use fast (default) register allocator for unoptimized regalloc.");
1427
1429
1430 // Allow targets to change the register assignments after
1431 // fast register allocation.
1433 return true;
1434}
1435
1437 // Add the selected register allocation pass.
1439
1440 // Allow targets to change the register assignments before rewriting.
1441 addPreRewrite();
1442
1443 // Finally rewrite virtual registers.
1445
1446 // Regalloc scoring for ML-driven eviction - noop except when learning a new
1447 // eviction policy.
1449 return true;
1450}
1451
1452/// Return true if the default global register allocator is in use and
1453/// has not be overriden on the command line with '-regalloc=...'
1455 return RegAlloc.getNumOccurrences() == 0;
1456}
1457
1458/// Add the minimum set of target-independent passes that are required for
1459/// register allocation. No coalescing or scheduling.
1466
1467/// Add standard target-independent passes that are tightly coupled with
1468/// optimized register allocation, including coalescing, machine instruction
1469/// scheduling, and register allocation itself.
1472
1474
1476
1477 // LiveVariables currently requires pure SSA form.
1478 //
1479 // FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
1480 // LiveVariables can be removed completely, and LiveIntervals can be directly
1481 // computed. (We still either need to regenerate kill flags after regalloc, or
1482 // preferably fix the scavenger to not depend on them).
1483 // FIXME: UnreachableMachineBlockElim is a dependant pass of LiveVariables.
1484 // When LiveVariables is removed this has to be removed/moved either.
1485 // Explicit addition of UnreachableMachineBlockElim allows stopping before or
1486 // after it with -stop-before/-stop-after.
1489
1490 // Edge splitting is smarter with machine loop info.
1493
1494 // Eventually, we want to run LiveIntervals before PHI elimination.
1497
1500
1501 // The machine scheduler may accidentally create disconnected components
1502 // when moving subregister definitions around, avoid this by splitting them to
1503 // separate vregs before. Splitting can also improve reg. allocation quality.
1505
1506 // PreRA instruction scheduling.
1508
1510 // Perform stack slot coloring and post-ra machine LICM.
1512
1513 // Allow targets to expand pseudo instructions depending on the choice of
1514 // registers before MachineCopyPropagation.
1516
1517 // Copy propagate to forward register uses and try to eliminate COPYs that
1518 // were not coalesced.
1520
1521 // Run post-ra machine LICM to hoist reloads / remats.
1522 //
1523 // FIXME: can this move into MachineLateOptimization?
1525 }
1526}
1527
1528//===---------------------------------------------------------------------===//
1529/// Post RegAlloc Pass Configuration
1530//===---------------------------------------------------------------------===//
1531
1532/// Add passes that optimize machine instructions after register allocation.
1534 // Cleanup of redundant immediate/address loads.
1536
1537 // Branch folding must be run after regalloc and prolog/epilog insertion.
1539
1540 // Tail duplication.
1541 // Note that duplicating tail just increases code size and degrades
1542 // performance for targets that require Structured Control Flow.
1543 // In addition it can also make CFG irreducible. Thus we disable it.
1544 if (!TM->requiresStructuredCFG())
1546
1547 // Copy propagation.
1549}
1550
1551/// Add standard GC passes.
1554 return true;
1555}
1556
1557/// Add standard basic block placement passes.
1562 const std::string ProfileFile = getFSProfileFile(TM);
1563 if (!ProfileFile.empty() && !DisableLayoutFSProfileLoader)
1566 nullptr));
1567 }
1569 // Run a separate pass to collect block placement statistics.
1572 }
1573}
1574
1575//===---------------------------------------------------------------------===//
1576/// GlobalISel Configuration
1577//===---------------------------------------------------------------------===//
1579 return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable;
1580}
1581
1585
1587 return true;
1588}
1589
1590std::unique_ptr<CSEConfigBase> TargetPassConfig::getCSEConfig() const {
1591 return std::make_unique<CSEConfigBase>();
1592}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
cl::opt< bool > EmitBBHash
This is the interface for LLVM's primary stateless and local alias analysis.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
This file defines the DenseMap class.
This file contains an interface for creating legacy passes to print out IR in various granularities.
#define I(x, y, z)
Definition MD5.cpp:58
#define P(N)
ppc ctr loops PowerPC CTR Loops Verify
PassInstrumentationCallbacks PIC
This file defines the Pass Instrumentation classes that provide instrumentation points into the pass ...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition PassSupport.h:56
This file provides utility classes that use RAII to save and restore values.
This is the interface for a metadata-based scoped no-alias analysis.
This file defines the SmallVector class.
static const char StopAfterOptName[]
static cl::opt< bool > DisableExpandReductions("disable-expand-reductions", cl::init(false), cl::Hidden, cl::desc("Disable the expand reduction intrinsics pass from running"))
Disable the expand reductions pass for testing.
static cl::opt< bool > EnableImplicitNullChecks("enable-implicit-null-checks", cl::desc("Fold null checks into faulting memory operations"), cl::init(false), cl::Hidden)
static cl::opt< bool > DisableMachineSink("disable-machine-sink", cl::Hidden, cl::desc("Disable Machine Sinking"))
static cl::opt< cl::boolOrDefault > DebugifyAndStripAll("debugify-and-strip-all-safe", cl::Hidden, cl::desc("Debugify MIR before and Strip debug after " "each pass except those known to be unsafe " "when debug info is present"))
static llvm::once_flag InitializeDefaultRegisterAllocatorFlag
A dummy default pass factory indicates whether the register allocator is overridden on the command li...
static cl::opt< bool > DisableAtExitBasedGlobalDtorLowering("disable-atexit-based-global-dtor-lowering", cl::Hidden, cl::desc("For MachO, disable atexit()-based global destructor lowering"))
static cl::opt< RegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< RegisterRegAlloc > > RegAlloc("regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use"))
static cl::opt< bool > PrintISelInput("print-isel-input", cl::Hidden, cl::desc("Print LLVM IR input to isel pass"))
static FunctionPass * useDefaultRegisterAllocator()
-regalloc=... command line option.
static cl::opt< bool > DisablePostRASched("disable-post-ra", cl::Hidden, cl::desc("Disable Post Regalloc Scheduler"))
static cl::opt< bool > EnableBlockPlacementStats("enable-block-placement-stats", cl::Hidden, cl::desc("Collect probability-driven block placement stats"))
static cl::opt< RunOutliner > EnableMachineOutliner("enable-machine-outliner", cl::desc("Enable the machine outliner"), cl::Hidden, cl::ValueOptional, cl::init(RunOutliner::TargetDefault), cl::values(clEnumValN(RunOutliner::AlwaysOutline, "always", "Run on all functions guaranteed to be beneficial"), clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo", "Outline cold code only. If a code block does not have " "profile data, optimistically assume it is cold."), clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo", "Outline cold code only. If a code block does not have " "profile, data, conservatively assume it is hot."), clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"), clEnumValN(RunOutliner::AlwaysOutline, "", "")))
static cl::opt< bool > DisableMachineDCE("disable-machine-dce", cl::Hidden, cl::desc("Disable Machine Dead Code Elimination"))
static std::string getFSRemappingFile(const TargetMachine *TM)
static const char StopBeforeOptName[]
static AnalysisID getPassIDFromName(StringRef PassName)
static cl::opt< bool > DisableEarlyIfConversion("disable-early-ifcvt", cl::Hidden, cl::desc("Disable Early If-conversion"))
static cl::opt< bool > DisableReplaceWithVecLib("disable-replace-with-vec-lib", cl::Hidden, cl::desc("Disable replace with vector math call pass"))
static cl::opt< bool > EnableMachineFunctionSplitter("enable-split-machine-functions", cl::Hidden, cl::desc("Split out cold blocks from machine functions based on profile " "information."))
Enable the machine function splitter pass.
static IdentifyingPassPtr overridePass(AnalysisID StandardID, IdentifyingPassPtr TargetID)
Allow standard passes to be disabled by the command line, regardless of who is adding the pass.
cl::opt< bool > EmitBBHash("emit-bb-hash", cl::desc("Emit the hash of basic block in the SHT_LLVM_BB_ADDR_MAP section."), cl::init(false), cl::Optional)
static std::pair< StringRef, unsigned > getPassNameAndInstanceNum(StringRef PassName)
static cl::opt< bool > PrintAfterISel("print-after-isel", cl::init(false), cl::Hidden, cl::desc("Print machine instrs after ISel"))
static cl::opt< cl::boolOrDefault > VerifyMachineCode("verify-machineinstrs", cl::Hidden, cl::desc("Verify generated machine code"))
static cl::opt< bool > DisablePartialLibcallInlining("disable-partial-libcall-inlining", cl::Hidden, cl::desc("Disable Partial Libcall Inlining"))
#define SET_BOOLEAN_OPTION(Option)
static cl::opt< std::string > StartAfterOpt(StringRef(StartAfterOptName), cl::desc("Resume compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""), cl::Hidden)
static cl::opt< bool > DisableBlockPlacement("disable-block-placement", cl::Hidden, cl::desc("Disable probability-driven block placement"))
static cl::opt< bool > DisableRAFSProfileLoader("disable-ra-fsprofile-loader", cl::init(false), cl::Hidden, cl::desc("Disable MIRProfileLoader before RegAlloc"))
static cl::opt< std::string > StopAfterOpt(StringRef(StopAfterOptName), cl::desc("Stop compilation after a specific pass"), cl::value_desc("pass-name"), cl::init(""), cl::Hidden)
static void initializeDefaultRegisterAllocatorOnce()
static cl::opt< bool > DisableSelectOptimize("disable-select-optimize", cl::init(true), cl::Hidden, cl::desc("Disable the select-optimization pass from running"))
Disable the select optimization pass.
static cl::opt< std::string > FSRemappingFile("fs-remapping-file", cl::init(""), cl::value_desc("filename"), cl::desc("Flow Sensitive profile remapping file name."), cl::Hidden)
static cl::opt< bool > DisableCFIFixup("disable-cfi-fixup", cl::Hidden, cl::desc("Disable the CFI fixup pass"))
static cl::opt< bool > SplitStaticData("split-static-data", cl::Hidden, cl::init(false), cl::desc("Split static data sections into hot and cold " "sections using profile information"))
static cl::opt< bool > DisablePostRAMachineLICM("disable-postra-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
static const char StartBeforeOptName[]
static const PassInfo * getPassInfo(StringRef PassName)
static cl::opt< bool > EarlyLiveIntervals("early-live-intervals", cl::Hidden, cl::desc("Run live interval analysis earlier in the pipeline"))
static cl::opt< bool > DisableMachineLICM("disable-machine-licm", cl::Hidden, cl::desc("Disable Machine LICM"))
static cl::opt< cl::boolOrDefault > EnableGlobalISelOption("global-isel", cl::Hidden, cl::desc("Enable the \"global\" instruction selector"))
static cl::opt< bool > DisableTailDuplicate("disable-tail-duplicate", cl::Hidden, cl::desc("Disable tail duplication"))
static cl::opt< bool > DisablePostRAMachineSink("disable-postra-machine-sink", cl::Hidden, cl::desc("Disable PostRA Machine Sinking"))
static const char StartAfterOptName[]
Option names for limiting the codegen pipeline.
static cl::opt< bool > EnableIPRA("enable-ipra", cl::init(false), cl::Hidden, cl::desc("Enable interprocedural register allocation " "to reduce load/store at procedure calls."))
static cl::opt< bool > DisableCGP("disable-cgp", cl::Hidden, cl::desc("Disable Codegen Prepare"))
static std::string getFSProfileFile(const TargetMachine *TM)
static cl::opt< std::string > StartBeforeOpt(StringRef(StartBeforeOptName), cl::desc("Resume compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""), cl::Hidden)
static IdentifyingPassPtr applyDisable(IdentifyingPassPtr PassID, bool Override)
Allow standard passes to be disabled by command line options.
static cl::opt< bool > GCEmptyBlocks("gc-empty-basic-blocks", cl::init(false), cl::Hidden, cl::desc("Enable garbage-collecting empty basic blocks"))
Enable garbage-collecting empty basic blocks.
static cl::opt< GlobalISelAbortMode > EnableGlobalISelAbort("global-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"global\" instruction selection " "fails to lower/select an instruction"), cl::values(clEnumValN(GlobalISelAbortMode::Disable, "0", "Disable the abort"), clEnumValN(GlobalISelAbortMode::Enable, "1", "Enable the abort"), clEnumValN(GlobalISelAbortMode::DisableWithDiag, "2", "Disable the abort but emit a diagnostic on failure")))
static cl::opt< bool > DisableEarlyTailDup("disable-early-taildup", cl::Hidden, cl::desc("Disable pre-register allocation tail duplication"))
static cl::opt< bool > DisableConstantHoisting("disable-constant-hoisting", cl::Hidden, cl::desc("Disable ConstantHoisting"))
static cl::opt< cl::boolOrDefault > EnableFastISelOption("fast-isel", cl::Hidden, cl::desc("Enable the \"fast\" instruction selector"))
static cl::opt< bool > DisableSSC("disable-ssc", cl::Hidden, cl::desc("Disable Stack Slot Coloring"))
static cl::opt< bool > EnableGlobalMergeFunc("enable-global-merge-func", cl::Hidden, cl::desc("Enable global merge functions that are based on hash function"))
static cl::opt< bool > DisableBranchFold("disable-branch-fold", cl::Hidden, cl::desc("Disable branch folding"))
#define DISABLE_PASS(Option, Name)
static RegisterRegAlloc defaultRegAlloc("default", "pick register allocator based on -O option", useDefaultRegisterAllocator)
static cl::opt< std::string > StopBeforeOpt(StringRef(StopBeforeOptName), cl::desc("Stop compilation before a specific pass"), cl::value_desc("pass-name"), cl::init(""), cl::Hidden)
static cl::opt< bool > DisableMachineCSE("disable-machine-cse", cl::Hidden, cl::desc("Disable Machine Common Subexpression Elimination"))
static cl::opt< bool > DisableLayoutFSProfileLoader("disable-layout-fsprofile-loader", cl::init(false), cl::Hidden, cl::desc("Disable MIRProfileLoader before BlockPlacement"))
static cl::opt< bool > MISchedPostRA("misched-postra", cl::Hidden, cl::desc("Run MachineScheduler post regalloc (independent of preRA sched)"))
static cl::opt< bool > DisableMergeICmps("disable-mergeicmps", cl::desc("Disable MergeICmps Pass"), cl::init(false), cl::Hidden)
static cl::opt< bool > DisableCopyProp("disable-copyprop", cl::Hidden, cl::desc("Disable Copy Propagation pass"))
static cl::opt< cl::boolOrDefault > OptimizeRegAlloc("optimize-regalloc", cl::Hidden, cl::desc("Enable optimized register allocation compilation path."))
static cl::opt< bool > DisableLSR("disable-lsr", cl::Hidden, cl::desc("Disable Loop Strength Reduction Pass"))
static cl::opt< std::string > FSProfileFile("fs-profile-file", cl::init(""), cl::value_desc("filename"), cl::desc("Flow Sensitive profile file name."), cl::Hidden)
static cl::opt< cl::boolOrDefault > DebugifyCheckAndStripAll("debugify-check-and-strip-all-safe", cl::Hidden, cl::desc("Debugify MIR before, by checking and stripping the debug info after, " "each pass except those known to be unsafe when debug info is " "present"))
#define SET_OPTION(Option)
Target-Independent Code Generator Pass Configuration Options pass.
This pass exposes codegen information to IR-level passes.
This is the interface for a metadata-based TBAA.
Defines the virtual file system interface vfs::FileSystem.
static const char PassName[]
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator
Definition DenseMap.h:75
This pass is required by interprocedural register allocation.
Tagged union holding either a T or a Error.
Definition Error.h:485
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Definition FastISel.h:66
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:314
Discriminated union of Pass ID types.
AnalysisID getID() const
ImmutablePass(char &pid)
Definition Pass.h:287
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:64
ExceptionHandling getExceptionHandlingType() const
Definition MCAsmInfo.h:633
DenseMap< AnalysisID, IdentifyingPassPtr > TargetPasses
SmallVector< InsertedPass, 4 > InsertedPasses
Store the pairs of <AnalysisID, AnalysisID> of which the second pass is inserted after each instance ...
PassInfo class - An instance of this class exists for every pass known by the system,...
Definition PassInfo.h:30
const void * getTypeInfo() const
getTypeInfo - Return the id object for the pass... TODO : Rename
Definition PassInfo.h:63
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_ABI const PassInfo * getPassInfo(const void *TI) const
getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' type identifier (&MyPass::...
Pass interface - Implemented by all 'passes'.
Definition Pass.h:99
static Pass * createPass(AnalysisID ID)
Definition Pass.cpp:214
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
Definition Pass.h:122
RegisterPassParser class - Handle the addition of new machine passes.
static void setDefault(FunctionPassCtor C)
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition StringRef.h:472
constexpr bool empty() const
empty - Check if the string is empty.
Definition StringRef.h:143
Primary interface to the complete machine description for the target machine.
Target-Independent Code Generator Pass Configuration Options.
bool usingDefaultRegAlloc() const
Return true if the default global register allocator is in use and has not be overriden on the comman...
bool requiresCodeGenSCCOrder() const
void addCheckDebugPass()
Add a pass to check synthesized debug info for MIR.
virtual void addPreLegalizeMachineIR()
This method may be implemented by targets that want to run passes immediately before legalization.
void addPrintPass(const std::string &Banner)
Add a pass to print the machine function if printing is enabled.
virtual void addPreEmitPass2()
Targets may add passes immediately before machine code is emitted in this callback.
virtual std::unique_ptr< CSEConfigBase > getCSEConfig() const
Returns the CSEConfig object to use for the current optimization level.
bool EnableLoopTermFold
Enable LoopTermFold immediately after LSR.
void printAndVerify(const std::string &Banner)
printAndVerify - Add a pass to dump then verify the machine function, if those steps are enabled.
static bool hasLimitedCodeGenPipeline()
Returns true if one of the -start-after, -start-before, -stop-after or -stop-before options is set.
static Expected< StartStopInfo > getStartStopInfo(PassInstrumentationCallbacks &PIC)
Returns pass name in -stop-before or -stop-after NOTE: New pass manager migration only.
virtual void addCodeGenPrepare()
Add pass to prepare the LLVM IR for code generation.
void insertPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID)
Insert InsertedPassID pass after TargetPassID pass.
void addMachinePostPasses(const std::string &Banner)
Add standard passes after a pass that has just been added.
virtual void addPreSched2()
This method may be implemented by targets that want to run passes after prolog-epilog insertion and b...
virtual bool isGISelCSEEnabled() const
Check whether continuous CSE should be enabled in GISel passes.
virtual bool addILPOpts()
Add passes that optimize instruction level parallelism for out-of-order targets.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
void addDebugifyPass()
Add a pass to add synthesized debug info to the MIR.
virtual bool addInstSelector()
addInstSelector - This method should install an instruction selector pass, which converts from LLVM c...
CodeGenOptLevel getOptLevel() const
virtual bool addPreISel()
Methods with trivial inline returns are convenient points in the common codegen pass pipeline where t...
void setOpt(bool &Opt, bool Val)
virtual void addBlockPlacement()
Add standard basic block placement passes.
virtual FunctionPass * createRegAllocPass(bool Optimized)
addMachinePasses helper to create the target-selected or overriden regalloc pass.
virtual void addPostBBSections()
This pass may be implemented by targets that want to run passes immediately after basic block section...
virtual void addOptimizedRegAlloc()
addOptimizedRegAlloc - Add passes related to register allocation.
virtual bool addRegAssignAndRewriteFast()
Add core register allocator passes which do the actual register assignment and rewriting.
virtual void addPreEmitPass()
This pass may be implemented by targets that want to run passes immediately before machine code is em...
bool isGlobalISelAbortEnabled() const
Check whether or not GlobalISel should abort on error.
bool getOptimizeRegAlloc() const
Return true if the optimized regalloc pipeline is enabled.
bool isCustomizedRegAlloc()
Return true if register allocator is specified by -regalloc=override.
virtual void addPreRegBankSelect()
This method may be implemented by targets that want to run passes immediately before the register ban...
virtual bool reportDiagnosticWhenGlobalISelFallback() const
Check whether or not a diagnostic should be emitted when GlobalISel uses the fallback path.
virtual bool addPreRewrite()
addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is...
virtual bool addRegBankSelect()
This method should install a register bank selector pass, which assigns register banks to virtual reg...
void setRequiresCodeGenSCCOrder(bool Enable=true)
virtual void addMachineLateOptimization()
Add passes that optimize machine instructions after register allocation.
virtual void addMachinePasses()
Add the complete, standard set of LLVM CodeGen passes.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
virtual void addPreGlobalInstructionSelect()
This method may be implemented by targets that want to run passes immediately before the (global) ins...
virtual void addFastRegAlloc()
addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast registe...
virtual bool addLegalizeMachineIR()
This method should install a legalize pass, which converts the instruction sequence into one that can...
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.
void substitutePass(AnalysisID StandardID, IdentifyingPassPtr TargetID)
Allow the target to override a specific pass without overriding the pass pipeline.
virtual bool addRegAssignAndRewriteOptimized()
virtual bool addGlobalInstructionSelect()
This method should install a (global) instruction selector pass, which converts possibly generic inst...
virtual void addPreRegAlloc()
This method may be implemented by targets that want to run passes immediately before register allocat...
static std::string getLimitedCodeGenPipelineReason()
If hasLimitedCodeGenPipeline is true, this method returns a string with the name of the options that ...
AnalysisID addPass(AnalysisID PassID)
Utilities for targets to add passes to the pass manager.
void addPassesToHandleExceptions()
Add passes to lower exception handling for the code generator.
void addStripDebugPass()
Add a pass to remove debug info from the MIR.
bool isPassSubstitutedOrOverridden(AnalysisID ID) const
Return true if the pass has been substituted by the target or overridden on the command line.
bool addCoreISelPasses()
Add the actual instruction selection passes.
virtual void addISelPrepare()
Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
static bool willCompleteCodeGenPipeline()
Returns true if none of the -stop-before and -stop-after options is set.
void addMachinePrePasses(bool AllowDebugify=true)
Add standard passes before a pass that's about to be added.
virtual bool addGCPasses()
addGCPasses - Add late codegen passes that analyze code for garbage collection.
virtual bool addIRTranslator()
This method should install an IR translator pass, which converts from LLVM code to machine instructio...
void addVerifyPass(const std::string &Banner)
Add a pass to perform basic verification of the machine function if verification is enabled.
virtual FunctionPass * createTargetRegisterAllocator(bool Optimized)
createTargetRegisterAllocator - Create the register allocator pass for this target at the current opt...
virtual bool addPostFastRegAllocRewrite()
addPostFastRegAllocRewrite - Add passes to the optimized register allocation pipeline after fast regi...
IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const
Return the pass substituted for StandardID by the target.
bool addISelPasses()
High level function that adds all passes necessary to go from llvm IR representation to the MI repres...
virtual void addPostRewrite()
Add passes to be run immediately after virtual registers are rewritten to physical registers.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
static LLVM_ABI raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
Definition WithColor.cpp:85
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI ModulePass * createLowerGlobalDtorsLegacyPass()
LLVM_ABI FunctionPass * createCFIFixup()
Creates CFI Fixup pass.
LLVM_ABI FunctionPass * createFastRegisterAllocator()
FastRegisterAllocation Pass - This pass register allocates as fast as possible.
LLVM_ABI char & EarlyMachineLICMID
This pass performs loop invariant code motion on machine instructions.
LLVM_ABI char & GCMachineCodeAnalysisID
GCMachineCodeAnalysis - Target-independent pass to mark safe points in machine code.
LLVM_ABI char & FEntryInserterID
This pass inserts FEntry calls.
LLVM_ABI char & GCLoweringID
GCLowering Pass - Used by gc.root to perform its default lowering operations.
LLVM_ABI void initializeBasicAAWrapperPassPass(PassRegistry &)
LLVM_ABI void registerCodeGenCallback(PassInstrumentationCallbacks &PIC, TargetMachine &)
LLVM_ABI char & InitUndefID
LLVM_ABI char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
LLVM_ABI FunctionPass * createGreedyRegisterAllocator()
Greedy register allocation pass - This pass implements a global register allocator for optimized buil...
LLVM_ABI FunctionPass * createConstantHoistingPass()
LLVM_ABI FunctionPass * createSafeStackPass()
This pass splits the stack into a safe stack and an unsafe stack to protect against stack-based overf...
@ SjLj
setjmp/longjmp based exceptions
Definition CodeGen.h:56
@ ZOS
z/OS MVS Exception Handling.
Definition CodeGen.h:61
@ None
No exception support.
Definition CodeGen.h:54
@ AIX
AIX Exception Handling.
Definition CodeGen.h:60
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:55
@ WinEH
Windows Exception Handling.
Definition CodeGen.h:58
@ Wasm
WebAssembly Exception Handling.
Definition CodeGen.h:59
LLVM_ABI FunctionPass * createSelectOptimizePass()
This pass converts conditional moves to conditional jumps when profitable.
LLVM_ABI FunctionPass * createWasmEHPass()
createWasmEHPass - This pass adapts exception handling code to use WebAssembly's exception handling s...
LLVM_ABI char & FixupStatepointCallerSavedID
The pass fixups statepoint machine instruction to replace usage of caller saved registers with stack ...
LLVM_ABI MachineFunctionPass * createBasicBlockSectionsPass()
createBasicBlockSections Pass - This pass assigns sections to machine basic blocks and is enabled wit...
LLVM_ABI FunctionPass * createPostInlineEntryExitInstrumenterPass()
LLVM_ABI MachineFunctionPass * createPrologEpilogInserterPass()
LLVM_ABI FunctionPass * createCallBrPass()
LLVM_ABI ModulePass * createStripDebugMachineModulePass(bool OnlyDebugified)
Creates MIR Strip Debug pass.
LLVM_ABI char & TailDuplicateLegacyID
TailDuplicate - Duplicate blocks with unconditional branches into tails of their predecessors.
LLVM_ABI char & ExpandPostRAPseudosID
ExpandPostRAPseudos - This pass expands pseudo instructions after register allocation.
LLVM_ABI char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
LLVM_ABI FunctionPass * createScalarizeMaskedMemIntrinLegacyPass()
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
LLVM_ABI char & RemoveLoadsIntoFakeUsesID
RemoveLoadsIntoFakeUses pass.
LLVM_ABI MachineFunctionPass * createStackFrameLayoutAnalysisPass()
StackFramePrinter pass - This pass prints out the machine function's stack frame to the given stream ...
LLVM_ABI ModulePass * createGlobalMergeFuncPass()
This pass performs merging similar functions globally.
LLVM_ABI char & MachineSanitizerBinaryMetadataID
LLVM_ABI FunctionPass * createStackProtectorPass()
createStackProtectorPass - This pass adds stack protectors to functions.
LLVM_ABI Pass * createLoopTermFoldPass()
LLVM_ABI MachineFunctionPass * createGCEmptyBasicBlocksPass()
createGCEmptyBasicblocksPass - Empty basic blocks (basic blocks without real code) appear as the resu...
LLVM_ABI char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
LLVM_ABI char & PeepholeOptimizerLegacyID
PeepholeOptimizer - This pass performs peephole optimizations - like extension and comparison elimina...
LLVM_ABI char & LiveDebugValuesID
LiveDebugValues pass.
LLVM_ABI char & PrologEpilogCodeInserterID
PrologEpilogCodeInserter - This pass inserts prolog and epilog code, and eliminates abstract frame re...
LLVM_ABI char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
LLVM_ABI MachineFunctionPass * createMachineFunctionSplitterPass()
createMachineFunctionSplitterPass - This pass splits machine functions using profile information.
LLVM_ABI FunctionPass * createMachineVerifierPass(const std::string &Banner)
createMachineVerifierPass - This pass verifies cenerated machine code instructions for correctness.
ImmutablePass * createBasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf)
LLVM_ABI char & MachineLoopInfoID
MachineLoopInfo - This pass is a loop analysis pass.
LLVM_ABI cl::opt< bool > EnableFSDiscriminator
LLVM_ABI char & ShadowStackGCLoweringID
ShadowStackGCLowering - Implements the custom lowering mechanism used by the shadow stack GC.
LLVM_ABI char & ImplicitNullChecksID
ImplicitNullChecks - This pass folds null pointer checks into nearby memory operations.
LLVM_ABI FunctionPass * createMIRAddFSDiscriminatorsPass(sampleprof::FSDiscriminatorPass P)
Add Flow Sensitive Discriminators.
LLVM_ABI ModulePass * createPreISelIntrinsicLoweringPass()
This pass lowers the @llvm.load.relative and @llvm.objc.
LLVM_ABI MachineFunctionPass * createStaticDataSplitterPass()
createStaticDataSplitterPass - This is a machine-function pass that categorizes static data hotness u...
LLVM_ABI char & ShrinkWrapID
ShrinkWrap pass. Look for the best place to insert save and restore.
LLVM_ABI char & MachineLateInstrsCleanupID
MachineLateInstrsCleanup - This pass removes redundant identical instructions after register allocati...
LLVM_ABI char & UnreachableMachineBlockElimID
UnreachableMachineBlockElimination - This pass removes unreachable machine basic blocks.
LLVM_ABI FunctionPass * createExpandMemCmpLegacyPass()
LLVM_ABI FunctionPass * createLowerInvokePass()
LLVM_ABI FunctionPass * createRegUsageInfoCollector()
This pass is executed POST-RA to collect which physical registers are preserved by given machine func...
LLVM_ABI MachineFunctionPass * createResetMachineFunctionPass(bool EmitFallbackDiag, bool AbortOnFailedISel)
This pass resets a MachineFunction when it has the FailedISel property as if it was just created.
LLVM_ABI ImmutablePass * createScopedNoAliasAAWrapperPass()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:207
LLVM_ABI char & XRayInstrumentationID
This pass inserts the XRay instrumentation sleds if they are supported by the target platform.
LLVM_ABI char & OptimizePHIsLegacyID
OptimizePHIs - This pass optimizes machine instruction PHIs to take advantage of opportunities create...
LLVM_ABI char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
LLVM_ABI ModulePass * createStaticDataAnnotatorPass()
createStaticDataAnnotatorPASS - This is a module pass that reads from StaticDataProfileInfoWrapperPas...
LLVM_ABI char & FuncletLayoutID
This pass lays out funclets contiguously.
LLVM_ABI FunctionPass * createCodeGenPrepareLegacyPass()
createCodeGenPrepareLegacyPass - Transform the code to expose more pattern matching during instructio...
LLVM_ABI MachineFunctionPass * createMachineFunctionPrinterPass(raw_ostream &OS, const std::string &Banner="")
MachineFunctionPrinter pass - This pass prints out the machine function to the given stream as a debu...
LLVM_ABI char & RemoveRedundantDebugValuesID
RemoveRedundantDebugValues pass.
LLVM_ABI FunctionPass * createBasicAAWrapperPass()
LLVM_ABI char & DetectDeadLanesID
This pass adds dead/undef flags after analyzing subregister lanes.
LLVM_ABI char & PostRAMachineSinkingID
This pass perform post-ra machine sink for COPY instructions.
LLVM_ABI FunctionPass * createDwarfEHPass(CodeGenOptLevel OptLevel)
createDwarfEHPass - This pass mulches exception handling code into a form adapted to code generation.
LLVM_ABI FunctionPass * createRegAllocScoringPass()
When learning an eviction policy, extract score(reward) information, otherwise this does nothing.
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:82
LLVM_ABI char & StackSlotColoringID
StackSlotColoring - This pass performs stack slot coloring.
LLVM_ABI ModulePass * createMachineOutlinerPass(RunOutliner RunOutlinerMode)
This pass performs outlining on machine instructions directly before printing assembly.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
LLVM_ABI FunctionPass * createExpandLargeDivRemPass()
LLVM_ABI ModulePass * createLowerEmuTLSPass()
LowerEmuTLS - This pass generates __emutls_[vt].xyz variables for all TLS variables for the emulated ...
LLVM_ABI Pass * createMergeICmpsLegacyPass()
LLVM_ABI char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
LLVM_ABI ModulePass * createCheckDebugMachineModulePass()
Creates MIR Check Debug pass.
LLVM_ABI ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
LLVM_ABI FunctionPass * createMIRProfileLoaderPass(std::string File, std::string RemappingFile, sampleprof::FSDiscriminatorPass P, IntrusiveRefCntPtr< vfs::FileSystem > FS)
Read Flow Sensitive Profile.
LLVM_ABI FunctionPass * createVerifierPass(bool FatalErrors=true)
LLVM_ABI char & MachineCSELegacyID
MachineCSE - This pass performs global CSE on machine instructions.
LLVM_ABI ImmutablePass * createTypeBasedAAWrapperPass()
LLVM_ABI FunctionPass * createWinEHPass(bool DemoteCatchSwitchPHIOnly=false)
createWinEHPass - Prepares personality functions used by MSVC on Windows, in addition to the Itanium ...
LLVM_ABI Pass * createLoopStrengthReducePass()
LLVM_ABI MachineFunctionPass * createMachineBlockHashInfoPass()
createMachineBlockHashInfoPass - This pass computes basic block hashes.
LLVM_ABI char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
LLVM_ABI char & EarlyTailDuplicateLegacyID
Duplicate blocks with unconditional branches into tails of their predecessors.
LLVM_ABI void initializeAAResultsWrapperPassPass(PassRegistry &)
LLVM_ABI FunctionPass * createExpandReductionsPass()
This pass expands the reduction intrinsics into sequences of shuffles.
void call_once(once_flag &flag, Function &&F, Args &&... ArgList)
Execute the function specified as a parameter once.
Definition Threading.h:86
LLVM_ABI FunctionPass * createSjLjEHPreparePass(const TargetMachine *TM)
createSjLjEHPreparePass - This pass adapts exception handling code to use the GCC-style builtin setjm...
LLVM_ABI MachineFunctionPass * createBasicBlockPathCloningPass()
LLVM_ABI char & StackColoringLegacyID
StackSlotColoring - This pass performs stack coloring and merging.
LLVM_ABI char & VirtRegRewriterID
VirtRegRewriter pass.
LLVM_ABI FunctionPass * createReplaceWithVeclibLegacyPass()
LLVM_ABI char & FinalizeISelID
This pass expands pseudo-instructions, reserves registers and adjusts machine frame information.
LLVM_ABI char & MachineSinkingLegacyID
MachineSinking - This pass performs sinking on machine instructions.
LLVM_ABI FunctionPass * createRegUsageInfoPropPass()
Return a MachineFunction pass that identifies call sites and propagates register usage information of...
LLVM_ABI FunctionPass * createPartiallyInlineLibCallsPass()
LLVM_ABI FunctionPass * createExpandFpPass()
LLVM_ABI char & MachineBlockPlacementID
MachineBlockPlacement - This pass places basic blocks based on branch probabilities.
LLVM_ABI char & TwoAddressInstructionPassID
TwoAddressInstruction - This pass reduces two-address instructions to use two operands.
LLVM_ABI Pass * createCanonicalizeFreezeInLoopsPass()
LLVM_ABI char & LocalStackSlotAllocationID
LocalStackSlotAllocation - This pass assigns local frame indices to stack slots relative to one anoth...
LLVM_ABI char & BranchFolderPassID
BranchFolding - This pass performs machine code CFG based optimizations to delete branches to branche...
LLVM_ABI char & PHIEliminationID
PHIElimination - This pass eliminates machine instruction PHI nodes by inserting copy instructions.
LLVM_ABI Pass * createObjCARCContractPass()
LLVM_ABI ModulePass * createDebugifyMachineModulePass()
Creates MIR Debugify pass.
LLVM_ABI FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed.
LLVM_ABI ModulePass * createWindowsSecureHotPatchingPass()
Creates Windows Secure Hot Patch pass.
LLVM_ABI char & RenameIndependentSubregsID
This pass detects subregister lanes in a virtual register that are used independently of other lanes ...
LLVM_ABI char & MachineLICMID
This pass performs loop invariant code motion on machine instructions.
LLVM_ABI char & MachineBlockPlacementStatsID
MachineBlockPlacementStats - This pass collects statistics about the basic block placement using bran...
LLVM_ABI char & LiveIntervalsID
LiveIntervals - This analysis keeps track of the live ranges of virtual and physical registers.
LLVM_ABI char & MachineCopyPropagationID
MachineCopyPropagation - This pass performs copy propagation on machine instructions.
LLVM_ABI char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
const void * AnalysisID
Definition Pass.h:51
LLVM_ABI void initializeCodeGen(PassRegistry &)
Initialize all passes linked into the CodeGen library.
Definition CodeGen.cpp:20
LLVM_ABI FunctionPass * createUnreachableBlockEliminationPass()
createUnreachableBlockEliminationPass - The LLVM code generator does not work well with unreachable b...
LLVM_ABI CGPassBuilderOption getCGPassBuilderOption()
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:180
InsertedPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID)
A utility class that uses RAII to save and restore the value of a variable.
The llvm::once_flag structure.
Definition Threading.h:67