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"
31#include "llvm/CodeGen/Passes.h"
36#include "llvm/IR/Verifier.h"
38#include "llvm/MC/MCAsmInfo.h"
40#include "llvm/Pass.h"
44#include "llvm/Support/Debug.h"
56#include <cassert>
57#include <optional>
58#include <string>
59
60using namespace llvm;
61
62static const CodeGenOptions &getOpts(const TargetMachine &TM) {
65}
66
67namespace {
68class TriggerCrashFunctionLegacyPass : public FunctionPass {
69public:
70 static char ID;
71 TriggerCrashFunctionLegacyPass() : FunctionPass(ID) {}
72 bool runOnFunction(Function &F) override {
73 abort();
74 return false;
75 }
76 StringRef getPassName() const override { return "TriggerCrashFunctionPass"; }
77};
78} // namespace
79
80char TriggerCrashFunctionLegacyPass::ID = 0;
81
82// Enable or disable the MachineOutliner.
84 "enable-machine-outliner", cl::desc("Enable the machine outliner"),
88 "Run on all functions guaranteed to be beneficial"),
89 clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo",
90 "Outline cold code only. If a code block does not have "
91 "profile data, optimistically assume it is cold."),
92 clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo",
93 "Outline cold code only. If a code block does not have "
94 "profile, data, conservatively assume it is hot."),
95 clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"),
96 // Sentinel value for unspecified option.
98
99/// Option names for limiting the codegen pipeline.
100/// Those are used in error reporting and we didn't want
101/// to duplicate their names all over the place.
102static const char StartAfterOptName[] = "start-after";
103static const char StartBeforeOptName[] = "start-before";
104static const char StopAfterOptName[] = "stop-after";
105static const char StopBeforeOptName[] = "stop-before";
106
107/// Allow standard passes to be disabled by command line options. This supports
108/// simple binary flags that either suppress the pass or do nothing.
109/// i.e. -disable-mypass=false has no effect.
110/// These should be converted to boolOrDefault in order to use applyOverride.
112 bool Override) {
113 if (Override)
114 return IdentifyingPassPtr();
115 return PassID;
116}
117
118/// Allow standard passes to be disabled by the command line, regardless of who
119/// is adding the pass.
120///
121/// StandardID is the pass identified in the standard pass pipeline and provided
122/// to addPass(). It may be a target-specific ID in the case that the target
123/// directly adds its own pass, but in that case we harmlessly fall through.
124///
125/// TargetID is the pass that the target has configured to override StandardID.
126///
127/// StandardID may be a pseudo ID. In that case TargetID is the name of the real
128/// pass to run. This allows multiple options to control a single pass depending
129/// on where in the pipeline that pass is added.
130static IdentifyingPassPtr overridePass(const CodeGenOptions &Opts,
131 AnalysisID StandardID,
132 IdentifyingPassPtr TargetID) {
133 if (StandardID == &PostRASchedulerID)
134 return applyDisable(TargetID, Opts.disable_post_ra);
135
136 if (StandardID == &BranchFolderPassID)
137 return applyDisable(TargetID, Opts.disable_branch_fold);
138
139 if (StandardID == &TailDuplicateLegacyID)
140 return applyDisable(TargetID, Opts.disable_tail_duplicate);
141
142 if (StandardID == &EarlyTailDuplicateLegacyID)
143 return applyDisable(TargetID, Opts.disable_early_taildup);
144
145 if (StandardID == &MachineBlockPlacementID)
146 return applyDisable(TargetID, Opts.disable_block_placement);
147
148 if (StandardID == &StackSlotColoringID)
149 return applyDisable(TargetID, Opts.disable_ssc);
150
151 if (StandardID == &DeadMachineInstructionElimID)
152 return applyDisable(TargetID, Opts.disable_machine_dce);
153
154 if (StandardID == &EarlyIfConverterLegacyID)
155 return applyDisable(TargetID, Opts.disable_early_ifcvt);
156
157 if (StandardID == &EarlyMachineLICMID)
158 return applyDisable(TargetID, Opts.disable_machine_licm);
159
160 if (StandardID == &MachineCSELegacyID)
161 return applyDisable(TargetID, Opts.disable_machine_cse);
162
163 if (StandardID == &MachineLICMID)
164 return applyDisable(TargetID, Opts.disable_postra_machine_licm);
165
166 if (StandardID == &MachineSinkingLegacyID)
167 return applyDisable(TargetID, Opts.disable_machine_sink);
168
169 if (StandardID == &PostRAMachineSinkingID)
170 return applyDisable(TargetID, Opts.disable_postra_machine_sink);
171
172 if (StandardID == &MachineCopyPropagationID)
173 return applyDisable(TargetID, Opts.disable_copyprop);
174
175 return TargetID;
176}
177
178// Find the FSProfile file name. The internal option takes the precedence
179// before getting from TargetMachine.
180static std::string getFSProfileFile(const CodeGenOptions &Opts,
181 const TargetMachine *TM) {
182 if (!Opts.fs_profile_file.empty())
183 return Opts.fs_profile_file.str();
184 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
185 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
186 return std::string();
187 return PGOOpt->ProfileFile;
188}
189
190// Find the Profile remapping file name. The internal option takes the
191// precedence before getting from TargetMachine.
192static std::string getFSRemappingFile(const CodeGenOptions &Opts,
193 const TargetMachine *TM) {
194 if (!Opts.fs_remapping_file.empty())
195 return Opts.fs_remapping_file.str();
196 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
197 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
198 return std::string();
199 return PGOOpt->ProfileRemappingFile;
200}
201
202//===---------------------------------------------------------------------===//
203/// TargetPassConfig
204//===---------------------------------------------------------------------===//
205
206INITIALIZE_PASS(TargetPassConfig, "targetpassconfig",
207 "Target Pass Configuration", false, false)
208char TargetPassConfig::ID = 0;
209
210namespace {
211
215
218
220 assert(InsertedPassID.isValid() && "Illegal Pass ID!");
221 if (InsertedPassID.isInstance())
222 return InsertedPassID.getInstance();
223 Pass *NP = Pass::createPass(InsertedPassID.getID());
224 assert(NP && "Pass ID not registered");
225 return NP;
226 }
227};
228
229} // end anonymous namespace
230
231namespace llvm {
232
234public:
235 // List of passes explicitly substituted by this target. Normally this is
236 // empty, but it is a convenient way to suppress or replace specific passes
237 // that are part of a standard pass pipeline without overridding the entire
238 // pipeline. This mechanism allows target options to inherit a standard pass's
239 // user interface. For example, a target may disable a standard pass by
240 // default by substituting a pass ID of zero, and the user may still enable
241 // that standard pass with an explicit command line option.
243
244 /// Store the pairs of <AnalysisID, AnalysisID> of which the second pass
245 /// is inserted after each instance of the first one.
247};
248
249} // end namespace llvm
250
251// Out of line virtual method.
255
257 if (PassName.empty())
258 return nullptr;
259
261 const PassInfo *PI = PR.getPassInfo(PassName);
262 if (!PI)
264 Twine("\" pass is not registered."));
265 return PI;
266}
267
269 const PassInfo *PI = getPassInfo(PassName);
270 return PI ? PI->getTypeInfo() : nullptr;
271}
272
273static std::pair<StringRef, unsigned>
275 StringRef Name, InstanceNumStr;
276 std::tie(Name, InstanceNumStr) = PassName.split(',');
277
278 unsigned InstanceNum = 0;
279 if (!InstanceNumStr.empty() && InstanceNumStr.getAsInteger(10, InstanceNum))
280 reportFatalUsageError("invalid pass instance specifier " + PassName);
281
282 return std::make_pair(Name, InstanceNum);
283}
284
285void TargetPassConfig::setStartStopPasses() {
286 StringRef StartBeforeName;
287 std::tie(StartBeforeName, StartBeforeInstanceNum) =
288 getPassNameAndInstanceNum(Opts.start_before);
289
290 StringRef StartAfterName;
291 std::tie(StartAfterName, StartAfterInstanceNum) =
292 getPassNameAndInstanceNum(Opts.start_after);
293
294 StringRef StopBeforeName;
295 std::tie(StopBeforeName, StopBeforeInstanceNum) =
296 getPassNameAndInstanceNum(Opts.stop_before);
297
298 StringRef StopAfterName;
299 std::tie(StopAfterName, StopAfterInstanceNum) =
300 getPassNameAndInstanceNum(Opts.stop_after);
301
302 StartBefore = getPassIDFromName(StartBeforeName);
303 StartAfter = getPassIDFromName(StartAfterName);
304 StopBefore = getPassIDFromName(StopBeforeName);
305 StopAfter = getPassIDFromName(StopAfterName);
306 if (StartBefore && StartAfter)
307 reportFatalUsageError(Twine(StartBeforeOptName) + Twine(" and ") +
308 Twine(StartAfterOptName) + Twine(" specified!"));
309 if (StopBefore && StopAfter)
310 reportFatalUsageError(Twine(StopBeforeOptName) + Twine(" and ") +
311 Twine(StopAfterOptName) + Twine(" specified!"));
312 Started = (StartAfter == nullptr) && (StartBefore == nullptr);
313}
314
321
323computeMachineVerifierMode(const CodeGenOptions &Opts, bool VerifyEach) {
324 if (VerifyEach)
326 return Opts.disable_mir_output_verify ? MachineVerifierMode::None
328}
329
331 const CodeGenOptions &Opts = getOpts(TM);
333 Opt.EnableGlobalISelAbort = Opts.global_isel_abort;
334 if (Opts.enable_ipra != BoolOrDefault::Default)
335 Opt.EnableIPRA = Opts.enable_ipra == BoolOrDefault::True;
336 Opt.EnableFastISelOption = toBoolOrDefault(Opts.fast_isel);
337 Opt.EnableRegAllocFastTied = toBoolOrDefault(Opts.regalloc_fast_tied);
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
1000 // Run pre-ra passes.
1002
1003 // Debugifying the register allocator passes seems to provoke some
1004 // non-determinism that affects CodeGen and there doesn't seem to be a point
1005 // where it becomes safe again so stop debugifying here.
1006 DebugifyIsSafe = false;
1007
1008 // Add a FSDiscriminator pass right before RA, so that we could get
1009 // more precise SampleFDO profile for RA.
1013 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1014 if (!ProfileFile.empty() && !Opts.disable_ra_fsprofile_loader)
1016 ProfileFile, getFSRemappingFile(Opts, TM),
1018 }
1019
1020 // Run register allocation and passes that are tightly coupled with it,
1021 // including phi elimination and scheduling.
1022 if (getOptimizeRegAlloc())
1024 else
1026
1027 // Run post-ra passes.
1029
1031
1033
1034 // Insert prolog/epilog code. Eliminate abstract frame index references...
1038 }
1039
1040 // Prolog/Epilog inserter needs a TargetMachine to instantiate. But only
1041 // do so if it hasn't been disabled, substituted, or overridden.
1044
1045 /// Add passes that optimize machine instructions after register allocation.
1048
1049 // Expand pseudo instructions before second scheduling pass.
1051
1052 // Run pre-sched2 passes.
1053 addPreSched2();
1054
1055 if (Opts.enable_implicit_null_checks)
1057
1058 // Second pass scheduler.
1059 // Let Target optionally insert this pass by itself at some other
1060 // point.
1062 !TM->targetSchedulesPostRAScheduling()) {
1063 if (Opts.misched_postra)
1065 else
1067 }
1068
1069 // GC
1070 addGCPasses();
1071
1072 // Basic block placement.
1075
1076 // Insert before XRay Instrumentation.
1078
1081
1083
1084 if (TM->Options.EnableIPRA)
1085 // Collect register usage information and produce a register mask of
1086 // clobbered registers, to be used to optimize call sites.
1088
1089 // FIXME: Some backends are incompatible with running the verifier after
1090 // addPreEmitPass. Maybe only pass "false" here for those targets?
1092
1097
1098 if (TM->Options.EnableMachineOutliner &&
1102 TM->supportsDefaultOutlining())
1104 }
1105
1106 if (Opts.enable_gc_empty_basic_blocks)
1108
1112
1113 const bool SplitFunctionsWithPGO =
1114 TM->Options.FunctionSplitting == FunctionSplittingMode::All;
1115
1116 if (SplitFunctionsWithPGO || Opts.split_static_data ||
1117 TM->Options.EnableStaticDataPartitioning) {
1118 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1119 if (!ProfileFile.empty()) {
1122 ProfileFile, getFSRemappingFile(Opts, TM),
1124 } else {
1125 // Sample profile is given, but FSDiscriminator is not
1126 // enabled, this may result in performance regression.
1128 << "Using AutoFDO without FSDiscriminator for MFS may regress "
1129 "performance.\n";
1130 }
1131 }
1132 }
1133
1134 if (Opts.split_static_data || TM->Options.EnableStaticDataPartitioning) {
1135 // The static data splitter pass is a machine function pass. and
1136 // static data annotator pass is a module-wide pass. See the file comment
1137 // in StaticDataAnnotator.cpp for the motivation.
1140 }
1141 // We run the BasicBlockSections pass if we need BB sections, BB address map,
1142 // or function splitting. With function splitting, functions which are
1143 // eligible for basic-block-sections optimizations (`=all`, or `=list=` with
1144 // function included in the list profile) get that optimization, and the other
1145 // functions are split using their PGO/AutoFDO profile.
1146 if (TM->getBBSectionsType() != llvm::BasicBlockSection::None ||
1147 TM->Options.BBAddrMap || SplitFunctionsWithPGO) {
1148 if (shouldEmitBBHash() || Opts.basic_block_section_match_infer)
1150 if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) {
1152 TM->getBBSectionsFuncListBuf()));
1153 if (!Opts.basic_block_section_match_infer || PropellerMatchBBID)
1155 if (Opts.basic_block_section_match_infer)
1157 else
1159 }
1160 addPass(llvm::createBasicBlockSectionsPass(SplitFunctionsWithPGO));
1161 }
1162
1164
1165 if (!Opts.disable_cfi_fixup && TM->Options.EnableCFIFixup)
1167
1169
1170 // Add passes that directly emit MI after all other MI passes.
1172
1173 AddingMachinePasses = false;
1174}
1175
1176/// Add passes that optimize machine instructions in SSA form.
1178 // Pre-ra tail duplication.
1180
1181 // Optimize PHIs before DCE: removing dead PHI cycles may make more
1182 // instructions dead.
1184
1185 // This pass merges large allocas. StackSlotColoring is a different pass
1186 // which merges spill slots.
1188
1189 // If the target requests it, assign local variables to stack slots relative
1190 // to one another and simplify frame index references where possible.
1192
1193 // With optimization, dead code should already be eliminated. However
1194 // there is one known exception: lowered code for arguments that are only
1195 // used by tail calls, where the tail calls reuse the incoming stack
1196 // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll).
1198
1199 // Allow targets to insert passes that improve instruction level parallelism,
1200 // like if-conversion. Such passes will typically need dominator trees and
1201 // loop info, just like LICM and CSE below.
1202 addILPOpts();
1203
1206
1208
1210 // Clean-up the dead code that may have been generated by peephole
1211 // rewriting.
1213}
1214
1215//===---------------------------------------------------------------------===//
1216/// Register Allocation Pass Configuration
1217//===---------------------------------------------------------------------===//
1218
1219/// A dummy default pass factory indicates whether the register allocator is
1220/// overridden on the command line.
1222
1223static RegisterRegAlloc
1225 "pick register allocator based on -O option",
1227
1232
1234 // An explicit -regalloc choice implies its pipeline: only the fast
1235 // allocator uses the unoptimized one.
1240 return Ctor !=
1243}
1244
1245/// Instantiate the default register allocator pass for this target for either
1246/// the optimized or unoptimized allocation path. This will be added to the pass
1247/// manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc
1248/// in the optimized case.
1249///
1250/// A target that uses the standard regalloc pass order for fast or optimized
1251/// allocation may still override this for per-target regalloc
1252/// selection. But -regalloc=... always takes precedence.
1254 if (Optimized)
1256 else
1258}
1259
1260/// Find and instantiate the register allocation pass requested by this target
1261/// at the current optimization level. Different register allocators are
1262/// defined as separate passes because they may require different analysis.
1263///
1264/// This helper ensures that the regalloc= option is always available,
1265/// even for targets that override the default allocator.
1266///
1267/// FIXME: When MachinePassRegistry register pass IDs instead of function ptrs,
1268/// this can be folded into addPass.
1270 // getOptimizeRegAlloc, called before the pipeline branches, has initialized
1271 // the global default.
1273 if (Ctor != useDefaultRegisterAllocator)
1274 return Ctor();
1275
1276 // With no -regalloc= override, ask the target for a regalloc pass.
1277 return createTargetRegisterAllocator(Optimized);
1278}
1279
1284
1289 "Must use fast (default) register allocator for unoptimized regalloc.");
1290
1292
1293 return true;
1294}
1295
1297 // Add the selected register allocation pass.
1299
1300 // Allow targets to change the register assignments before rewriting.
1301 addPreRewrite();
1302
1303 // Finally rewrite virtual registers.
1305
1306 // Regalloc scoring for ML-driven eviction - noop except when learning a new
1307 // eviction policy.
1309 return true;
1310}
1311
1312/// Return true if the default global register allocator is in use and
1313/// has not be overriden on the command line with '-regalloc=...'
1315 return RegAlloc.getNumOccurrences() == 0;
1316}
1317
1318/// Add the minimum set of target-independent passes that are required for
1319/// register allocation. No coalescing or scheduling.
1322 if (!TM->enableTiedFastRegAlloc())
1324
1326}
1327
1328/// Add standard target-independent passes that are tightly coupled with
1329/// optimized register allocation, including coalescing, machine instruction
1330/// scheduling, and register allocation itself.
1333
1335
1337
1338 // LiveIntervals requires pure SSA form and no unreachable blocks.
1339 // Explicit addition of UnreachableMachineBlockElim allows stopping before or
1340 // after it with -stop-before/-stop-after.
1342
1343 // Run SSA machine scheduler runs just before PHI elimination.
1347 }
1348
1349 // LiveIntervals is computed unconditionally before TwoAddressInstruction so
1350 // that pass can rely on it instead of LiveVariables. This is a step toward
1351 // removing LiveVariables entirely.
1353
1354 // Edge splitting is smarter with machine loop info.
1357
1360
1361 // The machine scheduler may accidentally create disconnected components
1362 // when moving subregister definitions around, avoid this by splitting them to
1363 // separate vregs before. Splitting can also improve reg. allocation quality.
1365
1366 // PreRA instruction scheduling.
1368
1370 // Perform stack slot coloring and post-ra machine LICM.
1372
1373 // Allow targets to expand pseudo instructions depending on the choice of
1374 // registers before MachineCopyPropagation.
1376
1377 // Copy propagate to forward register uses and try to eliminate COPYs that
1378 // were not coalesced.
1380
1381 // Run post-ra machine LICM to hoist reloads / remats.
1382 //
1383 // FIXME: can this move into MachineLateOptimization?
1385 }
1386}
1387
1388//===---------------------------------------------------------------------===//
1389/// Post RegAlloc Pass Configuration
1390//===---------------------------------------------------------------------===//
1391
1392/// Add passes that optimize machine instructions after register allocation.
1394 // Cleanup of redundant immediate/address loads.
1396
1397 // Branch folding must be run after regalloc and prolog/epilog insertion.
1399
1400 // Tail duplication.
1401 // Note that duplicating tail just increases code size and degrades
1402 // performance for targets that require Structured Control Flow.
1403 // In addition it can also make CFG irreducible. Thus we disable it.
1404 if (!TM->requiresStructuredCFG())
1406
1407 // Copy propagation.
1409}
1410
1411/// Add standard GC passes.
1414 return true;
1415}
1416
1417/// Add standard basic block placement passes.
1422 const std::string ProfileFile = getFSProfileFile(Opts, TM);
1423 if (!ProfileFile.empty() && !Opts.disable_layout_fsprofile_loader)
1425 ProfileFile, getFSRemappingFile(Opts, TM),
1427 }
1429 // Run a separate pass to collect block placement statistics.
1430 if (Opts.enable_block_placement_stats)
1432 }
1433}
1434
1435//===---------------------------------------------------------------------===//
1436/// GlobalISel Configuration
1437//===---------------------------------------------------------------------===//
1439 return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable;
1440}
1441
1445
1446std::unique_ptr<CSEConfigBase> TargetPassConfig::getCSEConfig() const {
1447 return std::make_unique<CSEConfigBase>();
1448}
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.
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:227
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 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 cl::opt< bool > PropellerMatchBBID
Whether to match basic blocks using BBIDs instead of hashes for Propeller inference.
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:263
@ Each
Run the machine verifier before and after every machine pass.
Definition CodeGen.h:269
@ None
Never run the machine verifier.
Definition CodeGen.h:265
@ End
Run the machine verifier once, at the end of the pipeline.
Definition CodeGen.h:267
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 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