LLVM  14.0.0git
AArch64TargetMachine.cpp
Go to the documentation of this file.
1 //===-- AArch64TargetMachine.cpp - Define TargetMachine for AArch64 -------===//
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 //
10 //===----------------------------------------------------------------------===//
11 
12 #include "AArch64TargetMachine.h"
13 #include "AArch64.h"
15 #include "AArch64MacroFusion.h"
16 #include "AArch64Subtarget.h"
21 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/ADT/Triple.h"
32 #include "llvm/CodeGen/Passes.h"
34 #include "llvm/IR/Attributes.h"
35 #include "llvm/IR/Function.h"
36 #include "llvm/InitializePasses.h"
37 #include "llvm/MC/MCAsmInfo.h"
39 #include "llvm/Pass.h"
40 #include "llvm/Support/CodeGen.h"
46 #include "llvm/Transforms/Scalar.h"
47 #include <memory>
48 #include <string>
49 
50 using namespace llvm;
51 
52 static cl::opt<bool> EnableCCMP("aarch64-enable-ccmp",
53  cl::desc("Enable the CCMP formation pass"),
54  cl::init(true), cl::Hidden);
55 
56 static cl::opt<bool>
57  EnableCondBrTuning("aarch64-enable-cond-br-tune",
58  cl::desc("Enable the conditional branch tuning pass"),
59  cl::init(true), cl::Hidden);
60 
61 static cl::opt<bool> EnableMCR("aarch64-enable-mcr",
62  cl::desc("Enable the machine combiner pass"),
63  cl::init(true), cl::Hidden);
64 
65 static cl::opt<bool> EnableStPairSuppress("aarch64-enable-stp-suppress",
66  cl::desc("Suppress STP for AArch64"),
67  cl::init(true), cl::Hidden);
68 
70  "aarch64-enable-simd-scalar",
71  cl::desc("Enable use of AdvSIMD scalar integer instructions"),
72  cl::init(false), cl::Hidden);
73 
74 static cl::opt<bool>
75  EnablePromoteConstant("aarch64-enable-promote-const",
76  cl::desc("Enable the promote constant pass"),
77  cl::init(true), cl::Hidden);
78 
80  "aarch64-enable-collect-loh",
81  cl::desc("Enable the pass that emits the linker optimization hints (LOH)"),
82  cl::init(true), cl::Hidden);
83 
84 static cl::opt<bool>
85  EnableDeadRegisterElimination("aarch64-enable-dead-defs", cl::Hidden,
86  cl::desc("Enable the pass that removes dead"
87  " definitons and replaces stores to"
88  " them with stores to the zero"
89  " register"),
90  cl::init(true));
91 
93  "aarch64-enable-copyelim",
94  cl::desc("Enable the redundant copy elimination pass"), cl::init(true),
95  cl::Hidden);
96 
97 static cl::opt<bool> EnableLoadStoreOpt("aarch64-enable-ldst-opt",
98  cl::desc("Enable the load/store pair"
99  " optimization pass"),
100  cl::init(true), cl::Hidden);
101 
103  "aarch64-enable-atomic-cfg-tidy", cl::Hidden,
104  cl::desc("Run SimplifyCFG after expanding atomic operations"
105  " to make use of cmpxchg flow-based information"),
106  cl::init(true));
107 
108 static cl::opt<bool>
109 EnableEarlyIfConversion("aarch64-enable-early-ifcvt", cl::Hidden,
110  cl::desc("Run early if-conversion"),
111  cl::init(true));
112 
113 static cl::opt<bool>
114  EnableCondOpt("aarch64-enable-condopt",
115  cl::desc("Enable the condition optimizer pass"),
116  cl::init(true), cl::Hidden);
117 
118 static cl::opt<bool>
119 EnableA53Fix835769("aarch64-fix-cortex-a53-835769", cl::Hidden,
120  cl::desc("Work around Cortex-A53 erratum 835769"),
121  cl::init(false));
122 
123 static cl::opt<bool>
124  EnableGEPOpt("aarch64-enable-gep-opt", cl::Hidden,
125  cl::desc("Enable optimizations on complex GEPs"),
126  cl::init(false));
127 
128 static cl::opt<bool>
129  BranchRelaxation("aarch64-enable-branch-relax", cl::Hidden, cl::init(true),
130  cl::desc("Relax out of range conditional branches"));
131 
133  "aarch64-enable-compress-jump-tables", cl::Hidden, cl::init(true),
134  cl::desc("Use smallest entry possible for jump tables"));
135 
136 // FIXME: Unify control over GlobalMerge.
138  EnableGlobalMerge("aarch64-enable-global-merge", cl::Hidden,
139  cl::desc("Enable the global merge pass"));
140 
141 static cl::opt<bool>
142  EnableLoopDataPrefetch("aarch64-enable-loop-data-prefetch", cl::Hidden,
143  cl::desc("Enable the loop data prefetch pass"),
144  cl::init(true));
145 
147  "aarch64-enable-global-isel-at-O", cl::Hidden,
148  cl::desc("Enable GlobalISel at or below an opt level (-1 to disable)"),
149  cl::init(0));
150 
151 static cl::opt<bool>
152  EnableSVEIntrinsicOpts("aarch64-enable-sve-intrinsic-opts", cl::Hidden,
153  cl::desc("Enable SVE intrinsic opts"),
154  cl::init(true));
155 
156 static cl::opt<bool> EnableFalkorHWPFFix("aarch64-enable-falkor-hwpf-fix",
157  cl::init(true), cl::Hidden);
158 
159 static cl::opt<bool>
160  EnableBranchTargets("aarch64-enable-branch-targets", cl::Hidden,
161  cl::desc("Enable the AArch64 branch target pass"),
162  cl::init(true));
163 
165  "aarch64-sve-vector-bits-max",
166  cl::desc("Assume SVE vector registers are at most this big, "
167  "with zero meaning no maximum size is assumed."),
168  cl::init(0), cl::Hidden);
169 
171  "aarch64-sve-vector-bits-min",
172  cl::desc("Assume SVE vector registers are at least this big, "
173  "with zero meaning no minimum size is assumed."),
174  cl::init(0), cl::Hidden);
175 
177 
179  // Register the target.
185  auto PR = PassRegistry::getPassRegistry();
216 }
217 
218 //===----------------------------------------------------------------------===//
219 // AArch64 Lowering public interface.
220 //===----------------------------------------------------------------------===//
221 static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
222  if (TT.isOSBinFormatMachO())
223  return std::make_unique<AArch64_MachoTargetObjectFile>();
224  if (TT.isOSBinFormatCOFF())
225  return std::make_unique<AArch64_COFFTargetObjectFile>();
226 
227  return std::make_unique<AArch64_ELFTargetObjectFile>();
228 }
229 
230 // Helper function to build a DataLayout string
231 static std::string computeDataLayout(const Triple &TT,
232  const MCTargetOptions &Options,
233  bool LittleEndian) {
234  if (TT.isOSBinFormatMachO()) {
235  if (TT.getArch() == Triple::aarch64_32)
236  return "e-m:o-p:32:32-i64:64-i128:128-n32:64-S128";
237  return "e-m:o-i64:64-i128:128-n32:64-S128";
238  }
239  if (TT.isOSBinFormatCOFF())
240  return "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128";
241  std::string Endian = LittleEndian ? "e" : "E";
242  std::string Ptr32 = TT.getEnvironment() == Triple::GNUILP32 ? "-p:32:32" : "";
243  return Endian + "-m:e" + Ptr32 +
244  "-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128";
245 }
246 
247 static StringRef computeDefaultCPU(const Triple &TT, StringRef CPU) {
248  if (CPU.empty() && TT.isArm64e())
249  return "apple-a12";
250  return CPU;
251 }
252 
255  // AArch64 Darwin and Windows are always PIC.
256  if (TT.isOSDarwin() || TT.isOSWindows())
257  return Reloc::PIC_;
258  // On ELF platforms the default static relocation model has a smart enough
259  // linker to cope with referencing external symbols defined in a shared
260  // library. Hence DynamicNoPIC doesn't need to be promoted to PIC.
261  if (!RM.hasValue() || *RM == Reloc::DynamicNoPIC)
262  return Reloc::Static;
263  return *RM;
264 }
265 
266 static CodeModel::Model
268  bool JIT) {
269  if (CM) {
270  if (*CM != CodeModel::Small && *CM != CodeModel::Tiny &&
271  *CM != CodeModel::Large) {
273  "Only small, tiny and large code models are allowed on AArch64");
274  } else if (*CM == CodeModel::Tiny && !TT.isOSBinFormatELF())
275  report_fatal_error("tiny code model is only supported on ELF");
276  return *CM;
277  }
278  // The default MCJIT memory managers make no guarantees about where they can
279  // find an executable page; JITed code needs to be able to refer to globals
280  // no matter how far away they are.
281  // We should set the CodeModel::Small for Windows ARM64 in JIT mode,
282  // since with large code model LLVM generating 4 MOV instructions, and
283  // Windows doesn't support relocating these long branch (4 MOVs).
284  if (JIT && !TT.isOSWindows())
285  return CodeModel::Large;
286  return CodeModel::Small;
287 }
288 
289 /// Create an AArch64 architecture model.
290 ///
292  StringRef CPU, StringRef FS,
293  const TargetOptions &Options,
296  CodeGenOpt::Level OL, bool JIT,
297  bool LittleEndian)
299  computeDataLayout(TT, Options.MCOptions, LittleEndian),
300  TT, computeDefaultCPU(TT, CPU), FS, Options,
302  getEffectiveAArch64CodeModel(TT, CM, JIT), OL),
303  TLOF(createTLOF(getTargetTriple())), isLittle(LittleEndian) {
304  initAsmInfo();
305 
306  if (TT.isOSBinFormatMachO()) {
307  this->Options.TrapUnreachable = true;
308  this->Options.NoTrapAfterNoreturn = true;
309  }
310 
311  if (getMCAsmInfo()->usesWindowsCFI()) {
312  // Unwinding can get confused if the last instruction in an
313  // exception-handling region (function, funclet, try block, etc.)
314  // is a call.
315  //
316  // FIXME: We could elide the trap if the next instruction would be in
317  // the same region anyway.
318  this->Options.TrapUnreachable = true;
319  }
320 
321  if (this->Options.TLSSize == 0) // default
322  this->Options.TLSSize = 24;
323  if ((getCodeModel() == CodeModel::Small ||
325  this->Options.TLSSize > 32)
326  // for the small (and kernel) code model, the maximum TLS size is 4GiB
327  this->Options.TLSSize = 32;
328  else if (getCodeModel() == CodeModel::Tiny && this->Options.TLSSize > 24)
329  // for the tiny code model, the maximum TLS size is 1MiB (< 16MiB)
330  this->Options.TLSSize = 24;
331 
332  // Enable GlobalISel at or below EnableGlobalISelAt0, unless this is
333  // MachO/CodeModel::Large, which GlobalISel does not support.
334  if (getOptLevel() <= EnableGlobalISelAtO &&
335  TT.getArch() != Triple::aarch64_32 &&
336  TT.getEnvironment() != Triple::GNUILP32 &&
337  !(getCodeModel() == CodeModel::Large && TT.isOSBinFormatMachO())) {
338  setGlobalISel(true);
340  }
341 
342  // AArch64 supports the MachineOutliner.
343  setMachineOutliner(true);
344 
345  // AArch64 supports default outlining behaviour.
347 
348  // AArch64 supports the debug entry values.
350 }
351 
353 
354 const AArch64Subtarget *
356  Attribute CPUAttr = F.getFnAttribute("target-cpu");
357  Attribute FSAttr = F.getFnAttribute("target-features");
358 
359  std::string CPU =
360  CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
361  std::string FS =
362  FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
363 
365 
366  unsigned MinSVEVectorSize = 0;
367  unsigned MaxSVEVectorSize = 0;
368  Attribute VScaleRangeAttr = F.getFnAttribute(Attribute::VScaleRange);
369  if (VScaleRangeAttr.isValid()) {
370  std::tie(MinSVEVectorSize, MaxSVEVectorSize) =
371  VScaleRangeAttr.getVScaleRangeArgs();
372  MinSVEVectorSize *= 128;
373  MaxSVEVectorSize *= 128;
374  } else {
375  MinSVEVectorSize = SVEVectorBitsMinOpt;
376  MaxSVEVectorSize = SVEVectorBitsMaxOpt;
377  }
378 
379  assert(MinSVEVectorSize % 128 == 0 &&
380  "SVE requires vector length in multiples of 128!");
381  assert(MaxSVEVectorSize % 128 == 0 &&
382  "SVE requires vector length in multiples of 128!");
383  assert((MaxSVEVectorSize >= MinSVEVectorSize || MaxSVEVectorSize == 0) &&
384  "Minimum SVE vector size should not be larger than its maximum!");
385 
386  // Sanitize user input in case of no asserts
387  if (MaxSVEVectorSize == 0)
388  MinSVEVectorSize = (MinSVEVectorSize / 128) * 128;
389  else {
390  MinSVEVectorSize =
391  (std::min(MinSVEVectorSize, MaxSVEVectorSize) / 128) * 128;
392  MaxSVEVectorSize =
393  (std::max(MinSVEVectorSize, MaxSVEVectorSize) / 128) * 128;
394  }
395 
396  Key += "SVEMin";
397  Key += std::to_string(MinSVEVectorSize);
398  Key += "SVEMax";
399  Key += std::to_string(MaxSVEVectorSize);
400  Key += CPU;
401  Key += FS;
402 
403  auto &I = SubtargetMap[Key];
404  if (!I) {
405  // This needs to be done before we create a new subtarget since any
406  // creation will depend on the TM and the code generation flags on the
407  // function that reside in TargetOptions.
409  I = std::make_unique<AArch64Subtarget>(TargetTriple, CPU, FS, *this,
410  isLittle, MinSVEVectorSize,
411  MaxSVEVectorSize);
412  }
413  return I.get();
414 }
415 
416 void AArch64leTargetMachine::anchor() { }
417 
419  const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
422  : AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, JIT, true) {}
423 
424 void AArch64beTargetMachine::anchor() { }
425 
427  const Target &T, const Triple &TT, StringRef CPU, StringRef FS,
430  : AArch64TargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, JIT, false) {}
431 
432 namespace {
433 
434 /// AArch64 Code Generator Pass Configuration Options.
435 class AArch64PassConfig : public TargetPassConfig {
436 public:
437  AArch64PassConfig(AArch64TargetMachine &TM, PassManagerBase &PM)
438  : TargetPassConfig(TM, PM) {
439  if (TM.getOptLevel() != CodeGenOpt::None)
440  substitutePass(&PostRASchedulerID, &PostMachineSchedulerID);
441  }
442 
443  AArch64TargetMachine &getAArch64TargetMachine() const {
444  return getTM<AArch64TargetMachine>();
445  }
446 
448  createMachineScheduler(MachineSchedContext *C) const override {
449  const AArch64Subtarget &ST = C->MF->getSubtarget<AArch64Subtarget>();
451  DAG->addMutation(createLoadClusterDAGMutation(DAG->TII, DAG->TRI));
452  DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
453  if (ST.hasFusion())
454  DAG->addMutation(createAArch64MacroFusionDAGMutation());
455  return DAG;
456  }
457 
459  createPostMachineScheduler(MachineSchedContext *C) const override {
460  const AArch64Subtarget &ST = C->MF->getSubtarget<AArch64Subtarget>();
461  if (ST.hasFusion()) {
462  // Run the Macro Fusion after RA again since literals are expanded from
463  // pseudos then (v. addPreSched2()).
466  return DAG;
467  }
468 
469  return nullptr;
470  }
471 
472  void addIRPasses() override;
473  bool addPreISel() override;
474  bool addInstSelector() override;
475  bool addIRTranslator() override;
476  void addPreLegalizeMachineIR() override;
477  bool addLegalizeMachineIR() override;
478  void addPreRegBankSelect() override;
479  bool addRegBankSelect() override;
480  void addPreGlobalInstructionSelect() override;
481  bool addGlobalInstructionSelect() override;
482  bool addILPOpts() override;
483  void addPreRegAlloc() override;
484  void addPostRegAlloc() override;
485  void addPreSched2() override;
486  void addPreEmitPass() override;
487  void addPreEmitPass2() override;
488 
489  std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
490 };
491 
492 } // end anonymous namespace
493 
496  return TargetTransformInfo(AArch64TTIImpl(this, F));
497 }
498 
500  return new AArch64PassConfig(*this, PM);
501 }
502 
503 std::unique_ptr<CSEConfigBase> AArch64PassConfig::getCSEConfig() const {
504  return getStandardCSEConfigForOpt(TM->getOptLevel());
505 }
506 
507 void AArch64PassConfig::addIRPasses() {
508  // Always expand atomic operations, we don't deal with atomicrmw or cmpxchg
509  // ourselves.
510  addPass(createAtomicExpandPass());
511 
512  // Expand any SVE vector library calls that we can't code generate directly.
513  if (EnableSVEIntrinsicOpts && TM->getOptLevel() == CodeGenOpt::Aggressive)
514  addPass(createSVEIntrinsicOptsPass());
515 
516  // Cmpxchg instructions are often used with a subsequent comparison to
517  // determine whether it succeeded. We can exploit existing control-flow in
518  // ldrex/strex loops to simplify this, but it needs tidying up.
519  if (TM->getOptLevel() != CodeGenOpt::None && EnableAtomicTidy)
521  .forwardSwitchCondToPhi(true)
522  .convertSwitchToLookupTable(true)
523  .needCanonicalLoops(false)
524  .hoistCommonInsts(true)
525  .sinkCommonInsts(true)));
526 
527  // Run LoopDataPrefetch
528  //
529  // Run this before LSR to remove the multiplies involved in computing the
530  // pointer values N iterations ahead.
531  if (TM->getOptLevel() != CodeGenOpt::None) {
533  addPass(createLoopDataPrefetchPass());
536  }
537 
539 
541  /*IsOptNone=*/TM->getOptLevel() == CodeGenOpt::None));
542 
543  // Match interleaved memory accesses to ldN/stN intrinsics.
544  if (TM->getOptLevel() != CodeGenOpt::None) {
546  addPass(createInterleavedAccessPass());
547  }
548 
549  if (TM->getOptLevel() == CodeGenOpt::Aggressive && EnableGEPOpt) {
550  // Call SeparateConstOffsetFromGEP pass to extract constants within indices
551  // and lower a GEP with multiple indices to either arithmetic operations or
552  // multiple GEPs with single index.
554  // Call EarlyCSE pass to find and remove subexpressions in the lowered
555  // result.
556  addPass(createEarlyCSEPass());
557  // Do loop invariant code motion in case part of the lowered result is
558  // invariant.
559  addPass(createLICMPass());
560  }
561 
562  // Add Control Flow Guard checks.
563  if (TM->getTargetTriple().isOSWindows())
564  addPass(createCFGuardCheckPass());
565 }
566 
567 // Pass Pipeline Configuration
568 bool AArch64PassConfig::addPreISel() {
569  // Run promote constant before global merge, so that the promoted constants
570  // get a chance to be merged
571  if (TM->getOptLevel() != CodeGenOpt::None && EnablePromoteConstant)
573  // FIXME: On AArch64, this depends on the type.
574  // Basically, the addressable offsets are up to 4095 * Ty.getSizeInBytes().
575  // and the offset has to be a multiple of the related size in bytes.
576  if ((TM->getOptLevel() != CodeGenOpt::None &&
579  bool OnlyOptimizeForSize = (TM->getOptLevel() < CodeGenOpt::Aggressive) &&
581 
582  // Merging of extern globals is enabled by default on non-Mach-O as we
583  // expect it to be generally either beneficial or harmless. On Mach-O it
584  // is disabled as we emit the .subsections_via_symbols directive which
585  // means that merging extern globals is not safe.
586  bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
587 
588  // FIXME: extern global merging is only enabled when we optimise for size
589  // because there are some regressions with it also enabled for performance.
590  if (!OnlyOptimizeForSize)
591  MergeExternalByDefault = false;
592 
593  addPass(createGlobalMergePass(TM, 4095, OnlyOptimizeForSize,
594  MergeExternalByDefault));
595  }
596 
597  return false;
598 }
599 
600 bool AArch64PassConfig::addInstSelector() {
601  addPass(createAArch64ISelDag(getAArch64TargetMachine(), getOptLevel()));
602 
603  // For ELF, cleanup any local-dynamic TLS accesses (i.e. combine as many
604  // references to _TLS_MODULE_BASE_ as possible.
605  if (TM->getTargetTriple().isOSBinFormatELF() &&
606  getOptLevel() != CodeGenOpt::None)
608 
609  return false;
610 }
611 
612 bool AArch64PassConfig::addIRTranslator() {
613  addPass(new IRTranslator(getOptLevel()));
614  return false;
615 }
616 
617 void AArch64PassConfig::addPreLegalizeMachineIR() {
618  if (getOptLevel() == CodeGenOpt::None)
620  else
622 }
623 
624 bool AArch64PassConfig::addLegalizeMachineIR() {
625  addPass(new Legalizer());
626  return false;
627 }
628 
629 void AArch64PassConfig::addPreRegBankSelect() {
630  bool IsOptNone = getOptLevel() == CodeGenOpt::None;
631  if (!IsOptNone)
632  addPass(createAArch64PostLegalizerCombiner(IsOptNone));
634 }
635 
636 bool AArch64PassConfig::addRegBankSelect() {
637  addPass(new RegBankSelect());
638  return false;
639 }
640 
641 void AArch64PassConfig::addPreGlobalInstructionSelect() {
642  addPass(new Localizer());
643 }
644 
645 bool AArch64PassConfig::addGlobalInstructionSelect() {
646  addPass(new InstructionSelect(getOptLevel()));
647  if (getOptLevel() != CodeGenOpt::None)
649  return false;
650 }
651 
652 bool AArch64PassConfig::addILPOpts() {
653  if (EnableCondOpt)
655  if (EnableCCMP)
657  if (EnableMCR)
658  addPass(&MachineCombinerID);
659  if (EnableCondBrTuning)
660  addPass(createAArch64CondBrTuning());
662  addPass(&EarlyIfConverterID);
666  if (TM->getOptLevel() != CodeGenOpt::None)
668  return true;
669 }
670 
671 void AArch64PassConfig::addPreRegAlloc() {
672  // Change dead register definitions to refer to the zero register.
673  if (TM->getOptLevel() != CodeGenOpt::None && EnableDeadRegisterElimination)
675 
676  // Use AdvSIMD scalar instructions whenever profitable.
677  if (TM->getOptLevel() != CodeGenOpt::None && EnableAdvSIMDScalar) {
678  addPass(createAArch64AdvSIMDScalar());
679  // The AdvSIMD pass may produce copies that can be rewritten to
680  // be register coalescer friendly.
681  addPass(&PeepholeOptimizerID);
682  }
683 }
684 
685 void AArch64PassConfig::addPostRegAlloc() {
686  // Remove redundant copy instructions.
687  if (TM->getOptLevel() != CodeGenOpt::None && EnableRedundantCopyElimination)
689 
690  if (TM->getOptLevel() != CodeGenOpt::None && usingDefaultRegAlloc())
691  // Improve performance for some FP/SIMD code for A57.
693 }
694 
695 void AArch64PassConfig::addPreSched2() {
696  // Lower homogeneous frame instructions
699  // Expand some pseudo instructions to allow proper scheduling.
701  // Use load/store pair instructions when possible.
702  if (TM->getOptLevel() != CodeGenOpt::None) {
703  if (EnableLoadStoreOpt)
705  }
706 
707  // The AArch64SpeculationHardeningPass destroys dominator tree and natural
708  // loop info, which is needed for the FalkorHWPFFixPass and also later on.
709  // Therefore, run the AArch64SpeculationHardeningPass before the
710  // FalkorHWPFFixPass to avoid recomputing dominator tree and natural loop
711  // info.
713 
714  addPass(createAArch64IndirectThunks());
716 
717  if (TM->getOptLevel() != CodeGenOpt::None) {
719  addPass(createFalkorHWPFFixPass());
720  }
721 }
722 
723 void AArch64PassConfig::addPreEmitPass() {
724  // Machine Block Placement might have created new opportunities when run
725  // at O3, where the Tail Duplication Threshold is set to 4 instructions.
726  // Run the load/store optimizer once more.
727  if (TM->getOptLevel() >= CodeGenOpt::Aggressive && EnableLoadStoreOpt)
729 
730  if (EnableA53Fix835769)
731  addPass(createAArch64A53Fix835769());
732 
735 
736  // Relax conditional branch instructions if they're otherwise out of
737  // range of their destination.
738  if (BranchRelaxation)
739  addPass(&BranchRelaxationPassID);
740 
741  if (TM->getTargetTriple().isOSWindows()) {
742  // Identify valid longjmp targets for Windows Control Flow Guard.
743  addPass(createCFGuardLongjmpPass());
744  // Identify valid eh continuation targets for Windows EHCont Guard.
746  }
747 
748  if (TM->getOptLevel() != CodeGenOpt::None && EnableCompressJumpTables)
750 
751  if (TM->getOptLevel() != CodeGenOpt::None && EnableCollectLOH &&
752  TM->getTargetTriple().isOSBinFormatMachO())
753  addPass(createAArch64CollectLOHPass());
754 }
755 
756 void AArch64PassConfig::addPreEmitPass2() {
757  // SVE bundles move prefixes with destructive operations. BLR_RVMARKER pseudo
758  // instructions are lowered to bundles as well.
759  addPass(createUnpackMachineBundles(nullptr));
760 }
761 
764  return new yaml::AArch64FunctionInfo();
765 }
766 
769  const auto *MFI = MF.getInfo<AArch64FunctionInfo>();
770  return new yaml::AArch64FunctionInfo(*MFI);
771 }
772 
775  SMDiagnostic &Error, SMRange &SourceRange) const {
776  const auto &YamlMFI =
777  reinterpret_cast<const yaml::AArch64FunctionInfo &>(MFI);
778  MachineFunction &MF = PFS.MF;
779  MF.getInfo<AArch64FunctionInfo>()->initializeBaseYamlFields(YamlMFI);
780  return false;
781 }
llvm::initializeAArch64A57FPLoadBalancingPass
void initializeAArch64A57FPLoadBalancingPass(PassRegistry &)
computeDefaultCPU
static StringRef computeDefaultCPU(const Triple &TT, StringRef CPU)
Definition: AArch64TargetMachine.cpp:247
createTLOF
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
Definition: AArch64TargetMachine.cpp:221
llvm::TargetMachine::getOptLevel
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
Definition: TargetMachine.cpp:185
EnableBranchTargets
static cl::opt< bool > EnableBranchTargets("aarch64-enable-branch-targets", cl::Hidden, cl::desc("Enable the AArch64 branch target pass"), cl::init(true))
EnableStPairSuppress
static cl::opt< bool > EnableStPairSuppress("aarch64-enable-stp-suppress", cl::desc("Suppress STP for AArch64"), cl::init(true), cl::Hidden)
llvm::createAArch64LowerHomogeneousPrologEpilogPass
ModulePass * createAArch64LowerHomogeneousPrologEpilogPass()
Definition: AArch64LowerHomogeneousPrologEpilog.cpp:612
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
AArch64MachineFunctionInfo.h
llvm::Attribute::isValid
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:167
llvm::initializeAArch64StackTaggingPass
void initializeAArch64StackTaggingPass(PassRegistry &)
llvm::createSeparateConstOffsetFromGEPPass
FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
Definition: SeparateConstOffsetFromGEP.cpp:499
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
AArch64.h
llvm::Triple::GNUILP32
@ GNUILP32
Definition: Triple.h:213
llvm::createAArch64PromoteConstantPass
ModulePass * createAArch64PromoteConstantPass()
Definition: AArch64PromoteConstant.cpp:235
MCTargetOptions.h
llvm::PeepholeOptimizerID
char & PeepholeOptimizerID
PeepholeOptimizer - This pass performs peephole optimizations - like extension and comparison elimina...
Definition: PeepholeOptimizer.cpp:443
llvm::initializeAArch64BranchTargetsPass
void initializeAArch64BranchTargetsPass(PassRegistry &)
llvm::TargetOptions
Definition: TargetOptions.h:124
Scalar.h
T
llvm::initializeAArch64O0PreLegalizerCombinerPass
void initializeAArch64O0PreLegalizerCombinerPass(PassRegistry &)
llvm::Function
Definition: Function.h:61
llvm::Attribute
Definition: Attributes.h:52
Pass.h
llvm::yaml::MachineFunctionInfo
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
Definition: MIRYamlMapping.h:673
EnableGlobalISelAtO
static cl::opt< int > EnableGlobalISelAtO("aarch64-enable-global-isel-at-O", cl::Hidden, cl::desc("Enable GlobalISel at or below an opt level (-1 to disable)"), cl::init(0))
CSEConfigBase.h
llvm::createAArch64SpeculationHardeningPass
FunctionPass * createAArch64SpeculationHardeningPass()
Returns an instance of the pseudo instruction expansion pass.
Definition: AArch64SpeculationHardening.cpp:700
llvm::createCFGSimplificationPass
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
Definition: SimplifyCFGPass.cpp:415
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
EnableRedundantCopyElimination
static cl::opt< bool > EnableRedundantCopyElimination("aarch64-enable-copyelim", cl::desc("Enable the redundant copy elimination pass"), cl::init(true), cl::Hidden)
llvm::RISCVFenceField::W
@ W
Definition: RISCVBaseInfo.h:199
EnableCompressJumpTables
static cl::opt< bool > EnableCompressJumpTables("aarch64-enable-compress-jump-tables", cl::Hidden, cl::init(true), cl::desc("Use smallest entry possible for jump tables"))
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:168
llvm::initializeAArch64DeadRegisterDefinitionsPass
void initializeAArch64DeadRegisterDefinitionsPass(PassRegistry &)
llvm::createAArch64CondBrTuning
FunctionPass * createAArch64CondBrTuning()
Definition: AArch64CondBrTuning.cpp:328
llvm::getTheAArch64_32Target
Target & getTheAArch64_32Target()
Definition: AArch64TargetInfo.cpp:21
llvm::AArch64beTargetMachine::AArch64beTargetMachine
AArch64beTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: AArch64TargetMachine.cpp:426
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::createEarlyCSEPass
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1729
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::createAArch64DeadRegisterDefinitions
FunctionPass * createAArch64DeadRegisterDefinitions()
Definition: AArch64DeadRegisterDefinitionsPass.cpp:201
llvm::createAArch64BranchTargetsPass
FunctionPass * createAArch64BranchTargetsPass()
EnableAdvSIMDScalar
static cl::opt< bool > EnableAdvSIMDScalar("aarch64-enable-simd-scalar", cl::desc("Enable use of AdvSIMD scalar integer instructions"), cl::init(false), cl::Hidden)
EnableHomogeneousPrologEpilog
cl::opt< bool > EnableHomogeneousPrologEpilog
llvm::TargetMachine::setSupportsDefaultOutlining
void setSupportsDefaultOutlining(bool Enable)
Definition: TargetMachine.h:255
llvm::AArch64TargetMachine::convertFuncInfoToYAML
yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const override
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
Definition: AArch64TargetMachine.cpp:768
llvm::initializeAArch64CompressJumpTablesPass
void initializeAArch64CompressJumpTablesPass(PassRegistry &)
llvm::TargetOptions::TrapUnreachable
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
Definition: TargetOptions.h:268
llvm::initializeAArch64A53Fix835769Pass
void initializeAArch64A53Fix835769Pass(PassRegistry &)
InstructionSelect.h
llvm::createSVEIntrinsicOptsPass
ModulePass * createSVEIntrinsicOptsPass()
Definition: SVEIntrinsicOpts.cpp:83
llvm::Optional< Reloc::Model >
llvm::initializeGlobalISel
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Definition: GlobalISel.cpp:18
llvm::createAArch64A57FPLoadBalancing
FunctionPass * createAArch64A57FPLoadBalancing()
Definition: AArch64A57FPLoadBalancing.cpp:721
llvm::createAArch64PostSelectOptimize
FunctionPass * createAArch64PostSelectOptimize()
Definition: AArch64PostSelectOptimize.cpp:195
llvm::initializeAArch64LowerHomogeneousPrologEpilogPass
void initializeAArch64LowerHomogeneousPrologEpilogPass(PassRegistry &)
llvm::initializeAArch64SIMDInstrOptPass
void initializeAArch64SIMDInstrOptPass(PassRegistry &)
llvm::createAArch64PreLegalizerCombiner
FunctionPass * createAArch64PreLegalizerCombiner()
Definition: AArch64PreLegalizerCombiner.cpp:369
STLExtras.h
llvm::initializeAArch64PromoteConstantPass
void initializeAArch64PromoteConstantPass(PassRegistry &)
llvm::createAArch64SIMDInstrOptPass
FunctionPass * createAArch64SIMDInstrOptPass()
Returns an instance of the high cost ASIMD instruction replacement optimization pass.
Definition: AArch64SIMDInstrOpt.cpp:741
llvm::CodeModel::Kernel
@ Kernel
Definition: CodeGen.h:28
llvm::Triple::aarch64_32
@ aarch64_32
Definition: Triple.h:54
llvm::createAArch64LoadStoreOptimizationPass
FunctionPass * createAArch64LoadStoreOptimizationPass()
createAArch64LoadStoreOptimizationPass - returns an instance of the load / store optimization pass.
Definition: AArch64LoadStoreOptimizer.cpp:2305
LLVMInitializeAArch64Target
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAArch64Target()
Definition: AArch64TargetMachine.cpp:178
llvm::AArch64TargetMachine::SubtargetMap
StringMap< std::unique_ptr< AArch64Subtarget > > SubtargetMap
Definition: AArch64TargetMachine.h:28
llvm::initializeFalkorHWPFFixPass
void initializeFalkorHWPFFixPass(PassRegistry &)
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::createAArch64A53Fix835769
FunctionPass * createAArch64A53Fix835769()
Definition: AArch64A53Fix835769.cpp:242
llvm::Reloc::Model
Model
Definition: CodeGen.h:22
BranchRelaxation
static cl::opt< bool > BranchRelaxation("aarch64-enable-branch-relax", cl::Hidden, cl::init(true), cl::desc("Relax out of range conditional branches"))
CommandLine.h
llvm::createAArch64PostLegalizerLowering
FunctionPass * createAArch64PostLegalizerLowering()
Definition: AArch64PostLegalizerLowering.cpp:1067
AArch64TargetMachine.h
EnableA53Fix835769
static cl::opt< bool > EnableA53Fix835769("aarch64-fix-cortex-a53-835769", cl::Hidden, cl::desc("Work around Cortex-A53 erratum 835769"), cl::init(false))
llvm::createEHContGuardCatchretPass
FunctionPass * createEHContGuardCatchretPass()
Creates EHContGuard catchret target identification pass.
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::createAArch64CompressJumpTablesPass
FunctionPass * createAArch64CompressJumpTablesPass()
Definition: AArch64CompressJumpTables.cpp:186
llvm::TargetMachine::setMachineOutliner
void setMachineOutliner(bool Enable)
Definition: TargetMachine.h:252
llvm::initializeAArch64ExpandPseudoPass
void initializeAArch64ExpandPseudoPass(PassRegistry &)
llvm::getTheAArch64leTarget
Target & getTheAArch64leTarget()
Definition: AArch64TargetInfo.cpp:13
llvm::MachineFunction::getInfo
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Definition: MachineFunction.h:724
llvm::initializeAArch64StorePairSuppressPass
void initializeAArch64StorePairSuppressPass(PassRegistry &)
llvm::Legalizer
Definition: Legalizer.h:31
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
EnableFalkorHWPFFix
static cl::opt< bool > EnableFalkorHWPFFix("aarch64-enable-falkor-hwpf-fix", cl::init(true), cl::Hidden)
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
llvm::SMDiagnostic
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:251
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
llvm::createAArch64StorePairSuppressPass
FunctionPass * createAArch64StorePairSuppressPass()
false
Definition: StackSlotColoring.cpp:142
llvm::EarlyIfConverterID
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
Definition: EarlyIfConversion.cpp:784
llvm::createGenericSchedPostRA
ScheduleDAGMI * createGenericSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
Definition: MachineScheduler.cpp:3646
llvm::CodeModel::Small
@ Small
Definition: CodeGen.h:28
EnableAtomicTidy
static cl::opt< bool > EnableAtomicTidy("aarch64-enable-atomic-cfg-tidy", cl::Hidden, cl::desc("Run SimplifyCFG after expanding atomic operations" " to make use of cmpxchg flow-based information"), cl::init(true))
llvm::Attribute::getVScaleRangeArgs
std::pair< unsigned, unsigned > getVScaleRangeArgs() const
Returns the argument numbers for the vscale_range attribute (or pair(0, 0) if not known).
Definition: Attributes.cpp:357
llvm::createAtomicExpandPass
FunctionPass * createAtomicExpandPass()
llvm::InstructionSelect
This pass is responsible for selecting generic machine instructions to target-specific instructions.
Definition: InstructionSelect.h:31
llvm::RegisterTargetMachine
RegisterTargetMachine - Helper template for registering a target machine implementation,...
Definition: TargetRegistry.h:1275
llvm::ScheduleDAGMI::addMutation
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.
Definition: MachineScheduler.h:318
AArch64TargetObjectFile.h
llvm::AArch64TargetMachine
Definition: AArch64TargetMachine.h:25
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::createAArch64ISelDag
FunctionPass * createAArch64ISelDag(AArch64TargetMachine &TM, CodeGenOpt::Level OptLevel)
createAArch64ISelDag - This pass converts a legalized DAG into a AArch64-specific DAG,...
Definition: AArch64ISelDAGToDAG.cpp:4904
EnableCollectLOH
static cl::opt< bool > EnableCollectLOH("aarch64-enable-collect-loh", cl::desc("Enable the pass that emits the linker optimization hints (LOH)"), cl::init(true), cl::Hidden)
llvm::initializeAArch64SLSHardeningPass
void initializeAArch64SLSHardeningPass(PassRegistry &)
llvm::TargetMachine::TargetFS
std::string TargetFS
Definition: TargetMachine.h:100
llvm::StringRef::str
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:245
llvm::Attribute::getValueAsString
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:301
llvm::createAArch64IndirectThunks
FunctionPass * createAArch64IndirectThunks()
Definition: AArch64SLSHardening.cpp:434
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
AArch64MacroFusion.h
llvm::TargetMachine::resetTargetOptions
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
Definition: TargetMachine.cpp:56
llvm::AArch64TargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: AArch64TargetMachine.cpp:495
llvm::SmallString
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:25
llvm::CodeModel::Model
Model
Definition: CodeGen.h:28
Passes.h
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::cl::opt< bool >
llvm::createFalkorHWPFFixPass
FunctionPass * createFalkorHWPFFixPass()
Definition: AArch64FalkorHWPFFix.cpp:839
llvm::TargetMachine::TargetTriple
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
Definition: TargetMachine.h:98
getEffectiveAArch64CodeModel
static CodeModel::Model getEffectiveAArch64CodeModel(const Triple &TT, Optional< CodeModel::Model > CM, bool JIT)
Definition: AArch64TargetMachine.cpp:267
llvm::cl::BOU_UNSET
@ BOU_UNSET
Definition: CommandLine.h:625
llvm::initializeAArch64ConditionalComparesPass
void initializeAArch64ConditionalComparesPass(PassRegistry &)
llvm::initializeAArch64SpeculationHardeningPass
void initializeAArch64SpeculationHardeningPass(PassRegistry &)
llvm::AArch64TTIImpl
Definition: AArch64TargetTransformInfo.h:41
llvm::initializeAArch64PostSelectOptimizePass
void initializeAArch64PostSelectOptimizePass(PassRegistry &)
CFGuard.h
llvm::createGenericSchedLive
ScheduleDAGMILive * createGenericSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
Definition: MachineScheduler.cpp:3489
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:524
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
EnableGlobalMerge
static cl::opt< cl::boolOrDefault > EnableGlobalMerge("aarch64-enable-global-merge", cl::Hidden, cl::desc("Enable the global merge pass"))
llvm::createAArch64ExpandPseudoPass
FunctionPass * createAArch64ExpandPseudoPass()
Returns an instance of the pseudo instruction expansion pass.
Definition: AArch64ExpandPseudoInsts.cpp:1263
llvm::createAArch64RedundantCopyEliminationPass
FunctionPass * createAArch64RedundantCopyEliminationPass()
Definition: AArch64RedundantCopyElimination.cpp:495
llvm::initializeAArch64CollectLOHPass
void initializeAArch64CollectLOHPass(PassRegistry &)
llvm::initializeAArch64PostLegalizerLoweringPass
void initializeAArch64PostLegalizerLoweringPass(PassRegistry &)
computeDataLayout
static std::string computeDataLayout(const Triple &TT, const MCTargetOptions &Options, bool LittleEndian)
Definition: AArch64TargetMachine.cpp:231
llvm::MachineSchedContext
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
Definition: MachineScheduler.h:120
EnableMCR
static cl::opt< bool > EnableMCR("aarch64-enable-mcr", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
llvm::AArch64FunctionInfo
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
Definition: AArch64MachineFunctionInfo.h:37
llvm::TargetOptions::NoTrapAfterNoreturn
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for 'unreachable' IR instructions behind noreturn calls,...
Definition: TargetOptions.h:272
llvm::initializeAArch64AdvSIMDScalarPass
void initializeAArch64AdvSIMDScalarPass(PassRegistry &)
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::TargetPassConfig::addIRPasses
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
Definition: TargetPassConfig.cpp:850
llvm::createUnpackMachineBundles
FunctionPass * createUnpackMachineBundles(std::function< bool(const MachineFunction &)> Ftor)
Definition: MachineInstrBundle.cpp:80
EnableEarlyIfConversion
static cl::opt< bool > EnableEarlyIfConversion("aarch64-enable-early-ifcvt", cl::Hidden, cl::desc("Run early if-conversion"), cl::init(true))
EnableCondBrTuning
static cl::opt< bool > EnableCondBrTuning("aarch64-enable-cond-br-tune", cl::desc("Enable the conditional branch tuning pass"), cl::init(true), cl::Hidden)
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
TargetPassConfig.h
Localizer.h
llvm::initializeAArch64PreLegalizerCombinerPass
void initializeAArch64PreLegalizerCombinerPass(PassRegistry &)
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::createAArch64PostLegalizerCombiner
FunctionPass * createAArch64PostLegalizerCombiner(bool IsOptNone)
Definition: AArch64PostLegalizerCombiner.cpp:381
llvm::TargetOptions::TLSSize
unsigned TLSSize
Bit size of immediate TLS offsets (0 == use the default).
Definition: TargetOptions.h:275
llvm::createCFGuardCheckPass
FunctionPass * createCFGuardCheckPass()
Insert Control FLow Guard checks on indirect function calls.
Definition: CFGuard.cpp:294
llvm::initializeLDTLSCleanupPass
void initializeLDTLSCleanupPass(PassRegistry &)
EnableLoadStoreOpt
static cl::opt< bool > EnableLoadStoreOpt("aarch64-enable-ldst-opt", cl::desc("Enable the load/store pair" " optimization pass"), cl::init(true), cl::Hidden)
llvm::ScheduleDAGMI
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
Definition: MachineScheduler.h:266
llvm::CodeGenOpt::Aggressive
@ Aggressive
Definition: CodeGen.h:56
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
llvm::Reloc::DynamicNoPIC
@ DynamicNoPIC
Definition: CodeGen.h:22
llvm::MachineFunction
Definition: MachineFunction.h:230
Triple.h
llvm::getTheARM64_32Target
Target & getTheARM64_32Target()
Definition: AArch64TargetInfo.cpp:29
llvm::CodeGenOpt::None
@ None
Definition: CodeGen.h:53
TargetOptions.h
llvm::AArch64::RM
@ RM
Definition: AArch64ISelLowering.h:472
EnableGEPOpt
static cl::opt< bool > EnableGEPOpt("aarch64-enable-gep-opt", cl::Hidden, cl::desc("Enable optimizations on complex GEPs"), cl::init(false))
llvm::TargetMachine::getMCAsmInfo
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
Definition: TargetMachine.h:207
llvm::initializeAArch64StackTaggingPreRAPass
void initializeAArch64StackTaggingPreRAPass(PassRegistry &)
llvm::initializeAArch64PostLegalizerCombinerPass
void initializeAArch64PostLegalizerCombinerPass(PassRegistry &)
llvm::min
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:357
MCAsmInfo.h
llvm::Reloc::PIC_
@ PIC_
Definition: CodeGen.h:22
llvm::createAArch64SLSHardeningPass
FunctionPass * createAArch64SLSHardeningPass()
Definition: AArch64SLSHardening.cpp:394
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::createAArch64StackTaggingPreRAPass
FunctionPass * createAArch64StackTaggingPreRAPass()
Definition: AArch64StackTaggingPreRA.cpp:99
TargetLoweringObjectFile.h
llvm::Reloc::Static
@ Static
Definition: CodeGen.h:22
llvm::getStandardCSEConfigForOpt
std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOpt::Level Level)
Definition: CSEInfo.cpp:74
IRTranslator.h
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::CodeModel::Tiny
@ Tiny
Definition: CodeGen.h:28
llvm::getEffectiveRelocModel
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
Definition: AVRTargetMachine.cpp:40
llvm::LLVMTargetMachine::initAsmInfo
void initAsmInfo()
Definition: LLVMTargetMachine.cpp:41
EnableSVEIntrinsicOpts
static cl::opt< bool > EnableSVEIntrinsicOpts("aarch64-enable-sve-intrinsic-opts", cl::Hidden, cl::desc("Enable SVE intrinsic opts"), cl::init(true))
AArch64TargetTransformInfo.h
llvm::createInterleavedAccessPass
FunctionPass * createInterleavedAccessPass()
InterleavedAccess Pass - This pass identifies and matches interleaved memory accesses to target speci...
Definition: InterleavedAccessPass.cpp:145
llvm::AArch64TargetMachine::parseMachineFunctionInfo
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const override
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
Definition: AArch64TargetMachine.cpp:773
Attributes.h
llvm::PerFunctionMIParsingState
Definition: MIParser.h:162
llvm::initializeAArch64RedundantCopyEliminationPass
void initializeAArch64RedundantCopyEliminationPass(PassRegistry &)
llvm::initializeFalkorMarkStridedAccessesLegacyPass
void initializeFalkorMarkStridedAccessesLegacyPass(PassRegistry &)
llvm::initializeAArch64LoadStoreOptPass
void initializeAArch64LoadStoreOptPass(PassRegistry &)
llvm::TargetMachine::setGlobalISelAbort
void setGlobalISelAbort(GlobalISelAbortMode Mode)
Definition: TargetMachine.h:249
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::createLoadClusterDAGMutation
std::unique_ptr< ScheduleDAGMutation > createLoadClusterDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
Definition: MachineScheduler.cpp:1573
RegBankSelect.h
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::createAArch64MacroFusionDAGMutation
std::unique_ptr< ScheduleDAGMutation > createAArch64MacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createAArch64MacroFusionDAGMutation()); to AArch64PassConf...
Definition: AArch64MacroFusion.cpp:413
EnableCondOpt
static cl::opt< bool > EnableCondOpt("aarch64-enable-condopt", cl::desc("Enable the condition optimizer pass"), cl::init(true), cl::Hidden)
Function.h
llvm::getTheAArch64beTarget
Target & getTheAArch64beTarget()
Definition: AArch64TargetInfo.cpp:17
llvm::createAArch64CollectLOHPass
FunctionPass * createAArch64CollectLOHPass()
Definition: AArch64CollectLOH.cpp:597
llvm::createAArch64O0PreLegalizerCombiner
FunctionPass * createAArch64O0PreLegalizerCombiner()
Definition: AArch64O0PreLegalizerCombiner.cpp:170
llvm::TargetMachine::getCodeModel
CodeModel::Model getCodeModel() const
Returns the code model.
Definition: TargetMachine.cpp:74
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:393
AArch64MCTargetDesc.h
llvm::initializeSVEIntrinsicOptsPass
void initializeSVEIntrinsicOptsPass(PassRegistry &)
llvm::TargetMachine::setGlobalISel
void setGlobalISel(bool Enable)
Definition: TargetMachine.h:248
llvm::PerFunctionMIParsingState::MF
MachineFunction & MF
Definition: MIParser.h:164
llvm::AArch64TargetMachine::createPassConfig
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition: AArch64TargetMachine.cpp:499
llvm::createGlobalMergePass
Pass * createGlobalMergePass(const TargetMachine *TM, unsigned MaximalOffset, bool OnlyOptimizeForSize=false, bool MergeExternalByDefault=false)
GlobalMerge - This pass merges internal (by default) globals into structs to enable reuse of a base p...
Definition: GlobalMerge.cpp:680
llvm::BranchRelaxationPassID
char & BranchRelaxationPassID
BranchRelaxation - This pass replaces branches that need to jump further than is supported by a branc...
Definition: BranchRelaxation.cpp:119
EnableLoopDataPrefetch
static cl::opt< bool > EnableLoopDataPrefetch("aarch64-enable-loop-data-prefetch", cl::Hidden, cl::desc("Enable the loop data prefetch pass"), cl::init(true))
CodeGen.h
llvm::CodeModel::Large
@ Large
Definition: CodeGen.h:28
EnableCCMP
static cl::opt< bool > EnableCCMP("aarch64-enable-ccmp", cl::desc("Enable the CCMP formation pass"), cl::init(true), cl::Hidden)
llvm::cl::BOU_TRUE
@ BOU_TRUE
Definition: CommandLine.h:625
Legalizer.h
llvm::SimplifyCFGOptions
Definition: SimplifyCFGOptions.h:23
llvm::createLICMPass
Pass * createLICMPass()
Definition: LICM.cpp:327
MachineScheduler.h
AArch64Subtarget.h
EnableDeadRegisterElimination
static cl::opt< bool > EnableDeadRegisterElimination("aarch64-enable-dead-defs", cl::Hidden, cl::desc("Enable the pass that removes dead" " definitons and replaces stores to" " them with stores to the zero" " register"), cl::init(true))
llvm::createAArch64AdvSIMDScalar
FunctionPass * createAArch64AdvSIMDScalar()
Definition: AArch64AdvSIMDScalarPass.cpp:410
llvm::PostRASchedulerID
char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
Definition: PostRASchedulerList.cpp:199
SVEVectorBitsMinOpt
static cl::opt< unsigned > SVEVectorBitsMinOpt("aarch64-sve-vector-bits-min", cl::desc("Assume SVE vector registers are at least this big, " "with zero meaning no minimum size is assumed."), cl::init(0), cl::Hidden)
llvm::createAArch64StackTaggingPass
FunctionPass * createAArch64StackTaggingPass(bool IsOptNone)
Definition: AArch64StackTagging.cpp:353
llvm::SMRange
Represents a range in source code.
Definition: SMLoc.h:48
llvm::getTheARM64Target
Target & getTheARM64Target()
Definition: AArch64TargetInfo.cpp:25
llvm::createAArch64ConditionOptimizerPass
FunctionPass * createAArch64ConditionOptimizerPass()
Definition: AArch64ConditionOptimizer.cpp:133
llvm::to_string
std::string to_string(const T &Value)
Definition: ScopedPrinter.h:63
llvm::max
Align max(MaybeAlign Lhs, Align Rhs)
Definition: Alignment.h:340
llvm::MachineCombinerID
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
Definition: MachineCombiner.cpp:130
TargetTransformInfo.h
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
llvm::createStoreClusterDAGMutation
std::unique_ptr< ScheduleDAGMutation > createStoreClusterDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
Definition: MachineScheduler.cpp:1580
llvm::IRTranslator
Definition: IRTranslator.h:62
llvm::GlobalISelAbortMode::Disable
@ Disable
EnablePromoteConstant
static cl::opt< bool > EnablePromoteConstant("aarch64-enable-promote-const", cl::desc("Enable the promote constant pass"), cl::init(true), cl::Hidden)
llvm::AArch64TargetMachine::AArch64TargetMachine
AArch64TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT, bool IsLittleEndian)
Create an AArch64 architecture model.
Definition: AArch64TargetMachine.cpp:291
llvm::initializeAArch64ConditionOptimizerPass
void initializeAArch64ConditionOptimizerPass(PassRegistry &)
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::RegBankSelect
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Definition: RegBankSelect.h:91
llvm::createInterleavedLoadCombinePass
FunctionPass * createInterleavedLoadCombinePass()
InterleavedLoadCombines Pass - This pass identifies interleaved loads and combines them into wide loa...
Definition: InterleavedLoadCombinePass.cpp:1363
llvm::TargetMachine::setSupportsDebugEntryValues
void setSupportsDebugEntryValues(bool Enable)
Definition: TargetMachine.h:258
llvm::createAArch64CleanupLocalDynamicTLSPass
FunctionPass * createAArch64CleanupLocalDynamicTLSPass()
llvm::PostMachineSchedulerID
char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
Definition: MachineScheduler.cpp:241
llvm::cl::desc
Definition: CommandLine.h:414
llvm::ScheduleDAGMILive
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
Definition: MachineScheduler.h:385
llvm::ScheduleDAGInstrs
A ScheduleDAG for scheduling lists of MachineInstr.
Definition: ScheduleDAGInstrs.h:119
llvm::AArch64Subtarget
Definition: AArch64Subtarget.h:38
llvm::createAArch64ConditionalCompares
FunctionPass * createAArch64ConditionalCompares()
Definition: AArch64ConditionalCompares.cpp:805
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1853
llvm::createFalkorMarkStridedAccessesPass
FunctionPass * createFalkorMarkStridedAccessesPass()
Definition: AArch64FalkorHWPFFix.cpp:116
TargetRegistry.h
llvm::AArch64TargetMachine::createDefaultFuncInfoYAML
yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const override
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
Definition: AArch64TargetMachine.cpp:763
InitializePasses.h
SVEVectorBitsMaxOpt
static cl::opt< unsigned > SVEVectorBitsMaxOpt("aarch64-sve-vector-bits-max", cl::desc("Assume SVE vector registers are at most this big, " "with zero meaning no maximum size is assumed."), cl::init(0), cl::Hidden)
llvm::AArch64leTargetMachine::AArch64leTargetMachine
AArch64leTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: AArch64TargetMachine.cpp:418
llvm::TargetMachine::TargetCPU
std::string TargetCPU
Definition: TargetMachine.h:99
llvm::yaml::AArch64FunctionInfo
Definition: AArch64MachineFunctionInfo.h:420
llvm::createLoopDataPrefetchPass
FunctionPass * createLoopDataPrefetchPass()
Definition: LoopDataPrefetch.cpp:155
MIParser.h
AArch64TargetInfo.h
llvm::createCFGuardLongjmpPass
FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
llvm::AArch64TargetMachine::~AArch64TargetMachine
~AArch64TargetMachine() override
llvm::Localizer
This pass implements the localization mechanism described at the top of this file.
Definition: Localizer.h:40
llvm::AArch64TargetMachine::getSubtargetImpl
const AArch64Subtarget * getSubtargetImpl() const =delete