LLVM 24.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 "CodeGenOptions.h"
16#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/StringRef.h"
30#include "llvm/CodeGen/Passes.h"
35#include "llvm/IR/Verifier.h"
37#include "llvm/MC/MCAsmInfo.h"
39#include "llvm/Pass.h"
43#include "llvm/Support/Debug.h"
55#include <cassert>
56#include <optional>
57#include <string>
58
59using namespace llvm;
60
61static const CodeGenOptions &getOpts(const TargetMachine &TM) {
64}
65
66namespace {
67class TriggerCrashFunctionLegacyPass : public FunctionPass {
68public:
69 static char ID;
70 TriggerCrashFunctionLegacyPass() : FunctionPass(ID) {}
71 bool runOnFunction(Function &F) override {
72 abort();
73 return false;
74 }
75 StringRef getPassName() const override { return "TriggerCrashFunctionPass"; }
76};
77} // namespace
78
79char TriggerCrashFunctionLegacyPass::ID = 0;
80
81// Enable or disable the MachineOutliner.
83 "enable-machine-outliner", cl::desc("Enable the machine outliner"),
87 "Run on all functions guaranteed to be beneficial"),
88 clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo",
89 "Outline cold code only. If a code block does not have "
90 "profile data, optimistically assume it is cold."),
91 clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo",
92 "Outline cold code only. If a code block does not have "
93 "profile, data, conservatively assume it is hot."),
94 clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"),
95 // Sentinel value for unspecified option.
97
98/// Option names for limiting the codegen pipeline.
99/// Those are used in error reporting and we didn't want
100/// to duplicate their names all over the place.
101static const char StartAfterOptName[] = "start-after";
102static const char StartBeforeOptName[] = "start-before";
103static const char StopAfterOptName[] = "stop-after";
104static const char StopBeforeOptName[] = "stop-before";
105
106/// Allow standard passes to be disabled by command line options. This supports
107/// simple binary flags that either suppress the pass or do nothing.
108/// i.e. -disable-mypass=false has no effect.
109/// These should be converted to boolOrDefault in order to use applyOverride.
111 bool Override) {
112 if (Override)
113 return IdentifyingPassPtr();
114 return PassID;
115}
116
117/// Allow standard passes to be disabled by the command line, regardless of who
118/// is adding the pass.
119///
120/// StandardID is the pass identified in the standard pass pipeline and provided
121/// to addPass(). It may be a target-specific ID in the case that the target
122/// directly adds its own pass, but in that case we harmlessly fall through.
123///
124/// TargetID is the pass that the target has configured to override StandardID.
125///
126/// StandardID may be a pseudo ID. In that case TargetID is the name of the real
127/// pass to run. This allows multiple options to control a single pass depending
128/// on where in the pipeline that pass is added.
129static IdentifyingPassPtr overridePass(const CodeGenOptions &Opts,
130 AnalysisID StandardID,
131 IdentifyingPassPtr TargetID) {
132 if (StandardID == &PostRASchedulerID)
133 return applyDisable(TargetID, Opts.disable_post_ra);
134
135 if (StandardID == &BranchFolderPassID)
136 return applyDisable(TargetID, Opts.disable_branch_fold);
137
138 if (StandardID == &TailDuplicateLegacyID)
139 return applyDisable(TargetID, Opts.disable_tail_duplicate);
140
141 if (StandardID == &EarlyTailDuplicateLegacyID)
142 return applyDisable(TargetID, Opts.disable_early_taildup);
143
144 if (StandardID == &MachineBlockPlacementID)
145 return applyDisable(TargetID, Opts.disable_block_placement);
146
147 if (StandardID == &StackSlotColoringID)
148 return applyDisable(TargetID, Opts.disable_ssc);
149
150 if (StandardID == &DeadMachineInstructionElimID)
151 return applyDisable(TargetID, Opts.disable_machine_dce);
152
153 if (StandardID == &EarlyIfConverterLegacyID)
154 return applyDisable(TargetID, Opts.disable_early_ifcvt);
155
156 if (StandardID == &EarlyMachineLICMID)
157 return applyDisable(TargetID, Opts.disable_machine_licm);
158
159 if (StandardID == &MachineCSELegacyID)
160 return applyDisable(TargetID, Opts.disable_machine_cse);
161
162 if (StandardID == &MachineLICMID)
163 return applyDisable(TargetID, Opts.disable_postra_machine_licm);
164
165 if (StandardID == &MachineSinkingLegacyID)
166 return applyDisable(TargetID, Opts.disable_machine_sink);
167
168 if (StandardID == &PostRAMachineSinkingID)
169 return applyDisable(TargetID, Opts.disable_postra_machine_sink);
170
171 if (StandardID == &MachineCopyPropagationID)
172 return applyDisable(TargetID, Opts.disable_copyprop);
173
174 return TargetID;
175}
176
177// Find the FSProfile file name. The internal option takes the precedence
178// before getting from TargetMachine.
179static std::string getFSProfileFile(const CodeGenOptions &Opts,
180 const TargetMachine *TM) {
181 if (!Opts.fs_profile_file.empty())
182 return Opts.fs_profile_file.str();
183 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
184 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
185 return std::string();
186 return PGOOpt->ProfileFile;
187}
188
189// Find the Profile remapping file name. The internal option takes the
190// precedence before getting from TargetMachine.
191static std::string getFSRemappingFile(const CodeGenOptions &Opts,
192 const TargetMachine *TM) {
193 if (!Opts.fs_remapping_file.empty())
194 return Opts.fs_remapping_file.str();
195 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
196 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
197 return std::string();
198 return PGOOpt->ProfileRemappingFile;
199}
200
201//===---------------------------------------------------------------------===//
202/// TargetPassConfig
203//===---------------------------------------------------------------------===//
204
205INITIALIZE_PASS(TargetPassConfig, "targetpassconfig",
206 "Target Pass Configuration", false, false)
207char TargetPassConfig::ID = 0;
208
209namespace {
210
214
217
219 assert(InsertedPassID.isValid() && "Illegal Pass ID!");
220 if (InsertedPassID.isInstance())
221 return InsertedPassID.getInstance();
222 Pass *NP = Pass::createPass(InsertedPassID.getID());
223 assert(NP && "Pass ID not registered");
224 return NP;
225 }
226};
227
228} // end anonymous namespace
229
230namespace llvm {
231
233public:
234 // List of passes explicitly substituted by this target. Normally this is
235 // empty, but it is a convenient way to suppress or replace specific passes
236 // that are part of a standard pass pipeline without overridding the entire
237 // pipeline. This mechanism allows target options to inherit a standard pass's
238 // user interface. For example, a target may disable a standard pass by
239 // default by substituting a pass ID of zero, and the user may still enable
240 // that standard pass with an explicit command line option.
242
243 /// Store the pairs of <AnalysisID, AnalysisID> of which the second pass
244 /// is inserted after each instance of the first one.
246};
247
248} // end namespace llvm
249
250// Out of line virtual method.
254
256 if (PassName.empty())
257 return nullptr;
258
260 const PassInfo *PI = PR.getPassInfo(PassName);
261 if (!PI)
263 Twine("\" pass is not registered."));
264 return PI;
265}
266
268 const PassInfo *PI = getPassInfo(PassName);
269 return PI ? PI->getTypeInfo() : nullptr;
270}
271
272static std::pair<StringRef, unsigned>
274 StringRef Name, InstanceNumStr;
275 std::tie(Name, InstanceNumStr) = PassName.split(',');
276
277 unsigned InstanceNum = 0;
278 if (!InstanceNumStr.empty() && InstanceNumStr.getAsInteger(10, InstanceNum))
279 reportFatalUsageError("invalid pass instance specifier " + PassName);
280
281 return std::make_pair(Name, InstanceNum);
282}
283
284void TargetPassConfig::setStartStopPasses() {
285 StringRef StartBeforeName;
286 std::tie(StartBeforeName, StartBeforeInstanceNum) =
287 getPassNameAndInstanceNum(Opts.start_before);
288
289 StringRef StartAfterName;
290 std::tie(StartAfterName, StartAfterInstanceNum) =
291 getPassNameAndInstanceNum(Opts.start_after);
292
293 StringRef StopBeforeName;
294 std::tie(StopBeforeName, StopBeforeInstanceNum) =
295 getPassNameAndInstanceNum(Opts.stop_before);
296
297 StringRef StopAfterName;
298 std::tie(StopAfterName, StopAfterInstanceNum) =
299 getPassNameAndInstanceNum(Opts.stop_after);
300
301 StartBefore = getPassIDFromName(StartBeforeName);
302 StartAfter = getPassIDFromName(StartAfterName);
303 StopBefore = getPassIDFromName(StopBeforeName);
304 StopAfter = getPassIDFromName(StopAfterName);
305 if (StartBefore && StartAfter)
306 reportFatalUsageError(Twine(StartBeforeOptName) + Twine(" and ") +
307 Twine(StartAfterOptName) + Twine(" specified!"));
308 if (StopBefore && StopAfter)
309 reportFatalUsageError(Twine(StopBeforeOptName) + Twine(" and ") +
310 Twine(StopAfterOptName) + Twine(" specified!"));
311 Started = (StartAfter == nullptr) && (StartBefore == nullptr);
312}
313
320
322computeMachineVerifierMode(const CodeGenOptions &Opts, bool VerifyEach) {
323 if (VerifyEach)
325 return Opts.disable_mir_output_verify ? MachineVerifierMode::None
327}
328
330 const CodeGenOptions &Opts = getOpts(TM);
332 Opt.EnableGlobalISelAbort = Opts.global_isel_abort;
333 if (Opts.enable_ipra != BoolOrDefault::Default)
334 Opt.EnableIPRA = Opts.enable_ipra == BoolOrDefault::True;
335 Opt.EnableFastISelOption = toBoolOrDefault(Opts.fast_isel);
336 Opt.EnableRegAllocFastTied = toBoolOrDefault(Opts.regalloc_fast_tied);
337 Opt.EnableMachinePipeliner = toBoolOrDefault(Opts.enable_pipeliner);
338 Opt.EnableGlobalISelOption = toBoolOrDefault(Opts.global_isel);
340 Opts, valueOr(Opts.verify_machineinstrs, false));
342 Opts.disable_atexit_based_global_dtor_lowering;
343 Opt.DisableExpandReductions = Opts.disable_expand_reductions;
344 Opt.PrintAfterISel = Opts.print_after_isel;
345 Opt.FSProfileFile = Opts.fs_profile_file.str();
346 Opt.EnableGCEmptyBlocks = Opts.enable_gc_empty_basic_blocks;
347 Opt.EnableBlockPlacementStats = Opts.enable_block_placement_stats;
348 Opt.EnableGlobalMergeFunc = Opts.enable_global_merge_func;
349 Opt.EnableImplicitNullChecks = Opts.enable_implicit_null_checks;
351 Opt.MISchedPostRA = Opts.misched_postra;
352 Opt.DisableLSR = Opts.disable_lsr;
353 Opt.DisableConstantHoisting = Opts.disable_constant_hoisting;
354 Opt.DisableCGP = Opts.disable_cgp;
355 Opt.DisablePartialLibcallInlining = Opts.disable_partial_libcall_inlining;
356 Opt.DisableSelectOptimize = Opts.disable_select_optimize;
357 Opt.PrintISelInput = Opts.print_isel_input;
358 Opt.PrintRegUsage = Opts.print_regusage;
359 Opt.DebugifyAndStripAll = toBoolOrDefault(Opts.debugify_and_strip_all_safe);
361 toBoolOrDefault(Opts.debugify_check_and_strip_all_safe);
362 Opt.DisableRAFSProfileLoader = Opts.disable_ra_fsprofile_loader;
363 Opt.DisableCFIFixup = Opts.disable_cfi_fixup;
364 return Opt;
365}
366
368 TargetMachine &TM) {
369 const CodeGenOptions &Opts = getOpts(TM);
370
371 // Register a callback for disabling passes.
372 PIC.registerShouldRunOptionalPassCallback([&Opts](StringRef P, IRUnitRef) {
373
374#define DISABLE_PASS(Option, Name) \
375 if (Option && P.contains(#Name)) \
376 return false;
377 DISABLE_PASS(Opts.disable_block_placement, MachineBlockPlacementPass)
378 DISABLE_PASS(Opts.disable_branch_fold, BranchFolderPass)
379 DISABLE_PASS(Opts.disable_copyprop, MachineCopyPropagationPass)
380 DISABLE_PASS(Opts.disable_early_ifcvt, EarlyIfConverterLegacyPass)
381 DISABLE_PASS(Opts.disable_early_taildup, EarlyTailDuplicatePass)
382 DISABLE_PASS(Opts.disable_machine_cse, MachineCSELegacyPass)
383 DISABLE_PASS(Opts.disable_machine_dce, DeadMachineInstructionElimPass)
384 DISABLE_PASS(Opts.disable_machine_licm, EarlyMachineLICMPass)
385 DISABLE_PASS(Opts.disable_machine_sink, MachineSinkingPass)
386 DISABLE_PASS(Opts.disable_postra_machine_licm, MachineLICMPass)
387 DISABLE_PASS(Opts.disable_postra_machine_sink, PostRAMachineSinkingPass)
388 DISABLE_PASS(Opts.disable_post_ra, PostRASchedulerPass)
389 DISABLE_PASS(Opts.disable_ssc, StackSlotColoringPass)
390 DISABLE_PASS(Opts.disable_tail_duplicate, TailDuplicatePass)
391
392 return true;
393 });
394}
395
399 const CodeGenOptions &Opts = getOpts(TM);
400 auto [StartBefore, StartBeforeInstanceNum] =
401 getPassNameAndInstanceNum(Opts.start_before);
402 auto [StartAfter, StartAfterInstanceNum] =
403 getPassNameAndInstanceNum(Opts.start_after);
404 auto [StopBefore, StopBeforeInstanceNum] =
405 getPassNameAndInstanceNum(Opts.stop_before);
406 auto [StopAfter, StopAfterInstanceNum] =
407 getPassNameAndInstanceNum(Opts.stop_after);
408
409 if (!StartBefore.empty() && !StartAfter.empty())
411 Twine(StartBeforeOptName) + " and " + StartAfterOptName + " specified!",
412 std::make_error_code(std::errc::invalid_argument));
413 if (!StopBefore.empty() && !StopAfter.empty())
415 Twine(StopBeforeOptName) + " and " + StopAfterOptName + " specified!",
416 std::make_error_code(std::errc::invalid_argument));
417
418 StartStopInfo Result;
419 Result.StartPass = StartBefore.empty() ? StartAfter : StartBefore;
420 Result.StopPass = StopBefore.empty() ? StopAfter : StopBefore;
421 Result.StartInstanceNum =
422 StartBefore.empty() ? StartAfterInstanceNum : StartBeforeInstanceNum;
423 Result.StopInstanceNum =
424 StopBefore.empty() ? StopAfterInstanceNum : StopBeforeInstanceNum;
425 Result.StartAfter = !StartAfter.empty();
426 Result.StopAfter = !StopAfter.empty();
427 Result.StartInstanceNum += Result.StartInstanceNum == 0;
428 Result.StopInstanceNum += Result.StopInstanceNum == 0;
429 return Result;
430}
431
432// Out of line constructor provides default values for pass options and
433// registers all common codegen passes.
435 : ImmutablePass(ID), PM(&PM), Opts(getOpts(TM)), TM(&TM) {
436 Impl = new PassConfigImpl();
437
439 // Register all target independent codegen passes to activate their PassIDs,
440 // including this pass itself.
442
444
445 // Also register alias analysis passes required by codegen passes.
448
449 if (Opts.enable_ipra != BoolOrDefault::Default) {
450 TM.Options.EnableIPRA = Opts.enable_ipra == BoolOrDefault::True;
451 } else {
452 // If not explicitly specified, use target default.
453 TM.Options.EnableIPRA |= TM.useIPRA();
454 }
455
456 if (TM.Options.EnableIPRA)
458
459 if (Opts.regalloc_fast_tied != BoolOrDefault::Default)
460 TM.setEnableTiedFastRegAlloc(Opts.regalloc_fast_tied ==
462
463 if (Opts.global_isel_abort)
464 TM.Options.GlobalISelAbort = *Opts.global_isel_abort;
465
466 bool VerifyEach = valueOr(Opts.verify_machineinstrs, false);
467#ifdef EXPENSIVE_CHECKS
468 if (Opts.verify_machineinstrs == BoolOrDefault::Default)
469 VerifyEach = TM.isMachineVerifierClean();
470#endif
472
473 if (Opts.function_splitting)
474 TM.Options.FunctionSplitting = *Opts.function_splitting;
475
476 setStartStopPasses();
477}
478
480 return TM->getOptLevel();
481}
482
483/// Insert InsertedPassID pass after TargetPassID.
485 IdentifyingPassPtr InsertedPassID) {
486 assert(((!InsertedPassID.isInstance() &&
487 TargetPassID != InsertedPassID.getID()) ||
488 (InsertedPassID.isInstance() &&
489 TargetPassID != InsertedPassID.getInstance()->getPassID())) &&
490 "Insert a pass after itself!");
491 Impl->InsertedPasses.emplace_back(TargetPassID, InsertedPassID);
492}
493
494/// createPassConfig - Create a pass configuration object to be used by
495/// addPassToEmitX methods for generating a pipeline of CodeGen passes.
496///
497/// Targets may override this to extend TargetPassConfig.
502
504 reportFatalUsageError("trying to construct TargetPassConfig without a target "
505 "machine. Scheduling a CodeGen pass without a target "
506 "triple set?");
507}
508
510 return Opts.stop_before.empty() && Opts.stop_after.empty();
511}
512
514 return !Opts.start_before.empty() || !Opts.start_after.empty() ||
516}
517
518static std::string formatLimitReason(StringRef StartAfter,
519 StringRef StartBefore, StringRef StopAfter,
520 StringRef StopBefore) {
521 std::string Res;
522 StringRef PassNames[] = {StartAfter, StartBefore, StopAfter, StopBefore};
523 static const char *OptNames[] = {StartAfterOptName, StartBeforeOptName,
525 bool IsFirst = true;
526 for (int Idx = 0; Idx < 4; ++Idx)
527 if (!PassNames[Idx].empty()) {
528 if (!IsFirst)
529 Res += " and ";
530 IsFirst = false;
531 Res += OptNames[Idx];
532 }
533 return Res;
534}
535
537 return formatLimitReason(Opts.start_after, Opts.start_before, Opts.stop_after,
538 Opts.stop_before);
539}
540
546
547// Helper to verify the analysis is really immutable.
548void TargetPassConfig::setOpt(bool &Opt, bool Val) {
549 assert(!Initialized && "PassConfig is immutable");
550 Opt = Val;
551}
552
554 IdentifyingPassPtr TargetID) {
555 Impl->TargetPasses[StandardID] = TargetID;
556}
557
560 I = Impl->TargetPasses.find(ID);
561 if (I == Impl->TargetPasses.end())
562 return ID;
563 return I->second;
564}
565
568 IdentifyingPassPtr FinalPtr = overridePass(Opts, ID, TargetID);
569 return !FinalPtr.isValid() || FinalPtr.isInstance() ||
570 FinalPtr.getID() != ID;
571}
572
573/// Add a pass to the PassManager if that pass is supposed to be run. If the
574/// Started/Stopped flags indicate either that the compilation should start at
575/// a later pass or that it should stop after an earlier pass, then do not add
576/// the pass. Finally, compare the current pass against the StartAfter
577/// and StopAfter options and change the Started/Stopped flags accordingly.
579 assert(!Initialized && "PassConfig is immutable");
580
581 // Cache the Pass ID here in case the pass manager finds this pass is
582 // redundant with ones already scheduled / available, and deletes it.
583 // Fundamentally, once we add the pass to the manager, we no longer own it
584 // and shouldn't reference it.
585 AnalysisID PassID = P->getPassID();
586
587 if (StartBefore == PassID && StartBeforeCount++ == StartBeforeInstanceNum)
588 Started = true;
589 if (StopBefore == PassID && StopBeforeCount++ == StopBeforeInstanceNum)
590 Stopped = true;
591 if (Started && !Stopped) {
592 if (AddingMachinePasses) {
593 // Construct banner message before PM->add() as that may delete the pass.
594 std::string Banner =
595 std::string("After ") + std::string(P->getPassName());
597 PM->add(P);
598 addMachinePostPasses(Banner);
599 } else {
600 PM->add(P);
601 }
602
603 // Add the passes after the pass P if there is any.
604 for (const auto &IP : Impl->InsertedPasses)
605 if (IP.TargetPassID == PassID)
606 addPass(IP.getInsertedPass());
607 } else {
608 delete P;
609 }
610
611 if (StopAfter == PassID && StopAfterCount++ == StopAfterInstanceNum)
612 Stopped = true;
613
614 if (StartAfter == PassID && StartAfterCount++ == StartAfterInstanceNum)
615 Started = true;
616 if (Stopped && !Started)
617 reportFatalUsageError("Cannot stop compilation after pass that is not run");
618}
619
620/// Add a CodeGen pass at this point in the pipeline after checking for target
621/// and command line overrides.
622///
623/// addPass cannot return a pointer to the pass instance because is internal the
624/// PassManager and the instance we create here may already be freed.
626 IdentifyingPassPtr TargetID = getPassSubstitution(PassID);
627 IdentifyingPassPtr FinalPtr = overridePass(Opts, PassID, TargetID);
628 if (!FinalPtr.isValid())
629 return nullptr;
630
631 Pass *P;
632 if (FinalPtr.isInstance())
633 P = FinalPtr.getInstance();
634 else {
635 P = Pass::createPass(FinalPtr.getID());
636 if (!P)
637 llvm_unreachable("Pass ID not registered");
638 }
639 AnalysisID FinalID = P->getPassID();
640 addPass(P); // Ends the lifetime of P.
641
642 return FinalID;
643}
644
645void TargetPassConfig::printAndVerify(const std::string &Banner) {
646 addPrintPass(Banner);
647 addVerifyPass(Banner);
648}
649
650void TargetPassConfig::addPrintPass(const std::string &Banner) {
651 if (Opts.print_after_isel)
652 PM->add(createMachineFunctionPrinterPass(dbgs(), Banner));
653}
654
655void TargetPassConfig::addVerifyPass(const std::string &Banner) {
657 PM->add(createMachineVerifierPass(Banner));
658}
659
663
665 PM->add(createStripDebugMachineModuleLegacyPass(/*OnlyDebugified=*/true));
666}
667
671
673 if (AllowDebugify && DebugifyIsSafe &&
674 (valueOr(Opts.debugify_and_strip_all_safe, false) ||
675 valueOr(Opts.debugify_check_and_strip_all_safe, false)))
677}
678
679void TargetPassConfig::addMachinePostPasses(const std::string &Banner) {
680 if (DebugifyIsSafe) {
681 if (valueOr(Opts.debugify_check_and_strip_all_safe, false)) {
684 } else if (valueOr(Opts.debugify_and_strip_all_safe, false))
686 }
687 addVerifyPass(Banner);
688}
689
690/// Add common target configurable passes that perform LLVM IR to IR transforms
691/// following machine independent optimization.
693 // Before running any passes, run the verifier to determine if the input
694 // coming from the front-end and/or optimizer is valid.
695 if (!DisableVerify)
697
699 // Basic AliasAnalysis support.
700 // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
701 // BasicAliasAnalysis wins if they disagree. This is intended to help
702 // support "obvious" type-punning idioms.
706
707 // Run loop strength reduction before anything else.
708 if (!Opts.disable_lsr) {
713 }
714 }
715
716 // Run GC lowering passes for builtin collectors
717 // TODO: add a pass insertion point here
720
721 // For MachO, lower @llvm.global_dtors into @llvm.global_ctors with
722 // __cxa_atexit() calls to avoid emitting the deprecated __mod_term_func.
723 if (TM->getTargetTriple().isOSBinFormatMachO() &&
724 !Opts.disable_atexit_based_global_dtor_lowering)
726
727 // Make sure that no unreachable blocks are instruction selected.
729
730 // Prepare expensive constants for SelectionDAG.
731 if (getOptLevel() != CodeGenOptLevel::None && !Opts.disable_constant_hoisting)
733
735 !Opts.disable_replace_with_vec_lib)
737
739 !Opts.disable_partial_libcall_inlining)
741
742 // Instrument function entry after all inlining.
744
745 // Add scalarization of target's unsupported masked memory intrinsics pass.
746 // the unsupported intrinsic will be replaced with a chain of basic blocks,
747 // that stores/loads element one-by-one if the appropriate mask bit is set.
749
750 // Expand reduction intrinsics into shuffle sequences if the target wants to.
751 // Allow disabling it for testing purposes.
752 if (!Opts.disable_expand_reductions)
754
755 // Convert conditional moves to conditional jumps when profitable.
756 if (getOptLevel() != CodeGenOptLevel::None && !Opts.disable_select_optimize)
758
759 if (Opts.enable_global_merge_func)
761
762 if (TM->getTargetTriple().isOSWindows())
764}
765
766/// Turn exception handling constructs into something the code generators can
767/// handle.
769 // The module's exception model is not known when the pipeline is built, so
770 // schedule the preparation pass for every model the target supports. Each
771 // pass does nothing for other models.
772 bool HasEHPrep = false;
773
774 // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
775 // Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
776 // catch info can get misplaced when a selector ends up more than one block
777 // removed from the parent invoke(s). This could happen when a landing
778 // pad is shared by multiple invokes and is also a target of a normal
779 // edge from elsewhere.
780 if (TM->supportsExceptionModel(ExceptionHandling::SjLj)) {
782 HasEHPrep = true;
783 }
784
785 // We support using both GCC-style and MSVC-style exceptions on Windows, so
786 // WinEHPrepare runs in addition to DwarfEHPrepare below. Each pass will only
787 // actually run if it recognizes the personality function.
788 //
789 // Wasm EH uses Windows EH instructions, but it does not need to demote PHIs
790 // on catchpads and cleanuppads because it does not outline them into
791 // funclets. Catchswitch blocks are not lowered in SelectionDAG, so we
792 // should remove PHIs there. WinEHPrepare derives this from the Wasm
793 // personality, so no explicit flag is needed here.
794 if (TM->supportsExceptionModel(ExceptionHandling::WinEH) ||
795 TM->supportsExceptionModel(ExceptionHandling::Wasm)) {
797 HasEHPrep = true;
798 }
799
800 if (TM->supportsExceptionModel(ExceptionHandling::Wasm))
802
803 if (TM->supportsExceptionModel(ExceptionHandling::DwarfCFI)) {
805 HasEHPrep = true;
806 }
807
808 // If the target supports no exception model, nothing else lowers invokes.
809 if (!HasEHPrep) {
811
812 // The lower invoke pass may create unreachable code. Remove it.
814 }
815}
816
817/// Add pass to prepare the LLVM IR for code generation. This should be done
818/// before exception handling preparation passes.
823
824/// Add common passes that perform LLVM IR to IR transforms in preparation for
825/// instruction selection.
827 addPreISel();
828
829 // Force codegen to run according to the callgraph.
832
834
835 // Add both the safe stack and the stack protection passes: each of them will
836 // only protect functions that have corresponding attributes.
839
840 if (Opts.print_isel_input)
842 dbgs(), "\n\n*** Final LLVM Code input to ISel ***\n"));
843
844 // All passes which modify the LLVM IR are now complete; run the verifier
845 // to ensure that the IR is valid.
846 if (!DisableVerify)
848}
849
851 // Enable FastISel with -fast-isel, but allow that to be overridden.
852 TM->setO0WantsFastISel(valueOr(Opts.fast_isel, true));
853
854 // Determine an instruction selector.
855 enum class SelectorType { SelectionDAG, FastISel, GlobalISel };
856 SelectorType Selector;
857
858 if (valueOr(Opts.fast_isel, false))
859 Selector = SelectorType::FastISel;
860 else if (valueOr(Opts.global_isel, false) ||
861 (TM->Options.EnableGlobalISel && valueOr(Opts.global_isel, true)))
862 Selector = SelectorType::GlobalISel;
863 else if (TM->getOptLevel() == CodeGenOptLevel::None &&
864 TM->getO0WantsFastISel())
865 Selector = SelectorType::FastISel;
866 else
867 Selector = SelectorType::SelectionDAG;
868
869 // Set consistently TM->Options.EnableFastISel and EnableGlobalISel.
870 if (Selector == SelectorType::FastISel) {
871 TM->setFastISel(true);
872 TM->setGlobalISel(false);
873 } else if (Selector == SelectorType::GlobalISel) {
874 TM->setFastISel(false);
875 TM->setGlobalISel(true);
876 }
877
878 // FIXME: Injecting into the DAGISel pipeline seems to cause issues with
879 // analyses needing to be re-run. This can result in being unable to
880 // schedule passes (particularly with 'Function Alias Analysis
881 // Results'). It's not entirely clear why but AFAICT this seems to be
882 // due to one FunctionPassManager not being able to use analyses from a
883 // previous one. As we're injecting a ModulePass we break the usual
884 // pass manager into two. GlobalISel with the fallback path disabled
885 // and -run-pass seem to be unaffected. The majority of GlobalISel
886 // testing uses -run-pass so this probably isn't too bad.
887 SaveAndRestore SavedDebugifyIsSafe(DebugifyIsSafe);
888 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
889 DebugifyIsSafe = false;
890
891 // Add instruction selector passes for global isel if enabled.
892 if (Selector == SelectorType::GlobalISel) {
893 SaveAndRestore SavedAddingMachinePasses(AddingMachinePasses, true);
894 if (addIRTranslator())
895 return true;
896
898
900 return true;
901
902 // Before running the register bank selector, ask the target if it
903 // wants to run some passes.
905
906 if (addRegBankSelect())
907 return true;
908
910
912 return true;
913 }
914
915 // Pass to reset the MachineFunction if the ISel failed. Outside of the above
916 // if so that the verifier is not added to it.
917 if (Selector == SelectorType::GlobalISel)
920
921 // Run the SDAG InstSelector, providing a fallback path when we do not want to
922 // abort on not-yet-supported input.
923 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
924 if (addInstSelector())
925 return true;
926
927 // Expand pseudo-instructions emitted by ISel. Don't run the verifier before
928 // FinalizeISel.
930
931 // Print the instruction selected machine code...
932 printAndVerify("After Instruction Selection");
933
934 return false;
935}
936
938 if (TM->useEmulatedTLS())
940
941 PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
942 // ObjCARCContract operates on ObjC intrinsics and must run before
943 // PreISelIntrinsicLowering.
948 addIRPasses();
949
950 if (Opts.codegen_pipeline_trigger_crash)
951 addPass(new TriggerCrashFunctionLegacyPass());
952
956
957 return addCoreISelPasses();
958}
959
960/// -regalloc=... command line option.
961static FunctionPass *useDefaultRegisterAllocator() { return nullptr; }
962static cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
963 RegisterPassParser<RegisterRegAlloc>>
965 cl::desc("Register allocator to use"));
966
967/// Add the complete set of target-independent postISel code generator passes.
968///
969/// This can be read as the standard order of major LLVM CodeGen stages. Stages
970/// with nontrivial configuration or multiple passes are broken out below in
971/// add%Stage routines.
972///
973/// Any TargetPassConfig::addXX routine may be overriden by the Target. The
974/// addPre/Post methods with empty header implementations allow injecting
975/// target-specific fixups just before or after major stages. Additionally,
976/// targets have the flexibility to change pass order within a stage by
977/// overriding default implementation of add%Stage routines below. Each
978/// technique has maintainability tradeoffs because alternate pass orders are
979/// not well supported. addPre/Post works better if the target pass is easily
980/// tied to a common pass. But if it has subtle dependencies on multiple passes,
981/// the target should override the stage instead.
982///
983/// TODO: We could use a single addPre/Post(ID) hook to allow pass injection
984/// before/after any target-independent pass. But it's currently overkill.
986 AddingMachinePasses = true;
987
988 // Add passes that optimize machine instructions in SSA form.
991 } else {
992 // If the target requests it, assign local variables to stack slots relative
993 // to one another and simplify frame index references where possible.
995 }
996
997 if (TM->Options.EnableIPRA)
999
1001 valueOr(getOpts(*TM).enable_pipeliner, isMachinePipelinerEnabled()))
1003
1004 // Run pre-ra passes.
1006
1007 // Debugifying the register allocator passes seems to provoke some
1008 // non-determinism that affects CodeGen and there doesn't seem to be a point
1009 // where it becomes safe again so stop debugifying here.
1010 DebugifyIsSafe = false;
1011
1012 // Add a FSDiscriminator pass right before RA, so that we could get
1013 // more precise SampleFDO profile for RA.
1017 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1018 if (!ProfileFile.empty() && !Opts.disable_ra_fsprofile_loader)
1020 ProfileFile, getFSRemappingFile(Opts, TM),
1022 }
1023
1024 // Run register allocation and passes that are tightly coupled with it,
1025 // including phi elimination and scheduling.
1026 if (getOptimizeRegAlloc())
1028 else
1030
1031 // Run post-ra passes.
1033
1035
1037
1038 // Insert prolog/epilog code. Eliminate abstract frame index references...
1042 }
1043
1044 // Prolog/Epilog inserter needs a TargetMachine to instantiate. But only
1045 // do so if it hasn't been disabled, substituted, or overridden.
1048
1049 /// Add passes that optimize machine instructions after register allocation.
1052
1053 // Expand pseudo instructions before second scheduling pass.
1055
1056 // Run pre-sched2 passes.
1057 addPreSched2();
1058
1059 if (Opts.enable_implicit_null_checks)
1061
1062 // Second pass scheduler.
1063 // Let Target optionally insert this pass by itself at some other
1064 // point.
1066 !TM->targetSchedulesPostRAScheduling()) {
1067 if (Opts.misched_postra)
1069 else
1071 }
1072
1073 // GC
1074 addGCPasses();
1075
1076 // Basic block placement.
1079
1080 // Insert before XRay Instrumentation.
1082
1085
1087
1088 if (TM->Options.EnableIPRA)
1089 // Collect register usage information and produce a register mask of
1090 // clobbered registers, to be used to optimize call sites.
1092
1093 // FIXME: Some backends are incompatible with running the verifier after
1094 // addPreEmitPass. Maybe only pass "false" here for those targets?
1096
1101
1102 if (TM->Options.EnableMachineOutliner &&
1106 TM->supportsDefaultOutlining())
1108 }
1109
1110 if (Opts.enable_gc_empty_basic_blocks)
1112
1116
1117 const bool SplitFunctionsWithPGO =
1118 TM->Options.FunctionSplitting == FunctionSplittingMode::All;
1119
1120 if (SplitFunctionsWithPGO || Opts.split_static_data ||
1121 TM->Options.EnableStaticDataPartitioning) {
1122 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1123 if (!ProfileFile.empty()) {
1126 ProfileFile, getFSRemappingFile(Opts, TM),
1128 } else {
1129 // Sample profile is given, but FSDiscriminator is not
1130 // enabled, this may result in performance regression.
1132 << "Using AutoFDO without FSDiscriminator for MFS may regress "
1133 "performance.\n";
1134 }
1135 }
1136 }
1137
1138 if (Opts.split_static_data || TM->Options.EnableStaticDataPartitioning) {
1139 // The static data splitter pass is a machine function pass. and
1140 // static data annotator pass is a module-wide pass. See the file comment
1141 // in StaticDataAnnotator.cpp for the motivation.
1144 }
1145 // We run the BasicBlockSections pass if we need BB sections, BB address map,
1146 // or function splitting. With function splitting, functions which are
1147 // eligible for basic-block-sections optimizations (`=all`, or `=list=` with
1148 // function included in the list profile) get that optimization, and the other
1149 // functions are split using their PGO/AutoFDO profile.
1150 if (TM->getBBSectionsType() != llvm::BasicBlockSection::None ||
1151 TM->Options.BBAddrMap || SplitFunctionsWithPGO) {
1152 if (shouldEmitBBHash() || Opts.basic_block_section_match_infer)
1154 if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) {
1156 TM->getBBSectionsFuncListBuf()));
1157 if (!Opts.basic_block_section_match_infer || Opts.propeller_match_bbid)
1159 if (Opts.basic_block_section_match_infer)
1161 else
1163 }
1164 addPass(llvm::createBasicBlockSectionsPass(SplitFunctionsWithPGO));
1165 }
1166
1168
1169 if (!Opts.disable_cfi_fixup && TM->Options.EnableCFIFixup)
1171
1173
1174 // Add passes that directly emit MI after all other MI passes.
1176
1177 AddingMachinePasses = false;
1178}
1179
1180/// Add passes that optimize machine instructions in SSA form.
1182 // Pre-ra tail duplication.
1184
1185 // Optimize PHIs before DCE: removing dead PHI cycles may make more
1186 // instructions dead.
1188
1189 // This pass merges large allocas. StackSlotColoring is a different pass
1190 // which merges spill slots.
1192
1193 // If the target requests it, assign local variables to stack slots relative
1194 // to one another and simplify frame index references where possible.
1196
1197 // With optimization, dead code should already be eliminated. However
1198 // there is one known exception: lowered code for arguments that are only
1199 // used by tail calls, where the tail calls reuse the incoming stack
1200 // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll).
1202
1203 // Allow targets to insert passes that improve instruction level parallelism,
1204 // like if-conversion. Such passes will typically need dominator trees and
1205 // loop info, just like LICM and CSE below.
1206 addILPOpts();
1207
1210
1212
1214 // Clean-up the dead code that may have been generated by peephole
1215 // rewriting.
1217}
1218
1219//===---------------------------------------------------------------------===//
1220/// Register Allocation Pass Configuration
1221//===---------------------------------------------------------------------===//
1222
1223/// A dummy default pass factory indicates whether the register allocator is
1224/// overridden on the command line.
1226
1227static RegisterRegAlloc
1229 "pick register allocator based on -O option",
1231
1236
1238 // An explicit -regalloc choice implies its pipeline: only the fast
1239 // allocator uses the unoptimized one.
1244 return Ctor !=
1247}
1248
1249/// Instantiate the default register allocator pass for this target for either
1250/// the optimized or unoptimized allocation path. This will be added to the pass
1251/// manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc
1252/// in the optimized case.
1253///
1254/// A target that uses the standard regalloc pass order for fast or optimized
1255/// allocation may still override this for per-target regalloc
1256/// selection. But -regalloc=... always takes precedence.
1258 if (Optimized)
1260 else
1262}
1263
1264/// Find and instantiate the register allocation pass requested by this target
1265/// at the current optimization level. Different register allocators are
1266/// defined as separate passes because they may require different analysis.
1267///
1268/// This helper ensures that the regalloc= option is always available,
1269/// even for targets that override the default allocator.
1270///
1271/// FIXME: When MachinePassRegistry register pass IDs instead of function ptrs,
1272/// this can be folded into addPass.
1274 // getOptimizeRegAlloc, called before the pipeline branches, has initialized
1275 // the global default.
1277 if (Ctor != useDefaultRegisterAllocator)
1278 return Ctor();
1279
1280 // With no -regalloc= override, ask the target for a regalloc pass.
1281 return createTargetRegisterAllocator(Optimized);
1282}
1283
1288
1293 "Must use fast (default) register allocator for unoptimized regalloc.");
1294
1296
1297 return true;
1298}
1299
1301 // Add the selected register allocation pass.
1303
1304 // Allow targets to change the register assignments before rewriting.
1305 addPreRewrite();
1306
1307 // Finally rewrite virtual registers.
1309
1310 // Regalloc scoring for ML-driven eviction - noop except when learning a new
1311 // eviction policy.
1313 return true;
1314}
1315
1316/// Return true if the default global register allocator is in use and
1317/// has not be overriden on the command line with '-regalloc=...'
1319 return RegAlloc.getNumOccurrences() == 0;
1320}
1321
1322/// Add the minimum set of target-independent passes that are required for
1323/// register allocation. No coalescing or scheduling.
1326 if (!TM->enableTiedFastRegAlloc())
1328
1330}
1331
1332/// Add standard target-independent passes that are tightly coupled with
1333/// optimized register allocation, including coalescing, machine instruction
1334/// scheduling, and register allocation itself.
1337
1339
1341
1342 // LiveIntervals requires pure SSA form and no unreachable blocks.
1343 // Explicit addition of UnreachableMachineBlockElim allows stopping before or
1344 // after it with -stop-before/-stop-after.
1346
1347 // Run SSA machine scheduler runs just before PHI elimination.
1351 }
1352
1353 // LiveIntervals is computed unconditionally before TwoAddressInstruction so
1354 // that pass can rely on it instead of LiveVariables. This is a step toward
1355 // removing LiveVariables entirely.
1357
1358 // Edge splitting is smarter with machine loop info.
1361
1364
1365 // The machine scheduler may accidentally create disconnected components
1366 // when moving subregister definitions around, avoid this by splitting them to
1367 // separate vregs before. Splitting can also improve reg. allocation quality.
1369
1370 // PreRA instruction scheduling.
1372
1374 // Perform stack slot coloring and post-ra machine LICM.
1376
1377 // Allow targets to expand pseudo instructions depending on the choice of
1378 // registers before MachineCopyPropagation.
1380
1381 // Copy propagate to forward register uses and try to eliminate COPYs that
1382 // were not coalesced.
1384
1385 // Run post-ra machine LICM to hoist reloads / remats.
1386 //
1387 // FIXME: can this move into MachineLateOptimization?
1389 }
1390}
1391
1392//===---------------------------------------------------------------------===//
1393/// Post RegAlloc Pass Configuration
1394//===---------------------------------------------------------------------===//
1395
1396/// Add passes that optimize machine instructions after register allocation.
1398 // Cleanup of redundant immediate/address loads.
1400
1401 // Branch folding must be run after regalloc and prolog/epilog insertion.
1403
1404 // Tail duplication.
1405 // Note that duplicating tail just increases code size and degrades
1406 // performance for targets that require Structured Control Flow.
1407 // In addition it can also make CFG irreducible. Thus we disable it.
1408 if (!TM->requiresStructuredCFG())
1410
1411 // Copy propagation.
1413}
1414
1415/// Add standard GC passes.
1418 return true;
1419}
1420
1421/// Add standard basic block placement passes.
1426 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1427 if (!ProfileFile.empty() && !Opts.disable_layout_fsprofile_loader)
1429 ProfileFile, getFSRemappingFile(Opts, TM),
1431 }
1433 // Run a separate pass to collect block placement statistics.
1434 if (Opts.enable_block_placement_stats)
1436 }
1437}
1438
1439//===---------------------------------------------------------------------===//
1440/// GlobalISel Configuration
1441//===---------------------------------------------------------------------===//
1443 return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable;
1444}
1445
1449
1450std::unique_ptr<CSEConfigBase> TargetPassConfig::getCSEConfig() const {
1451 return std::make_unique<CSEConfigBase>();
1452}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This is the interface for LLVM's primary stateless and local alias analysis.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
This file defines the DenseMap class.
static bool runOnFunction(Function &F, bool PostInlining)
This file contains an interface for creating legacy passes to print out IR in various granularities.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define P(N)
bool VerifyEach
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 llvm::once_flag InitializeDefaultRegisterAllocatorFlag
Register Allocation Pass Configuration.
static cl::opt< RegisterRegAlloc::FunctionPassCtor, false, RegisterPassParser< RegisterRegAlloc > > RegAlloc("regalloc", cl::Hidden, cl::init(&useDefaultRegisterAllocator), cl::desc("Register allocator to use"))
static FunctionPass * useDefaultRegisterAllocator()
-regalloc=... command line option.
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 const char StopBeforeOptName[]
static AnalysisID getPassIDFromName(StringRef PassName)
static std::string formatLimitReason(StringRef StartAfter, StringRef StartBefore, StringRef StopAfter, StringRef StopBefore)
static IdentifyingPassPtr overridePass(const CodeGenOptions &Opts, AnalysisID StandardID, IdentifyingPassPtr TargetID)
Allow standard passes to be disabled by the command line, regardless of who is adding the pass.
static std::pair< StringRef, unsigned > getPassNameAndInstanceNum(StringRef PassName)
static MachineVerifierMode computeMachineVerifierMode(const CodeGenOptions &Opts, bool VerifyEach)
static const CodeGenOptions & getOpts(const TargetMachine &TM)
static void initializeDefaultRegisterAllocatorOnce()
static std::string getFSRemappingFile(const CodeGenOptions &Opts, const TargetMachine *TM)
static const char StartBeforeOptName[]
static const PassInfo * getPassInfo(StringRef PassName)
static const char StartAfterOptName[]
Option names for limiting the codegen pipeline.
static IdentifyingPassPtr applyDisable(IdentifyingPassPtr PassID, bool Override)
Allow standard passes to be disabled by command line options.
#define DISABLE_PASS(Option, Name)
static RegisterRegAlloc defaultRegAlloc("default", "pick register allocator based on -O option", useDefaultRegisterAllocator)
static std::string getFSProfileFile(const CodeGenOptions &Opts, const TargetMachine *TM)
static cl::boolOrDefault toBoolOrDefault(BoolOrDefault B)
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:679
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:67
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
A type-erased reference to the IR unit a pass or analysis is running on, together with the kind of IR...
Definition IRUnitRef.h:60
Discriminated union of Pass ID types.
AnalysisID getID() const
ImmutablePass(char &pid)
Definition Pass.h:285
const cl::LibraryOptionsContext * LibraryOptions
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:29
const void * getTypeInfo() const
getTypeInfo - Return the id object for the pass... TODO : Rename
Definition PassInfo.h:62
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:97
static Pass * createPass(AnalysisID ID)
Definition Pass.cpp:224
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
Definition Pass.h:120
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.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition StringRef.h:490
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
Primary interface to the complete machine description for the target machine.
const std::optional< PGOOptions > & getPGOOption() const
TargetOptions Options
MCTargetOptions MCOptions
Machine level options.
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.
bool EnableSSAMachineScheduler
Enable insertion of SSAMachineScheduler pass, this triggers early computation of live intervals.
virtual void addCodeGenPrepare()
Add pass to prepare the LLVM IR for code generation.
virtual bool isMachinePipelinerEnabled() const
Return true if the MachinePipeliner should run before addPreRegAlloc by default.
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 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)
std::string getLimitedCodeGenPipelineReason() const
If hasLimitedCodeGenPipeline is true, this method returns a string with the name of the options that ...
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...
bool hasLimitedCodeGenPipeline() const
Returns true if one of the -start-after, -start-before, -stop-after or -stop-before options is set.
bool willCompleteCodeGenPipeline() const
Returns true if none of the -stop-before and -stop-after options is set.
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...
AnalysisID addPass(AnalysisID PassID)
Utilities for targets to add passes to the pass manager.
virtual void addPassesToHandleExceptions()
Add passes to lower exception handling for the code generator.
void addStripDebugPass()
Add a pass to remove debug info from the MIR.
static Expected< StartStopInfo > getStartStopInfo(const TargetMachine &TM, PassInstrumentationCallbacks &PIC)
Returns pass name in -stop-before or -stop-after NOTE: New pass manager migration only.
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.
TargetPassConfig(TargetMachine &TM, PassManagerBase &PM)
virtual void addISelPrepare()
Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
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.
MachineVerifierMode VerifyMode
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...
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:86
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.
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 * 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 FunctionPass * createWinEHPass()
createWinEHPass - Prepares personality functions used by MSVC on Windows, in addition to the Itanium ...
LLVM_ABI char & GCMachineCodeAnalysisID
GCMachineCodeAnalysis - Target-independent pass to mark safe points in machine code.
LLVM_ABI bool shouldEmitBBHash()
Returns whether -emit-bb-hash is set.
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 Pass * callDefaultCtor< TargetPassConfig >()
TargetPassConfig needs a TargetMachine; the pass registry cannot create one.
LLVM_ABI FunctionPass * createSafeStackPass()
This pass splits the stack into a safe stack and an unsafe stack to protect against stack-based overf...
LLVM_ABI ModulePass * createStaticDataAnnotatorLegacyPass()
createStaticDataAnnotatorPASS - This is a module pass that reads from StaticDataProfileInfoWrapperPas...
LLVM_ABI cl::opt< bool > EnableFSDiscriminator
LLVM_ABI MachineFunctionPass * createBasicBlockSectionsPass(bool SplitWithPGO=false)
createBasicBlockSections Pass - This pass assigns sections to machine basic blocks and is enabled wit...
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 FunctionPass * createPostInlineEntryExitInstrumenterPass()
LLVM_ABI MachineFunctionPass * createPrologEpilogInserterPass()
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 ModulePass * createStripDebugMachineModuleLegacyPass(bool OnlyDebugified)
Creates MIR Strip Debug pass.
LLVM_ABI char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
LLVM_ABI MachineFunctionPass * createResetMachineFunctionLegacyPass(bool EmitFallbackDiag, bool AbortOnFailedISel)
This pass resets a MachineFunction when it has the FailedISel property as if it was just created.
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 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 FunctionPass * createExpandIRInstsPass(CodeGenOptLevel)
LLVM_ABI char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
LLVM_ABI FunctionPass * createMachineVerifierPass(const std::string &Banner)
createMachineVerifierPass - This pass verifies cenerated machine code instructions for correctness.
LLVM_ABI ImmutablePass * createBasicBlockSectionsProfileReaderWrapperPass(const MemoryBuffer *Buf)
LLVM_ABI char & MachineLoopInfoID
MachineLoopInfo - This pass is a loop analysis pass.
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 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 * createLowerInvokePass()
LLVM_ABI FunctionPass * createRegUsageInfoCollector()
This pass is executed POST-RA to collect which physical registers are preserved by given machine func...
LLVM_ABI ImmutablePass * createScopedNoAliasAAWrapperPass()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
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 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:280
LLVM_ABI CGPassBuilderOption getCGPassBuilderOption(const TargetMachine &TM)
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 ModulePass * createLowerEmuTLSPass()
LowerEmuTLS - This pass generates __emutls_[vt].xyz variables for all TLS variables for the emulated ...
LLVM_ABI char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
LLVM_ABI ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
LLVM_ABI MachineFunctionPass * createInsertCodePrefetchPass()
createInsertCodePrefetchPass - This pass enables inserting code prefetch hints based on the basic blo...
LLVM_ABI char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
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 & SSAMachineSchedulerID
SSAMachineScheduler - This pass schedules machine instructions in SSA.
LLVM_ABI char & MachineCSELegacyID
MachineCSE - This pass performs global CSE on machine instructions.
LLVM_ABI ImmutablePass * createTypeBasedAAWrapperPass()
LLVM_ABI Pass * createLoopStrengthReducePass()
LLVM_ABI MachineFunctionPass * createMachineBlockHashInfoPass()
createMachineBlockHashInfoPass - This pass computes basic block hashes.
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.
LLVM_ABI MachineFunctionPass * createStaticDataSplitterLegacyPass()
createStaticDataSplitterPass - This is a machine-function pass that categorizes static data hotness u...
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()
@ SjLj
setjmp/longjmp based exceptions
Definition CodeGen.h:58
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:57
@ WinEH
Windows Exception Handling.
Definition CodeGen.h:60
@ Wasm
WebAssembly Exception Handling.
Definition CodeGen.h:61
LLVM_ABI char & StackColoringLegacyID
StackSlotColoring - This pass performs stack coloring and merging.
LLVM_ABI char & VirtRegRewriterID
VirtRegRewriter pass.
LLVM_ABI FunctionPass * createReplaceWithVeclibLegacyPass()
LLVM_ABI FunctionPass * createInlineAsmPreparePass()
LLVM_ABI char & FinalizeISelID
This pass expands pseudo-instructions, reserves registers and adjusts machine frame information.
constexpr bool valueOr(BoolOrDefault X, bool Default)
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 void initializeLibcallLoweringInfoWrapperPass(PassRegistry &)
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 MachineFunctionPass * createBasicBlockMatchingAndInferencePass()
createBasicBlockMatchingAndInferencePass - This pass enables matching and inference when using propel...
LLVM_ABI ModulePass * createCheckDebugMachineModuleLegacyPass()
Creates MIR Check Debug pass.
LLVM_ABI Pass * createCanonicalizeFreezeInLoopsPass()
LLVM_ABI char & LocalStackSlotAllocationID
LocalStackSlotAllocation - This pass assigns local frame indices to stack slots relative to one anoth...
MachineVerifierMode
Specify where the machine verifier runs in the codegen pipeline.
Definition CodeGen.h:316
@ Each
Run the machine verifier before and after every machine pass.
Definition CodeGen.h:322
@ None
Never run the machine verifier.
Definition CodeGen.h:318
@ End
Run the machine verifier once, at the end of the pipeline.
Definition CodeGen.h:320
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 FunctionPass * createCFIFixupLegacy()
Creates CFI Fixup 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 MachineFunctionPass * createGCEmptyBasicBlocksLegacyPass()
createGCEmptyBasicblocksPass - Empty basic blocks (basic blocks without real code) appear as the resu...
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 void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Definition Error.cpp:177
InsertedPass(AnalysisID TargetPassID, IdentifyingPassPtr InsertedPassID)
std::optional< bool > EnableIPRA
cl::boolOrDefault EnableGlobalISelOption
cl::boolOrDefault EnableFastISelOption
cl::boolOrDefault EnableMachinePipeliner
cl::boolOrDefault EnableRegAllocFastTied
MachineVerifierMode VerifyMachineCode
cl::boolOrDefault DebugifyCheckAndStripAll
std::optional< GlobalISelAbortMode > EnableGlobalISelAbort
cl::boolOrDefault DebugifyAndStripAll
A utility class that uses RAII to save and restore the value of a variable.
LLVM_ABI std::string getLimitReason() const
Returns the names of the options that set the start and stop passes.
The llvm::once_flag structure.
Definition Threading.h:67