LLVM 22.0.0git
ARMTargetMachine.cpp
Go to the documentation of this file.
1//===-- ARMTargetMachine.cpp - Define TargetMachine for ARM ---------------===//
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 "ARMTargetMachine.h"
13#include "ARM.h"
14#include "ARMLatencyMutations.h"
16#include "ARMMacroFusion.h"
17#include "ARMSubtarget.h"
18#include "ARMTargetObjectFile.h"
22#include "llvm/ADT/StringRef.h"
35#include "llvm/CodeGen/Passes.h"
37#include "llvm/IR/Attributes.h"
38#include "llvm/IR/DataLayout.h"
39#include "llvm/IR/Function.h"
41#include "llvm/Pass.h"
52#include "llvm/Transforms/IPO.h"
54#include <cassert>
55#include <memory>
56#include <optional>
57#include <string>
58
59using namespace llvm;
60
61static cl::opt<bool>
62DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
63 cl::desc("Inhibit optimization of S->D register accesses on A15"),
64 cl::init(false));
65
66static cl::opt<bool>
67EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden,
68 cl::desc("Run SimplifyCFG after expanding atomic operations"
69 " to make use of cmpxchg flow-based information"),
70 cl::init(true));
71
72static cl::opt<bool>
73EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden,
74 cl::desc("Enable ARM load/store optimization pass"),
75 cl::init(true));
76
77// FIXME: Unify control over GlobalMerge.
79EnableGlobalMerge("arm-global-merge", cl::Hidden,
80 cl::desc("Enable the global merge pass"));
81
82namespace llvm {
84}
85
87 // Register the target.
92
114}
115
116static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
117 if (TT.isOSBinFormatMachO())
118 return std::make_unique<TargetLoweringObjectFileMachO>();
119 if (TT.isOSWindows())
120 return std::make_unique<TargetLoweringObjectFileCOFF>();
121 return std::make_unique<ARMElfTargetObjectFile>();
122}
123
124static std::string computeDataLayout(const Triple &TT,
125 const TargetOptions &Options,
126 bool isLittle) {
127 auto ABI = ARM::computeTargetABI(TT, Options.MCOptions.ABIName);
128 std::string Ret;
129
130 if (isLittle)
131 // Little endian.
132 Ret += "e";
133 else
134 // Big endian.
135 Ret += "E";
136
138
139 // Pointers are 32 bits and aligned to 32 bits.
140 Ret += "-p:32:32";
141
142 // Function pointers are aligned to 8 bits (because the LSB stores the
143 // ARM/Thumb state).
144 Ret += "-Fi8";
145
146 // ABIs other than APCS have 64 bit integers with natural alignment.
147 if (ABI != ARM::ARM_ABI_APCS)
148 Ret += "-i64:64";
149
150 // We have 64 bits floats. The APCS ABI requires them to be aligned to 32
151 // bits, others to 64 bits. We always try to align to 64 bits.
152 if (ABI == ARM::ARM_ABI_APCS)
153 Ret += "-f64:32:64";
154
155 // We have 128 and 64 bit vectors. The APCS ABI aligns them to 32 bits, others
156 // to 64. We always ty to give them natural alignment.
157 if (ABI == ARM::ARM_ABI_APCS)
158 Ret += "-v64:32:64-v128:32:128";
159 else if (ABI != ARM::ARM_ABI_AAPCS16)
160 Ret += "-v128:64:128";
161
162 // Try to align aggregates to 32 bits (the default is 64 bits, which has no
163 // particular hardware support on 32-bit ARM).
164 Ret += "-a:0:32";
165
166 // Integer registers are 32 bits.
167 Ret += "-n32";
168
169 // The stack is 64 bit aligned on AAPCS and 32 bit aligned everywhere else.
170 if (ABI == ARM::ARM_ABI_AAPCS16)
171 Ret += "-S128";
172 else if (ABI == ARM::ARM_ABI_AAPCS)
173 Ret += "-S64";
174 else
175 Ret += "-S32";
176
177 return Ret;
178}
179
181 std::optional<Reloc::Model> RM) {
182 if (!RM)
183 // Default relocation model on Darwin is PIC.
184 return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
185
186 if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
187 assert(TT.isOSBinFormatELF() &&
188 "ROPI/RWPI currently only supported for ELF");
189
190 // DynamicNoPIC is only used on darwin.
191 if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
192 return Reloc::Static;
193
194 return *RM;
195}
196
197/// Create an ARM architecture model.
198///
200 StringRef CPU, StringRef FS,
201 const TargetOptions &Options,
202 std::optional<Reloc::Model> RM,
203 std::optional<CodeModel::Model> CM,
204 CodeGenOptLevel OL, bool isLittle)
206 CPU, FS, Options, getEffectiveRelocModel(TT, RM),
207 getEffectiveCodeModel(CM, CodeModel::Small), OL),
208 TargetABI(ARM::computeTargetABI(TT, Options.MCOptions.ABIName)),
209 TLOF(createTLOF(getTargetTriple())), isLittle(isLittle) {
210
211 // Default to triple-appropriate float ABI
213 if (isTargetHardFloat())
214 this->Options.FloatABIType = FloatABI::Hard;
215 else
216 this->Options.FloatABIType = FloatABI::Soft;
217 }
218
219 // Default to triple-appropriate EABI
222 // musl is compatible with glibc with regard to EABI version
231 this->Options.EABIVersion = EABI::GNU;
232 else
233 this->Options.EABIVersion = EABI::EABI5;
234 }
235
236 if (TT.isOSBinFormatMachO()) {
237 this->Options.TrapUnreachable = true;
238 this->Options.NoTrapAfterNoreturn = true;
239 }
240
241 // ARM supports the debug entry values.
243
244 initAsmInfo();
245
246 // ARM supports the MachineOutliner.
247 setMachineOutliner(true);
249}
250
252
254 BumpPtrAllocator &Allocator, const Function &F,
255 const TargetSubtargetInfo *STI) const {
256 return ARMFunctionInfo::create<ARMFunctionInfo>(
257 Allocator, F, static_cast<const ARMSubtarget *>(STI));
258}
259
260const ARMSubtarget *
262 Attribute CPUAttr = F.getFnAttribute("target-cpu");
263 Attribute FSAttr = F.getFnAttribute("target-features");
264
265 std::string CPU =
266 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
267 std::string FS =
268 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
269
270 // FIXME: This is related to the code below to reset the target options,
271 // we need to know whether or not the soft float flag is set on the
272 // function before we can generate a subtarget. We also need to use
273 // it as a key for the subtarget since that can be the only difference
274 // between two functions.
275 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
276 // If the soft float attribute is set on the function turn on the soft float
277 // subtarget feature.
278 if (SoftFloat)
279 FS += FS.empty() ? "+soft-float" : ",+soft-float";
280
281 // Use the optminsize to identify the subtarget, but don't use it in the
282 // feature string.
283 std::string Key = CPU + FS;
284 if (F.hasMinSize())
285 Key += "+minsize";
286
287 auto &I = SubtargetMap[Key];
288 if (!I) {
289 // This needs to be done before we create a new subtarget since any
290 // creation will depend on the TM and the code generation flags on the
291 // function that reside in TargetOptions.
293 I = std::make_unique<ARMSubtarget>(TargetTriple, CPU, FS, *this, isLittle,
294 F.hasMinSize());
295
296 if (!I->isThumb() && !I->hasARMOps())
297 F.getContext().emitError("Function '" + F.getName() + "' uses ARM "
298 "instructions, but the target does not support ARM mode execution.");
299 }
300
301 return I.get();
302}
303
306 return TargetTransformInfo(std::make_unique<ARMTTIImpl>(this, F));
307}
308
312 // add DAG Mutations here.
313 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
314 if (ST.hasFusion())
316 return DAG;
317}
318
322 // add DAG Mutations here.
323 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
324 if (ST.hasFusion())
326 if (auto Mutation = createARMLatencyMutations(ST, C->AA))
327 DAG->addMutation(std::move(Mutation));
328 return DAG;
329}
330
332 StringRef CPU, StringRef FS,
333 const TargetOptions &Options,
334 std::optional<Reloc::Model> RM,
335 std::optional<CodeModel::Model> CM,
336 CodeGenOptLevel OL, bool JIT)
337 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
338
340 StringRef CPU, StringRef FS,
341 const TargetOptions &Options,
342 std::optional<Reloc::Model> RM,
343 std::optional<CodeModel::Model> CM,
344 CodeGenOptLevel OL, bool JIT)
345 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
346
347namespace {
348
349/// ARM Code Generator Pass Configuration Options.
350class ARMPassConfig : public TargetPassConfig {
351public:
352 ARMPassConfig(ARMBaseTargetMachine &TM, PassManagerBase &PM)
353 : TargetPassConfig(TM, PM) {}
354
355 ARMBaseTargetMachine &getARMTargetMachine() const {
356 return getTM<ARMBaseTargetMachine>();
357 }
358
359 void addIRPasses() override;
360 void addCodeGenPrepare() override;
361 bool addPreISel() override;
362 bool addInstSelector() override;
363 bool addIRTranslator() override;
364 bool addLegalizeMachineIR() override;
365 bool addRegBankSelect() override;
366 bool addGlobalInstructionSelect() override;
367 void addPreRegAlloc() override;
368 void addPreSched2() override;
369 void addPreEmitPass() override;
370 void addPreEmitPass2() override;
371
372 std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
373};
374
375class ARMExecutionDomainFix : public ExecutionDomainFix {
376public:
377 static char ID;
378 ARMExecutionDomainFix() : ExecutionDomainFix(ID, ARM::DPRRegClass) {}
379 StringRef getPassName() const override {
380 return "ARM Execution Domain Fix";
381 }
382};
383char ARMExecutionDomainFix::ID;
384
385} // end anonymous namespace
386
387INITIALIZE_PASS_BEGIN(ARMExecutionDomainFix, "arm-execution-domain-fix",
388 "ARM Execution Domain Fix", false, false)
390INITIALIZE_PASS_END(ARMExecutionDomainFix, "arm-execution-domain-fix",
391 "ARM Execution Domain Fix", false, false)
392
394 return new ARMPassConfig(*this, PM);
395}
396
397std::unique_ptr<CSEConfigBase> ARMPassConfig::getCSEConfig() const {
398 return getStandardCSEConfigForOpt(TM->getOptLevel());
399}
400
401void ARMPassConfig::addIRPasses() {
402 if (TM->Options.ThreadModel == ThreadModel::Single)
403 addPass(createLowerAtomicPass());
404 else
406
407 // Cmpxchg instructions are often used with a subsequent comparison to
408 // determine whether it succeeded. We can exploit existing control-flow in
409 // ldrex/strex loops to simplify this, but it needs tidying up.
410 if (TM->getOptLevel() != CodeGenOptLevel::None && EnableAtomicTidy)
412 SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true),
413 [this](const Function &F) {
414 const auto &ST = this->TM->getSubtarget<ARMSubtarget>(F);
415 return ST.hasAnyDataBarrier() && !ST.isThumb1Only();
416 }));
417
420
422
423 // Run the parallel DSP pass.
424 if (getOptLevel() == CodeGenOptLevel::Aggressive)
425 addPass(createARMParallelDSPPass());
426
427 // Match complex arithmetic patterns
428 if (TM->getOptLevel() >= CodeGenOptLevel::Default)
430
431 // Match interleaved memory accesses to ldN/stN intrinsics.
432 if (TM->getOptLevel() != CodeGenOptLevel::None)
434
435 // Add Control Flow Guard checks.
436 if (TM->getTargetTriple().isOSWindows())
437 addPass(createCFGuardCheckPass());
438
439 if (TM->Options.JMCInstrument)
440 addPass(createJMCInstrumenterPass());
441}
442
443void ARMPassConfig::addCodeGenPrepare() {
444 if (getOptLevel() != CodeGenOptLevel::None)
447}
448
449bool ARMPassConfig::addPreISel() {
450 if ((TM->getOptLevel() != CodeGenOptLevel::None &&
453 // FIXME: This is using the thumb1 only constant value for
454 // maximal global offset for merging globals. We may want
455 // to look into using the old value for non-thumb1 code of
456 // 4095 based on the TargetMachine, but this starts to become
457 // tricky when doing code gen per function.
458 bool OnlyOptimizeForSize =
459 (TM->getOptLevel() < CodeGenOptLevel::Aggressive) &&
461 // Merging of extern globals is enabled by default on non-Mach-O as we
462 // expect it to be generally either beneficial or harmless. On Mach-O it
463 // is disabled as we emit the .subsections_via_symbols directive which
464 // means that merging extern globals is not safe.
465 bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
466 addPass(createGlobalMergePass(TM, 127, OnlyOptimizeForSize,
467 MergeExternalByDefault));
468 }
469
470 if (TM->getOptLevel() != CodeGenOptLevel::None) {
473 // FIXME: IR passes can delete address-taken basic blocks, deleting
474 // corresponding blockaddresses. ARMConstantPoolConstant holds references to
475 // address-taken basic blocks which can be invalidated if the function
476 // containing the blockaddress has already been codegen'd and the basic
477 // block is removed. Work around this by forcing all IR passes to run before
478 // any ISel takes place. We should have a more principled way of handling
479 // this. See D99707 for more details.
480 addPass(createBarrierNoopPass());
481 }
482
483 return false;
484}
485
486bool ARMPassConfig::addInstSelector() {
487 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
488 return false;
489}
490
491bool ARMPassConfig::addIRTranslator() {
492 addPass(new IRTranslator(getOptLevel()));
493 return false;
494}
495
496bool ARMPassConfig::addLegalizeMachineIR() {
497 addPass(new Legalizer());
498 return false;
499}
500
501bool ARMPassConfig::addRegBankSelect() {
502 addPass(new RegBankSelect());
503 return false;
504}
505
506bool ARMPassConfig::addGlobalInstructionSelect() {
507 addPass(new InstructionSelect(getOptLevel()));
508 return false;
509}
510
511void ARMPassConfig::addPreRegAlloc() {
512 if (getOptLevel() != CodeGenOptLevel::None) {
513 if (getOptLevel() == CodeGenOptLevel::Aggressive)
514 addPass(&MachinePipelinerID);
515
517
518 addPass(createMLxExpansionPass());
519
521 addPass(createARMLoadStoreOptimizationPass(/* pre-register alloc */ true));
522
524 addPass(createA15SDOptimizerPass());
525 }
526}
527
528void ARMPassConfig::addPreSched2() {
529 if (getOptLevel() != CodeGenOptLevel::None) {
532
533 addPass(new ARMExecutionDomainFix());
534 addPass(createBreakFalseDeps());
535 }
536
537 // Expand some pseudo instructions into multiple instructions to allow
538 // proper scheduling.
539 addPass(createARMExpandPseudoPass());
540
541 if (getOptLevel() != CodeGenOptLevel::None) {
542 // When optimising for size, always run the Thumb2SizeReduction pass before
543 // IfConversion. Otherwise, check whether IT blocks are restricted
544 // (e.g. in v8, IfConversion depends on Thumb instruction widths)
545 addPass(createThumb2SizeReductionPass([this](const Function &F) {
546 return this->TM->getSubtarget<ARMSubtarget>(F).hasMinSize() ||
547 this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
548 }));
549
550 addPass(createIfConverter([](const MachineFunction &MF) {
551 return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
552 }));
553 }
554 addPass(createThumb2ITBlockPass());
555
556 // Add both scheduling passes to give the subtarget an opportunity to pick
557 // between them.
558 if (getOptLevel() != CodeGenOptLevel::None) {
559 addPass(&PostMachineSchedulerID);
560 addPass(&PostRASchedulerID);
561 }
562
563 addPass(createMVEVPTBlockPass());
564 addPass(createARMIndirectThunks());
565 addPass(createARMSLSHardeningPass());
566}
567
568void ARMPassConfig::addPreEmitPass() {
570
571 // Constant island pass work on unbundled instructions.
572 addPass(createUnpackMachineBundles([](const MachineFunction &MF) {
573 return MF.getSubtarget<ARMSubtarget>().isThumb2();
574 }));
575
576 // Don't optimize barriers or block placement at -O0.
577 if (getOptLevel() != CodeGenOptLevel::None) {
580 }
581}
582
583void ARMPassConfig::addPreEmitPass2() {
584 // Inserts fixup instructions before unsafe AES operations. Instructions may
585 // be inserted at the start of blocks and at within blocks so this pass has to
586 // come before those below.
588 // Inserts BTIs at the start of functions and indirectly-called basic blocks,
589 // so passes cannot add to the start of basic blocks once this has run.
591 // Inserts Constant Islands. Block sizes cannot be increased after this point,
592 // as this may push the branch ranges and load offsets of accessing constant
593 // pools out of range..
595 // Finalises Low-Overhead Loops. This replaces pseudo instructions with real
596 // instructions, but the pseudos all have conservative sizes so that block
597 // sizes will only be decreased by this pass.
599
600 if (TM->getTargetTriple().isOSWindows()) {
601 // Identify valid longjmp targets for Windows Control Flow Guard.
602 addPass(createCFGuardLongjmpPass());
603 // Identify valid eh continuation targets for Windows EHCont Guard.
605 }
606}
607
610 return new yaml::ARMFunctionInfo();
611}
612
615 const auto *MFI = MF.getInfo<ARMFunctionInfo>();
616 return new yaml::ARMFunctionInfo(*MFI);
617}
618
621 SMDiagnostic &Error, SMRange &SourceRange) const {
622 const auto &YamlMFI = static_cast<const yaml::ARMFunctionInfo &>(MFI);
623 MachineFunction &MF = PFS.MF;
624 MF.getInfo<ARMFunctionInfo>()->initializeBaseYamlFields(YamlMFI);
625 return false;
626}
627
Falkor HW Prefetch Fix
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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))
static cl::opt< bool > DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden, cl::desc("Inhibit optimization of S->D register accesses on A15"), cl::init(false))
static cl::opt< cl::boolOrDefault > EnableGlobalMerge("arm-global-merge", cl::Hidden, cl::desc("Enable the global merge pass"))
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeARMTarget()
arm execution domain fix
static cl::opt< bool > EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden, cl::desc("Enable ARM load/store optimization pass"), cl::init(true))
static cl::opt< bool > EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden, cl::desc("Run SimplifyCFG after expanding atomic operations" " to make use of cmpxchg flow-based information"), cl::init(true))
static Reloc::Model getEffectiveRelocModel(const Triple &TT, std::optional< Reloc::Model > RM)
This file a TargetTransformInfoImplBase conforming object specific to the ARM target machine.
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Provides analysis for continuously CSEing during GISel passes.
This file describes how to lower LLVM calls to machine code calls.
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static cl::opt< bool > EnableGlobalMerge("enable-global-merge", cl::Hidden, cl::desc("Enable the global merge pass"), cl::init(true))
This file declares the IRTranslator pass.
static LVOptions Options
Definition: LVOptions.cpp:25
static std::string computeDataLayout()
Interface for Targets to specify which operations they can successfully select and how the others sho...
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, const TargetOptions &Options)
PowerPC VSX FMA Mutation
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:42
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:44
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:39
Basic Register Allocator
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
speculative execution
Target-Independent Code Generator Pass Configuration Options pass.
This pass exposes codegen information to IR-level passes.
static std::unique_ptr< TargetLoweringObjectFile > createTLOF()
ARMBETargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const override
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
void reset() override
Reset internal state.
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const override
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
const ARMSubtarget * getSubtargetImpl() const =delete
ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const override
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
StringMap< std::unique_ptr< ARMSubtarget > > SubtargetMap
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const override
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool isLittle)
Create an ARM architecture model.
yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const override
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
ARMFunctionInfo - This class is derived from MachineFunctionInfo and contains private ARM-specific in...
ARMLETargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
bool restrictIT() const
Definition: ARMSubtarget.h:403
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:400
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:223
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
implements a set of functionality in the TargetMachine class for targets that make use of the indepen...
static LLVM_ABI const char * getManglingComponent(const Triple &T)
Definition: DataLayout.cpp:175
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
This pass is responsible for selecting generic machine instructions to target-specific instructions.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:38
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class provides the reaching def analysis.
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Definition: RegBankSelect.h:91
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition: Registry.h:44
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:282
Represents a range in source code.
Definition: SMLoc.h:48
A ScheduleDAG for scheduling lists of MachineInstr.
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:233
void setSupportsDebugEntryValues(bool Enable)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
void setMachineOutliner(bool Enable)
void setSupportsDefaultOutlining(bool Enable)
std::string TargetFS
std::string TargetCPU
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line.
EABI EABIVersion
EABIVersion - This flag specifies the EABI version.
unsigned NoTrapAfterNoreturn
Do not emit a trap instruction for 'unreachable' IR instructions behind noreturn calls,...
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
Target-Independent Code Generator Pass Configuration Options.
virtual void addCodeGenPrepare()
Add pass to prepare the LLVM IR for code generation.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
TargetSubtargetInfo - Generic base class for all target subtargets.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
@ GNUEABIT64
Definition: Triple.h:258
@ MuslEABIHF
Definition: Triple.h:274
@ GNUEABIHFT64
Definition: Triple.h:260
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
Definition: Triple.h:425
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:676
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, DriverKit, XROS, or bridgeOS).
Definition: Triple.h:608
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
LLVM_ABI LLVM_READONLY ARMABI computeTargetABI(const Triple &TT, StringRef ABIName="")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ DynamicNoPIC
Definition: CodeGen.h:25
@ ROPI_RWPI
Definition: CodeGen.h:25
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:444
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ScheduleDAGMILive * createSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
void initializeARMConstantIslandsPass(PassRegistry &)
LLVM_ABI FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
FunctionPass * createMVETPAndVPTOptimisationsPass()
createMVETPAndVPTOptimisationsPass
Pass * createMVELaneInterleavingPass()
LLVM_ABI ModulePass * createJMCInstrumenterPass()
JMC instrument pass.
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass.
LLVM_ABI FunctionPass * createIfConverter(std::function< bool(const MachineFunction &)> Ftor)
LLVM_ABI FunctionPass * createTypePromotionLegacyPass()
Create IR Type Promotion pass.
void initializeMVETailPredicationPass(PassRegistry &)
void initializeMVELaneInterleavingPass(PassRegistry &)
Pass * createMVEGatherScatterLoweringPass()
Target & getTheThumbBETarget()
LLVM_ABI Pass * createGlobalMergePass(const TargetMachine *TM, unsigned MaximalOffset, bool OnlyOptimizeForSize=false, bool MergeExternalByDefault=false, bool MergeConstantByDefault=false, bool MergeConstAggressiveByDefault=false)
GlobalMerge - This pass merges internal (by default) globals into structs to enable reuse of a base p...
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
LLVM_ABI Pass * createLowerAtomicPass()
FunctionPass * createARMISelDag(ARMBaseTargetMachine &TM, CodeGenOptLevel OptLevel)
createARMISelDag - This pass converts a legalized DAG into a ARM-specific DAG, ready for instruction ...
LLVM_ABI std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOptLevel Level)
Definition: CSEInfo.cpp:89
FunctionPass * createARMLowOverheadLoopsPass()
FunctionPass * createARMLoadStoreOptimizationPass(bool PreAlloc=false)
Returns an instance of the load / store optimization pass.
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
FunctionPass * createARMBranchTargetsPass()
std::unique_ptr< ScheduleDAGMutation > createARMLatencyMutations(const ARMSubtarget &ST, AAResults *AA)
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
ScheduleDAGMI * createSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
void initializeARMBranchTargetsPass(PassRegistry &)
Pass * createMVETailPredicationPass()
LLVM_ABI FunctionPass * createComplexDeinterleavingPass(const TargetMachine *TM)
This pass implements generation of target-specific intrinsics to support handling of complex number a...
FunctionPass * createARMBlockPlacementPass()
std::unique_ptr< ScheduleDAGMutation > createARMMacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createARMMacroFusionDAGMutation()); to ARMTargetMachine::c...
void initializeARMParallelDSPPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:82
LLVM_ABI FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
void initializeARMExpandPseudoPass(PassRegistry &)
FunctionPass * createA15SDOptimizerPass()
void initializeARMSLSHardeningPass(PassRegistry &)
LLVM_ABI FunctionPass * createInterleavedAccessPass()
InterleavedAccess Pass - This pass identifies and matches interleaved memory accesses to target speci...
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Definition: GlobalISel.cpp:17
void initializeARMAsmPrinterPass(PassRegistry &)
LLVM_ABI FunctionPass * createBreakFalseDeps()
Creates Break False Dependencies pass.
LLVM_ABI char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
LLVM_ABI ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
FunctionPass * createARMSLSHardeningPass()
FunctionPass * createARMConstantIslandPass()
createARMConstantIslandPass - returns an instance of the constpool island pass.
LLVM_ABI FunctionPass * createUnpackMachineBundles(std::function< bool(const MachineFunction &)> Ftor)
void initializeARMLowOverheadLoopsPass(PassRegistry &)
FunctionPass * createCFGuardCheckPass()
Insert Control FLow Guard checks on indirect function calls.
Definition: CFGuard.cpp:317
void initializeMVETPAndVPTOptimisationsPass(PassRegistry &)
void initializeARMExecutionDomainFixPass(PassRegistry &)
LLVM_ABI FunctionPass * createEHContGuardTargetsPass()
Creates Windows EH Continuation Guard target identification pass.
void initializeThumb2SizeReducePass(PassRegistry &)
FunctionPass * createThumb2ITBlockPass()
createThumb2ITBlockPass - Returns an instance of the Thumb2 IT blocks insertion pass.
void initializeMVEGatherScatterLoweringPass(PassRegistry &)
FunctionPass * createARMExpandPseudoPass()
createARMExpandPseudoPass - returns an instance of the pseudo instruction expansion pass.
FunctionPass * createARMIndirectThunks()
void initializeARMFixCortexA57AES1742098Pass(PassRegistry &)
FunctionPass * createARMFixCortexA57AES1742098Pass()
Pass * createARMParallelDSPPass()
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
FunctionPass * createThumb2SizeReductionPass(std::function< bool(const Function &)> Ftor=nullptr)
createThumb2SizeReductionPass - Returns an instance of the Thumb2 size reduction pass.
Target & getTheARMLETarget()
void initializeMVEVPTBlockPass(PassRegistry &)
void initializeARMDAGToDAGISelLegacyPass(PassRegistry &)
FunctionPass * createMLxExpansionPass()
void initializeARMLoadStoreOptPass(PassRegistry &)
void initializeARMPreAllocLoadStoreOptPass(PassRegistry &)
void initializeARMBlockPlacementPass(PassRegistry &)
LLVM_ABI FunctionPass * createHardwareLoopsLegacyPass()
Create Hardware Loop pass.
Target & getTheARMBETarget()
Target & getTheThumbLETarget()
FunctionPass * createMVEVPTBlockPass()
createMVEVPTBlock - Returns an instance of the MVE VPT block insertion pass.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
RegisterTargetMachine - Helper template for registering a target machine implementation,...
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.