LLVM 20.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"
51#include "llvm/Transforms/IPO.h"
53#include <cassert>
54#include <memory>
55#include <optional>
56#include <string>
57
58using namespace llvm;
59
60static cl::opt<bool>
61DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
62 cl::desc("Inhibit optimization of S->D register accesses on A15"),
63 cl::init(false));
64
65static cl::opt<bool>
66EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden,
67 cl::desc("Run SimplifyCFG after expanding atomic operations"
68 " to make use of cmpxchg flow-based information"),
69 cl::init(true));
70
71static cl::opt<bool>
72EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden,
73 cl::desc("Enable ARM load/store optimization pass"),
74 cl::init(true));
75
76// FIXME: Unify control over GlobalMerge.
78EnableGlobalMerge("arm-global-merge", cl::Hidden,
79 cl::desc("Enable the global merge pass"));
80
81namespace llvm {
83}
84
86 // Register the target.
91
112}
113
114static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
115 if (TT.isOSBinFormatMachO())
116 return std::make_unique<TargetLoweringObjectFileMachO>();
117 if (TT.isOSWindows())
118 return std::make_unique<TargetLoweringObjectFileCOFF>();
119 return std::make_unique<ARMElfTargetObjectFile>();
120}
121
124 const TargetOptions &Options) {
125 StringRef ABIName = Options.MCOptions.getABIName();
126
127 if (ABIName.empty())
128 ABIName = ARM::computeDefaultTargetABI(TT, CPU);
129
130 if (ABIName == "aapcs16")
132 else if (ABIName.starts_with("aapcs"))
134 else if (ABIName.starts_with("apcs"))
136
137 llvm_unreachable("Unhandled/unknown ABI Name!");
139}
140
141static std::string computeDataLayout(const Triple &TT, StringRef CPU,
142 const TargetOptions &Options,
143 bool isLittle) {
144 auto ABI = computeTargetABI(TT, CPU, Options);
145 std::string Ret;
146
147 if (isLittle)
148 // Little endian.
149 Ret += "e";
150 else
151 // Big endian.
152 Ret += "E";
153
155
156 // Pointers are 32 bits and aligned to 32 bits.
157 Ret += "-p:32:32";
158
159 // Function pointers are aligned to 8 bits (because the LSB stores the
160 // ARM/Thumb state).
161 Ret += "-Fi8";
162
163 // ABIs other than APCS have 64 bit integers with natural alignment.
165 Ret += "-i64:64";
166
167 // We have 64 bits floats. The APCS ABI requires them to be aligned to 32
168 // bits, others to 64 bits. We always try to align to 64 bits.
170 Ret += "-f64:32:64";
171
172 // We have 128 and 64 bit vectors. The APCS ABI aligns them to 32 bits, others
173 // to 64. We always ty to give them natural alignment.
175 Ret += "-v64:32:64-v128:32:128";
177 Ret += "-v128:64:128";
178
179 // Try to align aggregates to 32 bits (the default is 64 bits, which has no
180 // particular hardware support on 32-bit ARM).
181 Ret += "-a:0:32";
182
183 // Integer registers are 32 bits.
184 Ret += "-n32";
185
186 // The stack is 128 bit aligned on NaCl, 64 bit aligned on AAPCS and 32 bit
187 // aligned everywhere else.
188 if (TT.isOSNaCl() || ABI == ARMBaseTargetMachine::ARM_ABI_AAPCS16)
189 Ret += "-S128";
191 Ret += "-S64";
192 else
193 Ret += "-S32";
194
195 return Ret;
196}
197
199 std::optional<Reloc::Model> RM) {
200 if (!RM)
201 // Default relocation model on Darwin is PIC.
202 return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
203
204 if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
205 assert(TT.isOSBinFormatELF() &&
206 "ROPI/RWPI currently only supported for ELF");
207
208 // DynamicNoPIC is only used on darwin.
209 if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
210 return Reloc::Static;
211
212 return *RM;
213}
214
215/// Create an ARM architecture model.
216///
218 StringRef CPU, StringRef FS,
219 const TargetOptions &Options,
220 std::optional<Reloc::Model> RM,
221 std::optional<CodeModel::Model> CM,
222 CodeGenOptLevel OL, bool isLittle)
224 TT, CPU, FS, Options,
226 getEffectiveCodeModel(CM, CodeModel::Small), OL),
227 TargetABI(computeTargetABI(TT, CPU, Options)),
228 TLOF(createTLOF(getTargetTriple())), isLittle(isLittle) {
229
230 // Default to triple-appropriate float ABI
232 if (isTargetHardFloat())
233 this->Options.FloatABIType = FloatABI::Hard;
234 else
235 this->Options.FloatABIType = FloatABI::Soft;
236 }
237
238 // Default to triple-appropriate EABI
241 // musl is compatible with glibc with regard to EABI version
250 this->Options.EABIVersion = EABI::GNU;
251 else
252 this->Options.EABIVersion = EABI::EABI5;
253 }
254
255 if (TT.isOSBinFormatMachO()) {
256 this->Options.TrapUnreachable = true;
257 this->Options.NoTrapAfterNoreturn = true;
258 }
259
260 // ARM supports the debug entry values.
262
263 initAsmInfo();
264
265 // ARM supports the MachineOutliner.
266 setMachineOutliner(true);
268}
269
271
273 BumpPtrAllocator &Allocator, const Function &F,
274 const TargetSubtargetInfo *STI) const {
275 return ARMFunctionInfo::create<ARMFunctionInfo>(
276 Allocator, F, static_cast<const ARMSubtarget *>(STI));
277}
278
279const ARMSubtarget *
281 Attribute CPUAttr = F.getFnAttribute("target-cpu");
282 Attribute FSAttr = F.getFnAttribute("target-features");
283
284 std::string CPU =
285 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
286 std::string FS =
287 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
288
289 // FIXME: This is related to the code below to reset the target options,
290 // we need to know whether or not the soft float flag is set on the
291 // function before we can generate a subtarget. We also need to use
292 // it as a key for the subtarget since that can be the only difference
293 // between two functions.
294 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
295 // If the soft float attribute is set on the function turn on the soft float
296 // subtarget feature.
297 if (SoftFloat)
298 FS += FS.empty() ? "+soft-float" : ",+soft-float";
299
300 // Use the optminsize to identify the subtarget, but don't use it in the
301 // feature string.
302 std::string Key = CPU + FS;
303 if (F.hasMinSize())
304 Key += "+minsize";
305
306 auto &I = SubtargetMap[Key];
307 if (!I) {
308 // This needs to be done before we create a new subtarget since any
309 // creation will depend on the TM and the code generation flags on the
310 // function that reside in TargetOptions.
312 I = std::make_unique<ARMSubtarget>(TargetTriple, CPU, FS, *this, isLittle,
313 F.hasMinSize());
314
315 if (!I->isThumb() && !I->hasARMOps())
316 F.getContext().emitError("Function '" + F.getName() + "' uses ARM "
317 "instructions, but the target does not support ARM mode execution.");
318 }
319
320 return I.get();
321}
322
325 return TargetTransformInfo(ARMTTIImpl(this, F));
326}
327
329 StringRef CPU, StringRef FS,
330 const TargetOptions &Options,
331 std::optional<Reloc::Model> RM,
332 std::optional<CodeModel::Model> CM,
333 CodeGenOptLevel OL, bool JIT)
334 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
335
337 StringRef CPU, StringRef FS,
338 const TargetOptions &Options,
339 std::optional<Reloc::Model> RM,
340 std::optional<CodeModel::Model> CM,
341 CodeGenOptLevel OL, bool JIT)
342 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
343
344namespace {
345
346/// ARM Code Generator Pass Configuration Options.
347class ARMPassConfig : public TargetPassConfig {
348public:
349 ARMPassConfig(ARMBaseTargetMachine &TM, PassManagerBase &PM)
350 : TargetPassConfig(TM, PM) {}
351
352 ARMBaseTargetMachine &getARMTargetMachine() const {
353 return getTM<ARMBaseTargetMachine>();
354 }
355
357 createMachineScheduler(MachineSchedContext *C) const override {
359 // add DAG Mutations here.
360 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
361 if (ST.hasFusion())
363 return DAG;
364 }
365
367 createPostMachineScheduler(MachineSchedContext *C) const override {
369 // add DAG Mutations here.
370 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
371 if (ST.hasFusion())
373 if (auto Mutation = createARMLatencyMutations(ST, C->AA))
374 DAG->addMutation(std::move(Mutation));
375 return DAG;
376 }
377
378 void addIRPasses() override;
379 void addCodeGenPrepare() override;
380 bool addPreISel() override;
381 bool addInstSelector() override;
382 bool addIRTranslator() override;
383 bool addLegalizeMachineIR() override;
384 bool addRegBankSelect() override;
385 bool addGlobalInstructionSelect() override;
386 void addPreRegAlloc() override;
387 void addPreSched2() override;
388 void addPreEmitPass() override;
389 void addPreEmitPass2() override;
390
391 std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
392};
393
394class ARMExecutionDomainFix : public ExecutionDomainFix {
395public:
396 static char ID;
397 ARMExecutionDomainFix() : ExecutionDomainFix(ID, ARM::DPRRegClass) {}
398 StringRef getPassName() const override {
399 return "ARM Execution Domain Fix";
400 }
401};
402char ARMExecutionDomainFix::ID;
403
404} // end anonymous namespace
405
406INITIALIZE_PASS_BEGIN(ARMExecutionDomainFix, "arm-execution-domain-fix",
407 "ARM Execution Domain Fix", false, false)
409INITIALIZE_PASS_END(ARMExecutionDomainFix, "arm-execution-domain-fix",
410 "ARM Execution Domain Fix", false, false)
411
413 return new ARMPassConfig(*this, PM);
414}
415
416std::unique_ptr<CSEConfigBase> ARMPassConfig::getCSEConfig() const {
417 return getStandardCSEConfigForOpt(TM->getOptLevel());
418}
419
420void ARMPassConfig::addIRPasses() {
421 if (TM->Options.ThreadModel == ThreadModel::Single)
422 addPass(createLowerAtomicPass());
423 else
425
426 // Cmpxchg instructions are often used with a subsequent comparison to
427 // determine whether it succeeded. We can exploit existing control-flow in
428 // ldrex/strex loops to simplify this, but it needs tidying up.
429 if (TM->getOptLevel() != CodeGenOptLevel::None && EnableAtomicTidy)
431 SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true),
432 [this](const Function &F) {
433 const auto &ST = this->TM->getSubtarget<ARMSubtarget>(F);
434 return ST.hasAnyDataBarrier() && !ST.isThumb1Only();
435 }));
436
439
441
442 // Run the parallel DSP pass.
443 if (getOptLevel() == CodeGenOptLevel::Aggressive)
444 addPass(createARMParallelDSPPass());
445
446 // Match complex arithmetic patterns
447 if (TM->getOptLevel() >= CodeGenOptLevel::Default)
449
450 // Match interleaved memory accesses to ldN/stN intrinsics.
451 if (TM->getOptLevel() != CodeGenOptLevel::None)
453
454 // Add Control Flow Guard checks.
455 if (TM->getTargetTriple().isOSWindows())
456 addPass(createCFGuardCheckPass());
457
458 if (TM->Options.JMCInstrument)
459 addPass(createJMCInstrumenterPass());
460}
461
462void ARMPassConfig::addCodeGenPrepare() {
463 if (getOptLevel() != CodeGenOptLevel::None)
466}
467
468bool ARMPassConfig::addPreISel() {
469 if ((TM->getOptLevel() != CodeGenOptLevel::None &&
472 // FIXME: This is using the thumb1 only constant value for
473 // maximal global offset for merging globals. We may want
474 // to look into using the old value for non-thumb1 code of
475 // 4095 based on the TargetMachine, but this starts to become
476 // tricky when doing code gen per function.
477 bool OnlyOptimizeForSize =
478 (TM->getOptLevel() < CodeGenOptLevel::Aggressive) &&
480 // Merging of extern globals is enabled by default on non-Mach-O as we
481 // expect it to be generally either beneficial or harmless. On Mach-O it
482 // is disabled as we emit the .subsections_via_symbols directive which
483 // means that merging extern globals is not safe.
484 bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
485 addPass(createGlobalMergePass(TM, 127, OnlyOptimizeForSize,
486 MergeExternalByDefault));
487 }
488
489 if (TM->getOptLevel() != CodeGenOptLevel::None) {
492 // FIXME: IR passes can delete address-taken basic blocks, deleting
493 // corresponding blockaddresses. ARMConstantPoolConstant holds references to
494 // address-taken basic blocks which can be invalidated if the function
495 // containing the blockaddress has already been codegen'd and the basic
496 // block is removed. Work around this by forcing all IR passes to run before
497 // any ISel takes place. We should have a more principled way of handling
498 // this. See D99707 for more details.
499 addPass(createBarrierNoopPass());
500 }
501
502 return false;
503}
504
505bool ARMPassConfig::addInstSelector() {
506 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
507 return false;
508}
509
510bool ARMPassConfig::addIRTranslator() {
511 addPass(new IRTranslator(getOptLevel()));
512 return false;
513}
514
515bool ARMPassConfig::addLegalizeMachineIR() {
516 addPass(new Legalizer());
517 return false;
518}
519
520bool ARMPassConfig::addRegBankSelect() {
521 addPass(new RegBankSelect());
522 return false;
523}
524
525bool ARMPassConfig::addGlobalInstructionSelect() {
526 addPass(new InstructionSelect(getOptLevel()));
527 return false;
528}
529
530void ARMPassConfig::addPreRegAlloc() {
531 if (getOptLevel() != CodeGenOptLevel::None) {
532 if (getOptLevel() == CodeGenOptLevel::Aggressive)
533 addPass(&MachinePipelinerID);
534
536
537 addPass(createMLxExpansionPass());
538
540 addPass(createARMLoadStoreOptimizationPass(/* pre-register alloc */ true));
541
543 addPass(createA15SDOptimizerPass());
544 }
545}
546
547void ARMPassConfig::addPreSched2() {
548 if (getOptLevel() != CodeGenOptLevel::None) {
551
552 addPass(new ARMExecutionDomainFix());
553 addPass(createBreakFalseDeps());
554 }
555
556 // Expand some pseudo instructions into multiple instructions to allow
557 // proper scheduling.
558 addPass(createARMExpandPseudoPass());
559
560 if (getOptLevel() != CodeGenOptLevel::None) {
561 // When optimising for size, always run the Thumb2SizeReduction pass before
562 // IfConversion. Otherwise, check whether IT blocks are restricted
563 // (e.g. in v8, IfConversion depends on Thumb instruction widths)
564 addPass(createThumb2SizeReductionPass([this](const Function &F) {
565 return this->TM->getSubtarget<ARMSubtarget>(F).hasMinSize() ||
566 this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
567 }));
568
569 addPass(createIfConverter([](const MachineFunction &MF) {
570 return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
571 }));
572 }
573 addPass(createThumb2ITBlockPass());
574
575 // Add both scheduling passes to give the subtarget an opportunity to pick
576 // between them.
577 if (getOptLevel() != CodeGenOptLevel::None) {
578 addPass(&PostMachineSchedulerID);
579 addPass(&PostRASchedulerID);
580 }
581
582 addPass(createMVEVPTBlockPass());
583 addPass(createARMIndirectThunks());
584 addPass(createARMSLSHardeningPass());
585}
586
587void ARMPassConfig::addPreEmitPass() {
589
590 // Constant island pass work on unbundled instructions.
591 addPass(createUnpackMachineBundles([](const MachineFunction &MF) {
592 return MF.getSubtarget<ARMSubtarget>().isThumb2();
593 }));
594
595 // Don't optimize barriers or block placement at -O0.
596 if (getOptLevel() != CodeGenOptLevel::None) {
599 }
600}
601
602void ARMPassConfig::addPreEmitPass2() {
603 // Inserts fixup instructions before unsafe AES operations. Instructions may
604 // be inserted at the start of blocks and at within blocks so this pass has to
605 // come before those below.
607 // Inserts BTIs at the start of functions and indirectly-called basic blocks,
608 // so passes cannot add to the start of basic blocks once this has run.
610 // Inserts Constant Islands. Block sizes cannot be increased after this point,
611 // as this may push the branch ranges and load offsets of accessing constant
612 // pools out of range..
614 // Finalises Low-Overhead Loops. This replaces pseudo instructions with real
615 // instructions, but the pseudos all have conservative sizes so that block
616 // sizes will only be decreased by this pass.
618
619 if (TM->getTargetTriple().isOSWindows()) {
620 // Identify valid longjmp targets for Windows Control Flow Guard.
621 addPass(createCFGuardLongjmpPass());
622 // Identify valid eh continuation targets for Windows EHCont Guard.
624 }
625}
626
629 return new yaml::ARMFunctionInfo();
630}
631
634 const auto *MFI = MF.getInfo<ARMFunctionInfo>();
635 return new yaml::ARMFunctionInfo(*MFI);
636}
637
640 SMDiagnostic &Error, SMRange &SourceRange) const {
641 const auto &YamlMFI = static_cast<const yaml::ARMFunctionInfo &>(MFI);
642 MachineFunction &MF = PFS.MF;
643 MF.getInfo<ARMFunctionInfo>()->initializeBaseYamlFields(YamlMFI);
644 return false;
645}
646
Falkor HW Prefetch Fix
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_EXTERNAL_VISIBILITY void LLVMInitializeARMTarget()
static ARMBaseTargetMachine::ARMABI computeTargetABI(const Triple &TT, StringRef CPU, const TargetOptions &Options)
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 TargetTransformInfo::Concept conforming object specific to the ARM target machine.
This file contains the simple types necessary to represent the attributes associated with functions a...
basic Basic Alias true
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_EXTERNAL_VISIBILITY
Definition: Compiler.h:128
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")
PowerPC VSX FMA Mutation
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:55
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:57
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:52
Basic Register Allocator
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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
StringMap< std::unique_ptr< ARMSubtarget > > SubtargetMap
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
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:431
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:392
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:208
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
implements a set of functionality in the TargetMachine class for targets that make use of the indepen...
static const char * getManglingComponent(const Triple &T)
Definition: DataLayout.cpp:176
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
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:37
static 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:281
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:51
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:229
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:265
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:147
void setSupportsDebugEntryValues(bool Enable)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
Definition: TargetMachine.h:96
void setMachineOutliner(bool Enable)
void setSupportsDefaultOutlining(bool Enable)
std::string TargetFS
Definition: TargetMachine.h:98
std::string TargetCPU
Definition: TargetMachine.h:97
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:44
@ GNUEABIT64
Definition: Triple.h:252
@ MuslEABIHF
Definition: Triple.h:268
@ GNUEABIHFT64
Definition: Triple.h:254
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
Definition: Triple.h:400
bool isOSWindows() const
Tests whether the OS is Windows.
Definition: Triple.h:635
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
Definition: Triple.h:568
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.
StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU)
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
@ DynamicNoPIC
Definition: CodeGen.h:25
@ ROPI_RWPI
Definition: CodeGen.h:25
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void initializeARMConstantIslandsPass(PassRegistry &)
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
FunctionPass * createMVETPAndVPTOptimisationsPass()
createMVETPAndVPTOptimisationsPass
Pass * createMVELaneInterleavingPass()
FunctionPass * createARMOptimizeBarriersPass()
createARMOptimizeBarriersPass - Returns an instance of the remove double barriers pass.
FunctionPass * createIfConverter(std::function< bool(const MachineFunction &)> Ftor)
FunctionPass * createTypePromotionLegacyPass()
Create IR Type Promotion pass.
void initializeMVETailPredicationPass(PassRegistry &)
void initializeMVELaneInterleavingPass(PassRegistry &)
Pass * createMVEGatherScatterLoweringPass()
Target & getTheThumbBETarget()
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...
char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
FunctionPass * createARMISelDag(ARMBaseTargetMachine &TM, CodeGenOptLevel OptLevel)
createARMISelDag - This pass converts a legalized DAG into a ARM-specific DAG, ready for instruction ...
std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOptLevel Level)
Definition: CSEInfo.cpp:79
FunctionPass * createARMLowOverheadLoopsPass()
FunctionPass * createARMLoadStoreOptimizationPass(bool PreAlloc=false)
Returns an instance of the load / store optimization pass.
char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
ScheduleDAGMILive * createGenericSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
FunctionPass * createARMBranchTargetsPass()
ModulePass * createJMCInstrumenterPass()
JMC instrument pass.
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.
void initializeARMBranchTargetsPass(PassRegistry &)
Pass * createMVETailPredicationPass()
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 ARMPassConfig::crea...
Pass * createLowerAtomicPass()
void initializeARMParallelDSPPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition: CodeGen.h:54
void initializeARMExpandPseudoPass(PassRegistry &)
FunctionPass * createA15SDOptimizerPass()
FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
void initializeARMSLSHardeningPass(PassRegistry &)
FunctionPass * createInterleavedAccessPass()
InterleavedAccess Pass - This pass identifies and matches interleaved memory accesses to target speci...
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Definition: GlobalISel.cpp:17
ScheduleDAGMI * createGenericSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
FunctionPass * createBreakFalseDeps()
Creates Break False Dependencies pass.
char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
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.
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:314
void initializeMVETPAndVPTOptimisationsPass(PassRegistry &)
void initializeARMExecutionDomainFixPass(PassRegistry &)
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()
FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
FunctionPass * createEHContGuardCatchretPass()
Creates EHContGuard catchret target identification pass.
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 &)
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.