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
61namespace {
62class TriggerCrashFunctionLegacyPass : public FunctionPass {
63public:
64 static char ID;
65 TriggerCrashFunctionLegacyPass() : FunctionPass(ID) {}
66 bool runOnFunction(Function &F) override {
67 abort();
68 return false;
69 }
70 StringRef getPassName() const override { return "TriggerCrashFunctionPass"; }
71};
72} // namespace
73
74char TriggerCrashFunctionLegacyPass::ID = 0;
75
76// Enable or disable the MachineOutliner.
78 "enable-machine-outliner", cl::desc("Enable the machine outliner"),
82 "Run on all functions guaranteed to be beneficial"),
83 clEnumValN(RunOutliner::OptimisticPGO, "optimistic-pgo",
84 "Outline cold code only. If a code block does not have "
85 "profile data, optimistically assume it is cold."),
86 clEnumValN(RunOutliner::ConservativePGO, "conservative-pgo",
87 "Outline cold code only. If a code block does not have "
88 "profile, data, conservatively assume it is hot."),
89 clEnumValN(RunOutliner::NeverOutline, "never", "Disable all outlining"),
90 // Sentinel value for unspecified option.
92
93/// Option names for limiting the codegen pipeline.
94/// Those are used in error reporting and we didn't want
95/// to duplicate their names all over the place.
96static const char StartAfterOptName[] = "start-after";
97static const char StartBeforeOptName[] = "start-before";
98static const char StopAfterOptName[] = "stop-after";
99static const char StopBeforeOptName[] = "stop-before";
100
101/// Allow standard passes to be disabled by command line options. This supports
102/// simple binary flags that either suppress the pass or do nothing.
103/// i.e. -disable-mypass=false has no effect.
104/// These should be converted to boolOrDefault in order to use applyOverride.
106 bool Override) {
107 if (Override)
108 return IdentifyingPassPtr();
109 return PassID;
110}
111
112/// Allow standard passes to be disabled by the command line, regardless of who
113/// is adding the pass.
114///
115/// StandardID is the pass identified in the standard pass pipeline and provided
116/// to addPass(). It may be a target-specific ID in the case that the target
117/// directly adds its own pass, but in that case we harmlessly fall through.
118///
119/// TargetID is the pass that the target has configured to override StandardID.
120///
121/// StandardID may be a pseudo ID. In that case TargetID is the name of the real
122/// pass to run. This allows multiple options to control a single pass depending
123/// on where in the pipeline that pass is added.
125 IdentifyingPassPtr TargetID) {
126 const CodeGenOptions &Opts = CodeGenOptions::Global;
127 if (StandardID == &PostRASchedulerID)
128 return applyDisable(TargetID, Opts.disable_post_ra);
129
130 if (StandardID == &BranchFolderPassID)
131 return applyDisable(TargetID, Opts.disable_branch_fold);
132
133 if (StandardID == &TailDuplicateLegacyID)
134 return applyDisable(TargetID, Opts.disable_tail_duplicate);
135
136 if (StandardID == &EarlyTailDuplicateLegacyID)
137 return applyDisable(TargetID, Opts.disable_early_taildup);
138
139 if (StandardID == &MachineBlockPlacementID)
140 return applyDisable(TargetID, Opts.disable_block_placement);
141
142 if (StandardID == &StackSlotColoringID)
143 return applyDisable(TargetID, Opts.disable_ssc);
144
145 if (StandardID == &DeadMachineInstructionElimID)
146 return applyDisable(TargetID, Opts.disable_machine_dce);
147
148 if (StandardID == &EarlyIfConverterLegacyID)
149 return applyDisable(TargetID, Opts.disable_early_ifcvt);
150
151 if (StandardID == &EarlyMachineLICMID)
152 return applyDisable(TargetID, Opts.disable_machine_licm);
153
154 if (StandardID == &MachineCSELegacyID)
155 return applyDisable(TargetID, Opts.disable_machine_cse);
156
157 if (StandardID == &MachineLICMID)
158 return applyDisable(TargetID, Opts.disable_postra_machine_licm);
159
160 if (StandardID == &MachineSinkingLegacyID)
161 return applyDisable(TargetID, Opts.disable_machine_sink);
162
163 if (StandardID == &PostRAMachineSinkingID)
164 return applyDisable(TargetID, Opts.disable_postra_machine_sink);
165
166 if (StandardID == &MachineCopyPropagationID)
167 return applyDisable(TargetID, Opts.disable_copyprop);
168
169 return TargetID;
170}
171
172// Find the FSProfile file name. The internal option takes the precedence
173// before getting from TargetMachine.
174static std::string getFSProfileFile(const TargetMachine *TM) {
175 const CodeGenOptions &Opts = CodeGenOptions::Global;
176 if (!Opts.fs_profile_file.empty())
177 return Opts.fs_profile_file.str();
178 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
179 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
180 return std::string();
181 return PGOOpt->ProfileFile;
182}
183
184// Find the Profile remapping file name. The internal option takes the
185// precedence before getting from TargetMachine.
186static std::string getFSRemappingFile(const TargetMachine *TM) {
187 const CodeGenOptions &Opts = CodeGenOptions::Global;
188 if (!Opts.fs_remapping_file.empty())
189 return Opts.fs_remapping_file.str();
190 const std::optional<PGOOptions> &PGOOpt = TM->getPGOOption();
191 if (PGOOpt == std::nullopt || PGOOpt->Action != PGOOptions::SampleUse)
192 return std::string();
193 return PGOOpt->ProfileRemappingFile;
194}
195
196//===---------------------------------------------------------------------===//
197/// TargetPassConfig
198//===---------------------------------------------------------------------===//
199
200INITIALIZE_PASS(TargetPassConfig, "targetpassconfig",
201 "Target Pass Configuration", false, false)
202char TargetPassConfig::ID = 0;
203
204namespace {
205
209
212
214 assert(InsertedPassID.isValid() && "Illegal Pass ID!");
215 if (InsertedPassID.isInstance())
216 return InsertedPassID.getInstance();
217 Pass *NP = Pass::createPass(InsertedPassID.getID());
218 assert(NP && "Pass ID not registered");
219 return NP;
220 }
221};
222
223} // end anonymous namespace
224
225namespace llvm {
226
228public:
229 // List of passes explicitly substituted by this target. Normally this is
230 // empty, but it is a convenient way to suppress or replace specific passes
231 // that are part of a standard pass pipeline without overridding the entire
232 // pipeline. This mechanism allows target options to inherit a standard pass's
233 // user interface. For example, a target may disable a standard pass by
234 // default by substituting a pass ID of zero, and the user may still enable
235 // that standard pass with an explicit command line option.
237
238 /// Store the pairs of <AnalysisID, AnalysisID> of which the second pass
239 /// is inserted after each instance of the first one.
241};
242
243} // end namespace llvm
244
245// Out of line virtual method.
249
251 if (PassName.empty())
252 return nullptr;
253
255 const PassInfo *PI = PR.getPassInfo(PassName);
256 if (!PI)
258 Twine("\" pass is not registered."));
259 return PI;
260}
261
263 const PassInfo *PI = getPassInfo(PassName);
264 return PI ? PI->getTypeInfo() : nullptr;
265}
266
267static std::pair<StringRef, unsigned>
269 StringRef Name, InstanceNumStr;
270 std::tie(Name, InstanceNumStr) = PassName.split(',');
271
272 unsigned InstanceNum = 0;
273 if (!InstanceNumStr.empty() && InstanceNumStr.getAsInteger(10, InstanceNum))
274 reportFatalUsageError("invalid pass instance specifier " + PassName);
275
276 return std::make_pair(Name, InstanceNum);
277}
278
279void TargetPassConfig::setStartStopPasses() {
280 const CodeGenOptions &Opts = CodeGenOptions::Global;
281 StringRef StartBeforeName;
282 std::tie(StartBeforeName, StartBeforeInstanceNum) =
283 getPassNameAndInstanceNum(Opts.start_before);
284
285 StringRef StartAfterName;
286 std::tie(StartAfterName, StartAfterInstanceNum) =
287 getPassNameAndInstanceNum(Opts.start_after);
288
289 StringRef StopBeforeName;
290 std::tie(StopBeforeName, StopBeforeInstanceNum) =
291 getPassNameAndInstanceNum(Opts.stop_before);
292
293 StringRef StopAfterName;
294 std::tie(StopAfterName, StopAfterInstanceNum) =
295 getPassNameAndInstanceNum(Opts.stop_after);
296
297 StartBefore = getPassIDFromName(StartBeforeName);
298 StartAfter = getPassIDFromName(StartAfterName);
299 StopBefore = getPassIDFromName(StopBeforeName);
300 StopAfter = getPassIDFromName(StopAfterName);
301 if (StartBefore && StartAfter)
302 reportFatalUsageError(Twine(StartBeforeOptName) + Twine(" and ") +
303 Twine(StartAfterOptName) + Twine(" specified!"));
304 if (StopBefore && StopAfter)
305 reportFatalUsageError(Twine(StopBeforeOptName) + Twine(" and ") +
306 Twine(StopAfterOptName) + Twine(" specified!"));
307 Started = (StartAfter == nullptr) && (StartBefore == nullptr);
308}
309
316
318computeMachineVerifierMode(const CodeGenOptions &Opts, bool VerifyEach) {
319 if (VerifyEach)
321 return Opts.disable_mir_output_verify ? MachineVerifierMode::None
323}
324
326 const CodeGenOptions &Opts = CodeGenOptions::Global;
328 Opt.EnableGlobalISelAbort = Opts.global_isel_abort;
329 if (Opts.enable_ipra != BoolOrDefault::Default)
330 Opt.EnableIPRA = Opts.enable_ipra == BoolOrDefault::True;
331 Opt.EnableFastISelOption = toBoolOrDefault(Opts.fast_isel);
332 Opt.EnableRegAllocFastTied = toBoolOrDefault(Opts.regalloc_fast_tied);
333 Opt.EnableGlobalISelOption = toBoolOrDefault(Opts.global_isel);
335 Opts, valueOr(Opts.verify_machineinstrs, false));
337 Opts.disable_atexit_based_global_dtor_lowering;
338 Opt.DisableExpandReductions = Opts.disable_expand_reductions;
339 Opt.PrintAfterISel = Opts.print_after_isel;
340 Opt.FSProfileFile = Opts.fs_profile_file.str();
341 Opt.EnableGCEmptyBlocks = Opts.enable_gc_empty_basic_blocks;
342 Opt.EnableBlockPlacementStats = Opts.enable_block_placement_stats;
343 Opt.EnableGlobalMergeFunc = Opts.enable_global_merge_func;
344 Opt.EnableImplicitNullChecks = Opts.enable_implicit_null_checks;
346 Opt.MISchedPostRA = Opts.misched_postra;
347 Opt.DisableLSR = Opts.disable_lsr;
348 Opt.DisableConstantHoisting = Opts.disable_constant_hoisting;
349 Opt.DisableCGP = Opts.disable_cgp;
350 Opt.DisablePartialLibcallInlining = Opts.disable_partial_libcall_inlining;
351 Opt.DisableSelectOptimize = Opts.disable_select_optimize;
352 Opt.PrintISelInput = Opts.print_isel_input;
353 Opt.PrintRegUsage = Opts.print_regusage;
354 Opt.DebugifyAndStripAll = toBoolOrDefault(Opts.debugify_and_strip_all_safe);
356 toBoolOrDefault(Opts.debugify_check_and_strip_all_safe);
357 Opt.DisableRAFSProfileLoader = Opts.disable_ra_fsprofile_loader;
358 Opt.DisableCFIFixup = Opts.disable_cfi_fixup;
359 return Opt;
360}
361
363 TargetMachine &TM) {
364
365 // Register a callback for disabling passes.
366 PIC.registerShouldRunOptionalPassCallback([](StringRef P, IRUnitRef) {
367 const CodeGenOptions &Opts = CodeGenOptions::Global;
368
369#define DISABLE_PASS(Option, Name) \
370 if (Option && P.contains(#Name)) \
371 return false;
372 DISABLE_PASS(Opts.disable_block_placement, MachineBlockPlacementPass)
373 DISABLE_PASS(Opts.disable_branch_fold, BranchFolderPass)
374 DISABLE_PASS(Opts.disable_copyprop, MachineCopyPropagationPass)
375 DISABLE_PASS(Opts.disable_early_ifcvt, EarlyIfConverterLegacyPass)
376 DISABLE_PASS(Opts.disable_early_taildup, EarlyTailDuplicatePass)
377 DISABLE_PASS(Opts.disable_machine_cse, MachineCSELegacyPass)
378 DISABLE_PASS(Opts.disable_machine_dce, DeadMachineInstructionElimPass)
379 DISABLE_PASS(Opts.disable_machine_licm, EarlyMachineLICMPass)
380 DISABLE_PASS(Opts.disable_machine_sink, MachineSinkingPass)
381 DISABLE_PASS(Opts.disable_postra_machine_licm, MachineLICMPass)
382 DISABLE_PASS(Opts.disable_postra_machine_sink, PostRAMachineSinkingPass)
383 DISABLE_PASS(Opts.disable_post_ra, PostRASchedulerPass)
384 DISABLE_PASS(Opts.disable_ssc, StackSlotColoringPass)
385 DISABLE_PASS(Opts.disable_tail_duplicate, TailDuplicatePass)
386
387 return true;
388 });
389}
390
393 const CodeGenOptions &Opts = CodeGenOptions::Global;
394 auto [StartBefore, StartBeforeInstanceNum] =
395 getPassNameAndInstanceNum(Opts.start_before);
396 auto [StartAfter, StartAfterInstanceNum] =
397 getPassNameAndInstanceNum(Opts.start_after);
398 auto [StopBefore, StopBeforeInstanceNum] =
399 getPassNameAndInstanceNum(Opts.stop_before);
400 auto [StopAfter, StopAfterInstanceNum] =
401 getPassNameAndInstanceNum(Opts.stop_after);
402
403 if (!StartBefore.empty() && !StartAfter.empty())
405 Twine(StartBeforeOptName) + " and " + StartAfterOptName + " specified!",
406 std::make_error_code(std::errc::invalid_argument));
407 if (!StopBefore.empty() && !StopAfter.empty())
409 Twine(StopBeforeOptName) + " and " + StopAfterOptName + " specified!",
410 std::make_error_code(std::errc::invalid_argument));
411
412 StartStopInfo Result;
413 Result.StartPass = StartBefore.empty() ? StartAfter : StartBefore;
414 Result.StopPass = StopBefore.empty() ? StopAfter : StopBefore;
415 Result.StartInstanceNum =
416 StartBefore.empty() ? StartAfterInstanceNum : StartBeforeInstanceNum;
417 Result.StopInstanceNum =
418 StopBefore.empty() ? StopAfterInstanceNum : StopBeforeInstanceNum;
419 Result.StartAfter = !StartAfter.empty();
420 Result.StopAfter = !StopAfter.empty();
421 Result.StartInstanceNum += Result.StartInstanceNum == 0;
422 Result.StopInstanceNum += Result.StopInstanceNum == 0;
423 return Result;
424}
425
426// Out of line constructor provides default values for pass options and
427// registers all common codegen passes.
429 : ImmutablePass(ID), PM(&PM), TM(&TM) {
430 const CodeGenOptions &Opts = CodeGenOptions::Global;
431 Impl = new PassConfigImpl();
432
434 // Register all target independent codegen passes to activate their PassIDs,
435 // including this pass itself.
437
439
440 // Also register alias analysis passes required by codegen passes.
443
444 if (Opts.enable_ipra != BoolOrDefault::Default) {
445 TM.Options.EnableIPRA = Opts.enable_ipra == BoolOrDefault::True;
446 } else {
447 // If not explicitly specified, use target default.
448 TM.Options.EnableIPRA |= TM.useIPRA();
449 }
450
451 if (TM.Options.EnableIPRA)
453
454 if (Opts.regalloc_fast_tied != BoolOrDefault::Default)
455 TM.setEnableTiedFastRegAlloc(Opts.regalloc_fast_tied ==
457
458 if (Opts.global_isel_abort)
459 TM.Options.GlobalISelAbort = *Opts.global_isel_abort;
460
461 bool VerifyEach = valueOr(Opts.verify_machineinstrs, false);
462#ifdef EXPENSIVE_CHECKS
463 if (Opts.verify_machineinstrs == BoolOrDefault::Default)
464 VerifyEach = TM.isMachineVerifierClean();
465#endif
467
468 if (Opts.function_splitting)
469 TM.Options.FunctionSplitting = *Opts.function_splitting;
470
471 setStartStopPasses();
472}
473
475 return TM->getOptLevel();
476}
477
478/// Insert InsertedPassID pass after TargetPassID.
480 IdentifyingPassPtr InsertedPassID) {
481 assert(((!InsertedPassID.isInstance() &&
482 TargetPassID != InsertedPassID.getID()) ||
483 (InsertedPassID.isInstance() &&
484 TargetPassID != InsertedPassID.getInstance()->getPassID())) &&
485 "Insert a pass after itself!");
486 Impl->InsertedPasses.emplace_back(TargetPassID, InsertedPassID);
487}
488
489/// createPassConfig - Create a pass configuration object to be used by
490/// addPassToEmitX methods for generating a pipeline of CodeGen passes.
491///
492/// Targets may override this to extend TargetPassConfig.
497
499 : ImmutablePass(ID) {
500 reportFatalUsageError("trying to construct TargetPassConfig without a target "
501 "machine. Scheduling a CodeGen pass without a target "
502 "triple set?");
503}
504
506 const CodeGenOptions &Opts = CodeGenOptions::Global;
507 return Opts.stop_before.empty() && Opts.stop_after.empty();
508}
509
511 const CodeGenOptions &Opts = CodeGenOptions::Global;
512 return !Opts.start_before.empty() || !Opts.start_after.empty() ||
514}
515
517 const CodeGenOptions &Opts = CodeGenOptions::Global;
519 return std::string();
520 std::string Res;
521 StringRef PassNames[] = {Opts.start_after, Opts.start_before, Opts.stop_after,
522 Opts.stop_before};
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
536// Helper to verify the analysis is really immutable.
537void TargetPassConfig::setOpt(bool &Opt, bool Val) {
538 assert(!Initialized && "PassConfig is immutable");
539 Opt = Val;
540}
541
543 IdentifyingPassPtr TargetID) {
544 Impl->TargetPasses[StandardID] = TargetID;
545}
546
549 I = Impl->TargetPasses.find(ID);
550 if (I == Impl->TargetPasses.end())
551 return ID;
552 return I->second;
553}
554
557 IdentifyingPassPtr FinalPtr = overridePass(ID, TargetID);
558 return !FinalPtr.isValid() || FinalPtr.isInstance() ||
559 FinalPtr.getID() != ID;
560}
561
562/// Add a pass to the PassManager if that pass is supposed to be run. If the
563/// Started/Stopped flags indicate either that the compilation should start at
564/// a later pass or that it should stop after an earlier pass, then do not add
565/// the pass. Finally, compare the current pass against the StartAfter
566/// and StopAfter options and change the Started/Stopped flags accordingly.
568 assert(!Initialized && "PassConfig is immutable");
569
570 // Cache the Pass ID here in case the pass manager finds this pass is
571 // redundant with ones already scheduled / available, and deletes it.
572 // Fundamentally, once we add the pass to the manager, we no longer own it
573 // and shouldn't reference it.
574 AnalysisID PassID = P->getPassID();
575
576 if (StartBefore == PassID && StartBeforeCount++ == StartBeforeInstanceNum)
577 Started = true;
578 if (StopBefore == PassID && StopBeforeCount++ == StopBeforeInstanceNum)
579 Stopped = true;
580 if (Started && !Stopped) {
581 if (AddingMachinePasses) {
582 // Construct banner message before PM->add() as that may delete the pass.
583 std::string Banner =
584 std::string("After ") + std::string(P->getPassName());
586 PM->add(P);
587 addMachinePostPasses(Banner);
588 } else {
589 PM->add(P);
590 }
591
592 // Add the passes after the pass P if there is any.
593 for (const auto &IP : Impl->InsertedPasses)
594 if (IP.TargetPassID == PassID)
595 addPass(IP.getInsertedPass());
596 } else {
597 delete P;
598 }
599
600 if (StopAfter == PassID && StopAfterCount++ == StopAfterInstanceNum)
601 Stopped = true;
602
603 if (StartAfter == PassID && StartAfterCount++ == StartAfterInstanceNum)
604 Started = true;
605 if (Stopped && !Started)
606 reportFatalUsageError("Cannot stop compilation after pass that is not run");
607}
608
609/// Add a CodeGen pass at this point in the pipeline after checking for target
610/// and command line overrides.
611///
612/// addPass cannot return a pointer to the pass instance because is internal the
613/// PassManager and the instance we create here may already be freed.
615 IdentifyingPassPtr TargetID = getPassSubstitution(PassID);
616 IdentifyingPassPtr FinalPtr = overridePass(PassID, TargetID);
617 if (!FinalPtr.isValid())
618 return nullptr;
619
620 Pass *P;
621 if (FinalPtr.isInstance())
622 P = FinalPtr.getInstance();
623 else {
624 P = Pass::createPass(FinalPtr.getID());
625 if (!P)
626 llvm_unreachable("Pass ID not registered");
627 }
628 AnalysisID FinalID = P->getPassID();
629 addPass(P); // Ends the lifetime of P.
630
631 return FinalID;
632}
633
634void TargetPassConfig::printAndVerify(const std::string &Banner) {
635 addPrintPass(Banner);
636 addVerifyPass(Banner);
637}
638
639void TargetPassConfig::addPrintPass(const std::string &Banner) {
640 if (CodeGenOptions::Global.print_after_isel)
641 PM->add(createMachineFunctionPrinterPass(dbgs(), Banner));
642}
643
644void TargetPassConfig::addVerifyPass(const std::string &Banner) {
646 PM->add(createMachineVerifierPass(Banner));
647}
648
652
654 PM->add(createStripDebugMachineModuleLegacyPass(/*OnlyDebugified=*/true));
655}
656
660
662 const CodeGenOptions &Opts = CodeGenOptions::Global;
663 if (AllowDebugify && DebugifyIsSafe &&
664 (valueOr(Opts.debugify_and_strip_all_safe, false) ||
665 valueOr(Opts.debugify_check_and_strip_all_safe, false)))
667}
668
669void TargetPassConfig::addMachinePostPasses(const std::string &Banner) {
670 const CodeGenOptions &Opts = CodeGenOptions::Global;
671 if (DebugifyIsSafe) {
672 if (valueOr(Opts.debugify_check_and_strip_all_safe, false)) {
675 } else if (valueOr(Opts.debugify_and_strip_all_safe, false))
677 }
678 addVerifyPass(Banner);
679}
680
681/// Add common target configurable passes that perform LLVM IR to IR transforms
682/// following machine independent optimization.
684 const CodeGenOptions &Opts = CodeGenOptions::Global;
685 // Before running any passes, run the verifier to determine if the input
686 // coming from the front-end and/or optimizer is valid.
687 if (!DisableVerify)
689
691 // Basic AliasAnalysis support.
692 // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
693 // BasicAliasAnalysis wins if they disagree. This is intended to help
694 // support "obvious" type-punning idioms.
698
699 // Run loop strength reduction before anything else.
700 if (!Opts.disable_lsr) {
705 }
706 }
707
708 // Run GC lowering passes for builtin collectors
709 // TODO: add a pass insertion point here
712
713 // For MachO, lower @llvm.global_dtors into @llvm.global_ctors with
714 // __cxa_atexit() calls to avoid emitting the deprecated __mod_term_func.
715 if (TM->getTargetTriple().isOSBinFormatMachO() &&
716 !Opts.disable_atexit_based_global_dtor_lowering)
718
719 // Make sure that no unreachable blocks are instruction selected.
721
722 // Prepare expensive constants for SelectionDAG.
723 if (getOptLevel() != CodeGenOptLevel::None && !Opts.disable_constant_hoisting)
725
727 !Opts.disable_replace_with_vec_lib)
729
731 !Opts.disable_partial_libcall_inlining)
733
734 // Instrument function entry after all inlining.
736
737 // Add scalarization of target's unsupported masked memory intrinsics pass.
738 // the unsupported intrinsic will be replaced with a chain of basic blocks,
739 // that stores/loads element one-by-one if the appropriate mask bit is set.
741
742 // Expand reduction intrinsics into shuffle sequences if the target wants to.
743 // Allow disabling it for testing purposes.
744 if (!Opts.disable_expand_reductions)
746
747 // Convert conditional moves to conditional jumps when profitable.
748 if (getOptLevel() != CodeGenOptLevel::None && !Opts.disable_select_optimize)
750
751 if (Opts.enable_global_merge_func)
753
754 if (TM->getTargetTriple().isOSWindows())
756}
757
758/// Turn exception handling constructs into something the code generators can
759/// handle.
761 const MCAsmInfo &MCAI = TM->getMCAsmInfo();
762 switch (MCAI.getExceptionHandlingType()) {
764 // SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
765 // Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
766 // catch info can get misplaced when a selector ends up more than one block
767 // removed from the parent invoke(s). This could happen when a landing
768 // pad is shared by multiple invokes and is also a target of a normal
769 // edge from elsewhere.
771 [[fallthrough]];
777 break;
779 // We support using both GCC-style and MSVC-style exceptions on Windows, so
780 // add both preparation passes. Each pass will only actually run if it
781 // recognizes the personality function.
784 break;
786 // Wasm EH uses Windows EH instructions, but it does not need to demote PHIs
787 // on catchpads and cleanuppads because it does not outline them into
788 // funclets. Catchswitch blocks are not lowered in SelectionDAG, so we
789 // should remove PHIs there. WinEHPrepare derives this from the Wasm
790 // personality, so no explicit flag is needed here.
792 break;
796 // Emscripten EH is lowered earlier by WebAssemblyLowerEmscriptenEHSjLj, so
797 // by this point it needs no generic EH preparation, like the None case.
799
800 // The lower invoke pass may create unreachable code. Remove it.
802 break;
803 }
804}
805
806/// Add pass to prepare the LLVM IR for code generation. This should be done
807/// before exception handling preparation passes.
810 !CodeGenOptions::Global.disable_cgp)
812}
813
814/// Add common passes that perform LLVM IR to IR transforms in preparation for
815/// instruction selection.
817 addPreISel();
818
819 // Force codegen to run according to the callgraph.
822
824
825 // Add both the safe stack and the stack protection passes: each of them will
826 // only protect functions that have corresponding attributes.
829
830 if (CodeGenOptions::Global.print_isel_input)
832 dbgs(), "\n\n*** Final LLVM Code input to ISel ***\n"));
833
834 // All passes which modify the LLVM IR are now complete; run the verifier
835 // to ensure that the IR is valid.
836 if (!DisableVerify)
838}
839
841 const CodeGenOptions &Opts = CodeGenOptions::Global;
842 // Enable FastISel with -fast-isel, but allow that to be overridden.
843 TM->setO0WantsFastISel(valueOr(Opts.fast_isel, true));
844
845 // Determine an instruction selector.
846 enum class SelectorType { SelectionDAG, FastISel, GlobalISel };
847 SelectorType Selector;
848
849 if (valueOr(Opts.fast_isel, false))
850 Selector = SelectorType::FastISel;
851 else if (valueOr(Opts.global_isel, false) ||
852 (TM->Options.EnableGlobalISel && valueOr(Opts.global_isel, true)))
853 Selector = SelectorType::GlobalISel;
854 else if (TM->getOptLevel() == CodeGenOptLevel::None &&
855 TM->getO0WantsFastISel())
856 Selector = SelectorType::FastISel;
857 else
858 Selector = SelectorType::SelectionDAG;
859
860 // Set consistently TM->Options.EnableFastISel and EnableGlobalISel.
861 if (Selector == SelectorType::FastISel) {
862 TM->setFastISel(true);
863 TM->setGlobalISel(false);
864 } else if (Selector == SelectorType::GlobalISel) {
865 TM->setFastISel(false);
866 TM->setGlobalISel(true);
867 }
868
869 // FIXME: Injecting into the DAGISel pipeline seems to cause issues with
870 // analyses needing to be re-run. This can result in being unable to
871 // schedule passes (particularly with 'Function Alias Analysis
872 // Results'). It's not entirely clear why but AFAICT this seems to be
873 // due to one FunctionPassManager not being able to use analyses from a
874 // previous one. As we're injecting a ModulePass we break the usual
875 // pass manager into two. GlobalISel with the fallback path disabled
876 // and -run-pass seem to be unaffected. The majority of GlobalISel
877 // testing uses -run-pass so this probably isn't too bad.
878 SaveAndRestore SavedDebugifyIsSafe(DebugifyIsSafe);
879 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
880 DebugifyIsSafe = false;
881
882 // Add instruction selector passes for global isel if enabled.
883 if (Selector == SelectorType::GlobalISel) {
884 SaveAndRestore SavedAddingMachinePasses(AddingMachinePasses, true);
885 if (addIRTranslator())
886 return true;
887
889
891 return true;
892
893 // Before running the register bank selector, ask the target if it
894 // wants to run some passes.
896
897 if (addRegBankSelect())
898 return true;
899
901
903 return true;
904 }
905
906 // Pass to reset the MachineFunction if the ISel failed. Outside of the above
907 // if so that the verifier is not added to it.
908 if (Selector == SelectorType::GlobalISel)
911
912 // Run the SDAG InstSelector, providing a fallback path when we do not want to
913 // abort on not-yet-supported input.
914 if (Selector != SelectorType::GlobalISel || !isGlobalISelAbortEnabled())
915 if (addInstSelector())
916 return true;
917
918 // Expand pseudo-instructions emitted by ISel. Don't run the verifier before
919 // FinalizeISel.
921
922 // Print the instruction selected machine code...
923 printAndVerify("After Instruction Selection");
924
925 return false;
926}
927
929 if (TM->useEmulatedTLS())
931
932 PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
933 // ObjCARCContract operates on ObjC intrinsics and must run before
934 // PreISelIntrinsicLowering.
939 addIRPasses();
940
941 if (CodeGenOptions::Global.codegen_pipeline_trigger_crash)
942 addPass(new TriggerCrashFunctionLegacyPass());
943
947
948 return addCoreISelPasses();
949}
950
951/// -regalloc=... command line option.
952static FunctionPass *useDefaultRegisterAllocator() { return nullptr; }
956 cl::desc("Register allocator to use"));
957
958/// Add the complete set of target-independent postISel code generator passes.
959///
960/// This can be read as the standard order of major LLVM CodeGen stages. Stages
961/// with nontrivial configuration or multiple passes are broken out below in
962/// add%Stage routines.
963///
964/// Any TargetPassConfig::addXX routine may be overriden by the Target. The
965/// addPre/Post methods with empty header implementations allow injecting
966/// target-specific fixups just before or after major stages. Additionally,
967/// targets have the flexibility to change pass order within a stage by
968/// overriding default implementation of add%Stage routines below. Each
969/// technique has maintainability tradeoffs because alternate pass orders are
970/// not well supported. addPre/Post works better if the target pass is easily
971/// tied to a common pass. But if it has subtle dependencies on multiple passes,
972/// the target should override the stage instead.
973///
974/// TODO: We could use a single addPre/Post(ID) hook to allow pass injection
975/// before/after any target-independent pass. But it's currently overkill.
977 const CodeGenOptions &Opts = CodeGenOptions::Global;
978 AddingMachinePasses = true;
979
980 // Add passes that optimize machine instructions in SSA form.
983 } else {
984 // If the target requests it, assign local variables to stack slots relative
985 // to one another and simplify frame index references where possible.
987 }
988
989 if (TM->Options.EnableIPRA)
991
992 // Run pre-ra passes.
994
995 // Debugifying the register allocator passes seems to provoke some
996 // non-determinism that affects CodeGen and there doesn't seem to be a point
997 // where it becomes safe again so stop debugifying here.
998 DebugifyIsSafe = false;
999
1000 // Add a FSDiscriminator pass right before RA, so that we could get
1001 // more precise SampleFDO profile for RA.
1005 const std::string ProfileFile = getFSProfileFile(TM);
1006 if (!ProfileFile.empty() && !Opts.disable_ra_fsprofile_loader)
1009 nullptr));
1010 }
1011
1012 // Run register allocation and passes that are tightly coupled with it,
1013 // including phi elimination and scheduling.
1014 if (getOptimizeRegAlloc())
1016 else
1018
1019 // Run post-ra passes.
1021
1023
1025
1026 // Insert prolog/epilog code. Eliminate abstract frame index references...
1030 }
1031
1032 // Prolog/Epilog inserter needs a TargetMachine to instantiate. But only
1033 // do so if it hasn't been disabled, substituted, or overridden.
1036
1037 /// Add passes that optimize machine instructions after register allocation.
1040
1041 // Expand pseudo instructions before second scheduling pass.
1043
1044 // Run pre-sched2 passes.
1045 addPreSched2();
1046
1047 if (Opts.enable_implicit_null_checks)
1049
1050 // Second pass scheduler.
1051 // Let Target optionally insert this pass by itself at some other
1052 // point.
1054 !TM->targetSchedulesPostRAScheduling()) {
1055 if (Opts.misched_postra)
1057 else
1059 }
1060
1061 // GC
1062 addGCPasses();
1063
1064 // Basic block placement.
1067
1068 // Insert before XRay Instrumentation.
1070
1073
1075
1076 if (TM->Options.EnableIPRA)
1077 // Collect register usage information and produce a register mask of
1078 // clobbered registers, to be used to optimize call sites.
1080
1081 // FIXME: Some backends are incompatible with running the verifier after
1082 // addPreEmitPass. Maybe only pass "false" here for those targets?
1084
1089
1090 if (TM->Options.EnableMachineOutliner &&
1094 TM->supportsDefaultOutlining())
1096 }
1097
1098 if (Opts.enable_gc_empty_basic_blocks)
1100
1104
1105 const bool SplitFunctionsWithPGO =
1106 TM->Options.FunctionSplitting == FunctionSplittingMode::All;
1107
1108 if (SplitFunctionsWithPGO || Opts.split_static_data ||
1109 TM->Options.EnableStaticDataPartitioning) {
1110 const std::string ProfileFile = getFSProfileFile(TM);
1111 if (!ProfileFile.empty()) {
1114 ProfileFile, getFSRemappingFile(TM),
1116 } else {
1117 // Sample profile is given, but FSDiscriminator is not
1118 // enabled, this may result in performance regression.
1120 << "Using AutoFDO without FSDiscriminator for MFS may regress "
1121 "performance.\n";
1122 }
1123 }
1124 }
1125
1126 if (Opts.split_static_data || TM->Options.EnableStaticDataPartitioning) {
1127 // The static data splitter pass is a machine function pass. and
1128 // static data annotator pass is a module-wide pass. See the file comment
1129 // in StaticDataAnnotator.cpp for the motivation.
1132 }
1133 // We run the BasicBlockSections pass if we need BB sections, BB address map,
1134 // or function splitting. With function splitting, functions which are
1135 // eligible for basic-block-sections optimizations (`=all`, or `=list=` with
1136 // function included in the list profile) get that optimization, and the other
1137 // functions are split using their PGO/AutoFDO profile.
1138 if (TM->getBBSectionsType() != llvm::BasicBlockSection::None ||
1139 TM->Options.BBAddrMap || SplitFunctionsWithPGO) {
1140 if (shouldEmitBBHash() || Opts.basic_block_section_match_infer)
1142 if (TM->getBBSectionsType() == llvm::BasicBlockSection::List) {
1144 TM->getBBSectionsFuncListBuf()));
1145 if (Opts.basic_block_section_match_infer)
1147 else {
1150 }
1151 }
1152 addPass(llvm::createBasicBlockSectionsPass(SplitFunctionsWithPGO));
1153 }
1154
1156
1157 if (!Opts.disable_cfi_fixup && TM->Options.EnableCFIFixup)
1159
1161
1162 // Add passes that directly emit MI after all other MI passes.
1164
1165 AddingMachinePasses = false;
1166}
1167
1168/// Add passes that optimize machine instructions in SSA form.
1170 // Pre-ra tail duplication.
1172
1173 // Optimize PHIs before DCE: removing dead PHI cycles may make more
1174 // instructions dead.
1176
1177 // This pass merges large allocas. StackSlotColoring is a different pass
1178 // which merges spill slots.
1180
1181 // If the target requests it, assign local variables to stack slots relative
1182 // to one another and simplify frame index references where possible.
1184
1185 // With optimization, dead code should already be eliminated. However
1186 // there is one known exception: lowered code for arguments that are only
1187 // used by tail calls, where the tail calls reuse the incoming stack
1188 // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll).
1190
1191 // Allow targets to insert passes that improve instruction level parallelism,
1192 // like if-conversion. Such passes will typically need dominator trees and
1193 // loop info, just like LICM and CSE below.
1194 addILPOpts();
1195
1198
1200
1202 // Clean-up the dead code that may have been generated by peephole
1203 // rewriting.
1205}
1206
1207//===---------------------------------------------------------------------===//
1208/// Register Allocation Pass Configuration
1209//===---------------------------------------------------------------------===//
1210
1211/// A dummy default pass factory indicates whether the register allocator is
1212/// overridden on the command line.
1214
1215static RegisterRegAlloc
1217 "pick register allocator based on -O option",
1219
1224
1226 // An explicit -regalloc choice implies its pipeline: only the fast
1227 // allocator uses the unoptimized one.
1232 return Ctor !=
1235}
1236
1237/// Instantiate the default register allocator pass for this target for either
1238/// the optimized or unoptimized allocation path. This will be added to the pass
1239/// manager by addFastRegAlloc in the unoptimized case or addOptimizedRegAlloc
1240/// in the optimized case.
1241///
1242/// A target that uses the standard regalloc pass order for fast or optimized
1243/// allocation may still override this for per-target regalloc
1244/// selection. But -regalloc=... always takes precedence.
1246 if (Optimized)
1248 else
1250}
1251
1252/// Find and instantiate the register allocation pass requested by this target
1253/// at the current optimization level. Different register allocators are
1254/// defined as separate passes because they may require different analysis.
1255///
1256/// This helper ensures that the regalloc= option is always available,
1257/// even for targets that override the default allocator.
1258///
1259/// FIXME: When MachinePassRegistry register pass IDs instead of function ptrs,
1260/// this can be folded into addPass.
1262 // getOptimizeRegAlloc, called before the pipeline branches, has initialized
1263 // the global default.
1265 if (Ctor != useDefaultRegisterAllocator)
1266 return Ctor();
1267
1268 // With no -regalloc= override, ask the target for a regalloc pass.
1269 return createTargetRegisterAllocator(Optimized);
1270}
1271
1276
1281 "Must use fast (default) register allocator for unoptimized regalloc.");
1282
1284
1285 // Allow targets to change the register assignments after
1286 // fast register allocation.
1288 return true;
1289}
1290
1292 // Add the selected register allocation pass.
1294
1295 // Allow targets to change the register assignments before rewriting.
1296 addPreRewrite();
1297
1298 // Finally rewrite virtual registers.
1300
1301 // Regalloc scoring for ML-driven eviction - noop except when learning a new
1302 // eviction policy.
1304 return true;
1305}
1306
1307/// Return true if the default global register allocator is in use and
1308/// has not be overriden on the command line with '-regalloc=...'
1310 return RegAlloc.getNumOccurrences() == 0;
1311}
1312
1313/// Add the minimum set of target-independent passes that are required for
1314/// register allocation. No coalescing or scheduling.
1317 if (!TM->enableTiedFastRegAlloc())
1319
1321}
1322
1323/// Add standard target-independent passes that are tightly coupled with
1324/// optimized register allocation, including coalescing, machine instruction
1325/// scheduling, and register allocation itself.
1328
1330
1332
1333 // LiveVariables currently requires pure SSA form.
1334 //
1335 // FIXME: Once TwoAddressInstruction pass no longer uses kill flags,
1336 // LiveVariables can be removed completely, and LiveIntervals can be directly
1337 // computed. (We still either need to regenerate kill flags after regalloc, or
1338 // preferably fix the scavenger to not depend on them).
1339 // FIXME: UnreachableMachineBlockElim is a dependant pass of LiveVariables.
1340 // When LiveVariables is removed this has to be removed/moved either.
1341 // Explicit addition of UnreachableMachineBlockElim allows stopping before or
1342 // after it with -stop-before/-stop-after.
1345
1346 // Run SSA machine scheduler runs just before PHI elimination.
1350 }
1351
1352 // LiveIntervals is computed unconditionally before TwoAddressInstruction so
1353 // that pass can rely on it instead of LiveVariables. This is a step toward
1354 // removing LiveVariables entirely.
1356
1357 // Edge splitting is smarter with machine loop info.
1360
1363
1364 // The machine scheduler may accidentally create disconnected components
1365 // when moving subregister definitions around, avoid this by splitting them to
1366 // separate vregs before. Splitting can also improve reg. allocation quality.
1368
1369 // PreRA instruction scheduling.
1371
1373 // Perform stack slot coloring and post-ra machine LICM.
1375
1376 // Allow targets to expand pseudo instructions depending on the choice of
1377 // registers before MachineCopyPropagation.
1379
1380 // Copy propagate to forward register uses and try to eliminate COPYs that
1381 // were not coalesced.
1383
1384 // Run post-ra machine LICM to hoist reloads / remats.
1385 //
1386 // FIXME: can this move into MachineLateOptimization?
1388 }
1389}
1390
1391//===---------------------------------------------------------------------===//
1392/// Post RegAlloc Pass Configuration
1393//===---------------------------------------------------------------------===//
1394
1395/// Add passes that optimize machine instructions after register allocation.
1397 // Cleanup of redundant immediate/address loads.
1399
1400 // Branch folding must be run after regalloc and prolog/epilog insertion.
1402
1403 // Tail duplication.
1404 // Note that duplicating tail just increases code size and degrades
1405 // performance for targets that require Structured Control Flow.
1406 // In addition it can also make CFG irreducible. Thus we disable it.
1407 if (!TM->requiresStructuredCFG())
1409
1410 // Copy propagation.
1412}
1413
1414/// Add standard GC passes.
1417 return true;
1418}
1419
1420/// Add standard basic block placement passes.
1422 const CodeGenOptions &Opts = CodeGenOptions::Global;
1426 const std::string ProfileFile = getFSProfileFile(TM);
1427 if (!ProfileFile.empty() && !Opts.disable_layout_fsprofile_loader)
1430 nullptr));
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 std::string getFSRemappingFile(const TargetMachine *TM)
static const char StopBeforeOptName[]
static AnalysisID getPassIDFromName(StringRef PassName)
static IdentifyingPassPtr overridePass(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 void initializeDefaultRegisterAllocatorOnce()
static const char StartBeforeOptName[]
static const PassInfo * getPassInfo(StringRef PassName)
static const char StartAfterOptName[]
Option names for limiting the codegen pipeline.
static std::string getFSProfileFile(const TargetMachine *TM)
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 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:680
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:314
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:287
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:67
ExceptionHandling getExceptionHandlingType() const
Definition MCAsmInfo.h:656
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:99
static Pass * createPass(AnalysisID ID)
Definition Pass.cpp:222
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
Definition Pass.h:122
RegisterPassParser class - Handle the addition of new machine passes.
static void setDefault(FunctionPassCtor C)
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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
Target-Independent Code Generator Pass Configuration Options.
bool usingDefaultRegAlloc() const
Return true if the default global register allocator is in use and has not be overriden on the comman...
bool requiresCodeGenSCCOrder() const
void addCheckDebugPass()
Add a pass to check synthesized debug info for MIR.
virtual void addPreLegalizeMachineIR()
This method may be implemented by targets that want to run passes immediately before legalization.
void addPrintPass(const std::string &Banner)
Add a pass to print the machine function if printing is enabled.
virtual void addPreEmitPass2()
Targets may add passes immediately before machine code is emitted in this callback.
virtual std::unique_ptr< CSEConfigBase > getCSEConfig() const
Returns the CSEConfig object to use for the current optimization level.
bool EnableLoopTermFold
Enable LoopTermFold immediately after LSR.
void printAndVerify(const std::string &Banner)
printAndVerify - Add a pass to dump then verify the machine function, if those steps are enabled.
static bool hasLimitedCodeGenPipeline()
Returns true if one of the -start-after, -start-before, -stop-after or -stop-before options is set.
static Expected< StartStopInfo > getStartStopInfo(PassInstrumentationCallbacks &PIC)
Returns pass name in -stop-before or -stop-after NOTE: New pass manager migration only.
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)
virtual void addBlockPlacement()
Add standard basic block placement passes.
virtual FunctionPass * createRegAllocPass(bool Optimized)
addMachinePasses helper to create the target-selected or overriden regalloc pass.
virtual void addPostBBSections()
This pass may be implemented by targets that want to run passes immediately after basic block section...
virtual void addOptimizedRegAlloc()
addOptimizedRegAlloc - Add passes related to register allocation.
virtual bool addRegAssignAndRewriteFast()
Add core register allocator passes which do the actual register assignment and rewriting.
virtual void addPreEmitPass()
This pass may be implemented by targets that want to run passes immediately before machine code is em...
bool isGlobalISelAbortEnabled() const
Check whether or not GlobalISel should abort on error.
bool getOptimizeRegAlloc() const
Return true if the optimized regalloc pipeline is enabled.
bool isCustomizedRegAlloc()
Return true if register allocator is specified by -regalloc=override.
virtual void addPreRegBankSelect()
This method may be implemented by targets that want to run passes immediately before the register ban...
virtual bool reportDiagnosticWhenGlobalISelFallback() const
Check whether or not a diagnostic should be emitted when GlobalISel uses the fallback path.
virtual bool addPreRewrite()
addPreRewrite - Add passes to the optimized register allocation pipeline after register allocation is...
virtual bool addRegBankSelect()
This method should install a register bank selector pass, which assigns register banks to virtual reg...
void setRequiresCodeGenSCCOrder(bool Enable=true)
virtual void addMachineLateOptimization()
Add passes that optimize machine instructions after register allocation.
virtual void addMachinePasses()
Add the complete, standard set of LLVM CodeGen passes.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
virtual void addPreGlobalInstructionSelect()
This method may be implemented by targets that want to run passes immediately before the (global) ins...
virtual void addFastRegAlloc()
addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast registe...
virtual bool addLegalizeMachineIR()
This method should install a legalize pass, which converts the instruction sequence into one that can...
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.
void substitutePass(AnalysisID StandardID, IdentifyingPassPtr TargetID)
Allow the target to override a specific pass without overriding the pass pipeline.
virtual bool addRegAssignAndRewriteOptimized()
virtual bool addGlobalInstructionSelect()
This method should install a (global) instruction selector pass, which converts possibly generic inst...
virtual void addPreRegAlloc()
This method may be implemented by targets that want to run passes immediately before register allocat...
static std::string getLimitedCodeGenPipelineReason()
If hasLimitedCodeGenPipeline is true, this method returns a string with the name of the options that ...
AnalysisID addPass(AnalysisID PassID)
Utilities for targets to add passes to the pass manager.
void addPassesToHandleExceptions()
Add passes to lower exception handling for the code generator.
void addStripDebugPass()
Add a pass to remove debug info from the MIR.
bool isPassSubstitutedOrOverridden(AnalysisID ID) const
Return true if the pass has been substituted by the target or overridden on the command line.
bool addCoreISelPasses()
Add the actual instruction selection passes.
virtual void addISelPrepare()
Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
static bool willCompleteCodeGenPipeline()
Returns true if none of the -stop-before and -stop-after options is set.
void addMachinePrePasses(bool AllowDebugify=true)
Add standard passes before a pass that's about to be added.
virtual bool addGCPasses()
addGCPasses - Add late codegen passes that analyze code for garbage collection.
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...
virtual bool addPostFastRegAllocRewrite()
addPostFastRegAllocRewrite - Add passes to the optimized register allocation pipeline after fast regi...
IdentifyingPassPtr getPassSubstitution(AnalysisID StandardID) const
Return the pass substituted for StandardID by the target.
bool addISelPasses()
High level function that adds all passes necessary to go from llvm IR representation to the MI repres...
virtual void addPostRewrite()
Add passes to be run immediately after virtual registers are rewritten to physical registers.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
static LLVM_ABI raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
Definition WithColor.cpp: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 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 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 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 & LiveVariablesID
LiveVariables pass - This pass sets dead flags on register definitions.
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
@ ZOS
z/OS MVS Exception Handling.
Definition CodeGen.h:64
@ Emscripten
Emscripten JavaScript-based exception handling.
Definition CodeGen.h:62
@ None
No exception support.
Definition CodeGen.h:56
@ Default
Not specified; resolve to the target's default model.
Definition CodeGen.h:55
@ AIX
AIX Exception Handling.
Definition CodeGen.h:63
@ 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: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 CGPassBuilderOption getCGPassBuilderOption()
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.
The llvm::once_flag structure.
Definition Threading.h:67