LLVM 24.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"
53#include "llvm/Transforms/IPO.h"
55#include <cassert>
56#include <memory>
57#include <optional>
58#include <string>
59
60using namespace llvm;
61
62static cl::opt<bool>
63DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
64 cl::desc("Inhibit optimization of S->D register accesses on A15"),
65 cl::init(false));
66
67static cl::opt<bool>
68EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden,
69 cl::desc("Run SimplifyCFG after expanding atomic operations"
70 " to make use of cmpxchg flow-based information"),
71 cl::init(true));
72
73static cl::opt<bool>
74EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden,
75 cl::desc("Enable ARM load/store optimization pass"),
76 cl::init(true));
77
78// FIXME: Unify control over GlobalMerge.
80EnableGlobalMerge("arm-global-merge", cl::Hidden,
81 cl::desc("Enable the global merge pass"));
82
83namespace llvm {
85}
86
117
118static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
119 if (TT.isOSBinFormatMachO())
120 return std::make_unique<TargetLoweringObjectFileMachO>();
121 if (TT.isOSWindows())
122 return std::make_unique<TargetLoweringObjectFileCOFF>();
123 return std::make_unique<ARMElfTargetObjectFile>();
124}
125
127 std::optional<Reloc::Model> RM) {
128 if (!RM)
129 // Default relocation model on Darwin is PIC.
130 return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
131
132 if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
133 assert(TT.isOSBinFormatELF() &&
134 "ROPI/RWPI currently only supported for ELF");
135
136 // DynamicNoPIC is only used on darwin.
137 if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
138 return Reloc::Static;
139
140 return *RM;
141}
142
143/// Create an ARM architecture model.
144///
146 StringRef CPU, StringRef FS,
147 const TargetOptions &Options,
148 std::optional<Reloc::Model> RM,
149 std::optional<CodeModel::Model> CM,
152 T, TT.computeDataLayout(Options.MCOptions.ABIName), TT, CPU, FS,
154 getEffectiveCodeModel(CM, CodeModel::Small), OL),
155 TargetABI(ARM::computeTargetABI(TT, Options.MCOptions.ABIName)),
157
158 // Default to triple-appropriate float ABI. -target-abi=aapcs16 forces hard
159 // float regardless of the triple default.
160 if (Options.FloatABIType == FloatABI::Default) {
161 if (TargetABI == ARM::ARM_ABI_AAPCS16 ||
162 TT.getDefaultFloatABI() == FloatABI::Hard)
163 this->Options.FloatABIType = FloatABI::Hard;
164 else
165 this->Options.FloatABIType = FloatABI::Soft;
166 }
167
168 // Default to triple-appropriate EABI
169 if (Options.EABIVersion == EABI::Default ||
170 Options.EABIVersion == EABI::Unknown) {
171 // musl is compatible with glibc with regard to EABI version
172 if ((TargetTriple.getEnvironment() == Triple::GNUEABI ||
173 TargetTriple.getEnvironment() == Triple::GNUEABIT64 ||
174 TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
175 TargetTriple.getEnvironment() == Triple::GNUEABIHFT64 ||
176 TargetTriple.getEnvironment() == Triple::MuslEABI ||
177 TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
178 TargetTriple.getEnvironment() == Triple::OpenHOS) &&
179 !(TargetTriple.isOSWindows() || TargetTriple.isOSDarwin()))
180 this->Options.EABIVersion = EABI::GNU;
181 else
182 this->Options.EABIVersion = EABI::EABI5;
183 }
184
185 if (TT.isOSBinFormatMachO()) {
186 this->Options.TrapUnreachable = true;
187 this->Options.NoTrapAfterNoreturn = true;
188 }
189
190 // ARM supports the debug entry values.
192
193 initAsmInfo();
194
195 // ARM supports the MachineOutliner.
196 setMachineOutliner(true);
198}
199
201
208
209const ARMSubtarget *
211 Attribute CPUAttr = F.getFnAttribute("target-cpu");
212 Attribute FSAttr = F.getFnAttribute("target-features");
213
214 std::string CPU =
215 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
216 std::string FS =
217 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
218
219 // FIXME: This is related to the code below to reset the target options,
220 // we need to know whether or not the soft float flag is set on the
221 // function before we can generate a subtarget. We also need to use
222 // it as a key for the subtarget since that can be the only difference
223 // between two functions.
224 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
225 // If the soft float attribute is set on the function turn on the soft float
226 // subtarget feature.
227 if (SoftFloat)
228 FS += FS.empty() ? "+soft-float" : ",+soft-float";
229
230 // Use the optminsize to identify the subtarget, but don't use it in the
231 // feature string.
232 std::string Key = CPU + FS;
233 if (F.hasMinSize())
234 Key += "+minsize";
235
236 DenormalMode DM = F.getDenormalFPEnv().DefaultMode;
237 if (DM != DenormalMode::getIEEE())
238 Key += "denormal-fp-math=" + DM.str();
239
240 FloatABI::ABIType FloatABI = this->Options.FloatABIType;
241
242 // It is legal to have FloatABI::Hard with +soft-float for targets with SIMD
243 // registers, but no floating-point hardware (mve+nofp)
244 Key += FloatABI == FloatABI::Hard ? "+hard-float-abi" : "+soft-float-abi";
245
246 auto &I = SubtargetMap[Key];
247 if (!I) {
248 I = std::make_unique<ARMSubtarget>(TargetTriple, CPU, FS, *this, isLittle,
249 FloatABI, F.hasMinSize(), DM);
250
251 if (!I->isThumb() && !I->hasARMOps())
252 F.getContext().emitError("Function '" + F.getName() + "' uses ARM "
253 "instructions, but the target does not support ARM mode execution.");
254 }
255
256 return I.get();
257}
258
261 return TargetTransformInfo(std::make_unique<ARMTTIImpl>(this, F));
262}
263
267 // add DAG Mutations here.
268 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
269 if (ST.hasFusion())
271 return DAG;
272}
273
277 // add DAG Mutations here.
278 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
279 if (ST.hasFusion())
281 if (auto Mutation = createARMLatencyMutations(ST, C->AA))
282 DAG->addMutation(std::move(Mutation));
283 return DAG;
284}
285
287 StringRef CPU, StringRef FS,
288 const TargetOptions &Options,
289 std::optional<Reloc::Model> RM,
290 std::optional<CodeModel::Model> CM,
291 CodeGenOptLevel OL, bool JIT)
292 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
293
295 StringRef CPU, StringRef FS,
296 const TargetOptions &Options,
297 std::optional<Reloc::Model> RM,
298 std::optional<CodeModel::Model> CM,
299 CodeGenOptLevel OL, bool JIT)
300 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
301
302namespace {
303
304/// ARM Code Generator Pass Configuration Options.
305class ARMPassConfig : public TargetPassConfig {
306public:
307 ARMPassConfig(ARMBaseTargetMachine &TM, PassManagerBase &PM)
308 : TargetPassConfig(TM, PM) {}
309
310 ARMBaseTargetMachine &getARMTargetMachine() const {
312 }
313
314 void addIRPasses() override;
315 void addCodeGenPrepare() override;
316 bool addPreISel() override;
317 bool addInstSelector() override;
318 bool addIRTranslator() override;
319 bool addLegalizeMachineIR() override;
320 bool addRegBankSelect() override;
321 bool addGlobalInstructionSelect() override;
322 void addPreRegAlloc() override;
323 void addPreSched2() override;
324 void addPreEmitPass() override;
325 void addPreEmitPass2() override;
326
327 std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
328};
329
330class ARMExecutionDomainFix : public ExecutionDomainFix {
331public:
332 static char ID;
333 ARMExecutionDomainFix() : ExecutionDomainFix(ID, ARM::DPRRegClass) {}
334 StringRef getPassName() const override {
335 return "ARM Execution Domain Fix";
336 }
337};
338char ARMExecutionDomainFix::ID;
339
340} // end anonymous namespace
341
342INITIALIZE_PASS_BEGIN(ARMExecutionDomainFix, "arm-execution-domain-fix",
343 "ARM Execution Domain Fix", false, false)
345INITIALIZE_PASS_END(ARMExecutionDomainFix, "arm-execution-domain-fix",
346 "ARM Execution Domain Fix", false, false)
347
349#define GET_PASS_REGISTRY "ARMPassRegistry.def"
351}
352
354 return new ARMPassConfig(*this, PM);
355}
356
357std::unique_ptr<CSEConfigBase> ARMPassConfig::getCSEConfig() const {
358 return getStandardCSEConfigForOpt(TM->getOptLevel());
359}
360
361void ARMPassConfig::addIRPasses() {
362 if (TM->Options.ThreadModel == ThreadModel::Single)
363 addPass(createLowerAtomicPass());
364 else
366
367 // Cmpxchg instructions are often used with a subsequent comparison to
368 // determine whether it succeeded. We can exploit existing control-flow in
369 // ldrex/strex loops to simplify this, but it needs tidying up.
370 if (TM->getOptLevel() != CodeGenOptLevel::None && EnableAtomicTidy)
372 SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true),
373 [this](const Function &F) {
374 const auto &ST = this->TM->getSubtarget<ARMSubtarget>(F);
375 return ST.hasAnyDataBarrier() && !ST.isThumb1Only();
376 }));
377
380
382
383 // Run the parallel DSP pass.
384 if (getOptLevel() == CodeGenOptLevel::Aggressive)
385 addPass(createARMParallelDSPPass());
386
387 // Match complex arithmetic patterns
388 if (TM->getOptLevel() >= CodeGenOptLevel::Default)
390
391 // Match interleaved memory accesses to ldN/stN intrinsics.
392 if (TM->getOptLevel() != CodeGenOptLevel::None)
394
395 // Add Control Flow Guard checks.
396 if (TM->getTargetTriple().isOSWindows())
397 addPass(createCFGuardPass());
398
399 if (TM->Options.JMCInstrument)
400 addPass(createJMCInstrumenterPass());
401}
402
403void ARMPassConfig::addCodeGenPrepare() {
404 if (getOptLevel() != CodeGenOptLevel::None)
407}
408
409bool ARMPassConfig::addPreISel() {
410 if ((TM->getOptLevel() != CodeGenOptLevel::None &&
413 // FIXME: This is using the thumb1 only constant value for
414 // maximal global offset for merging globals. We may want
415 // to look into using the old value for non-thumb1 code of
416 // 4095 based on the TargetMachine, but this starts to become
417 // tricky when doing code gen per function.
418 bool OnlyOptimizeForSize =
419 (TM->getOptLevel() < CodeGenOptLevel::Aggressive) &&
421 // Merging of extern globals is enabled by default on non-Mach-O as we
422 // expect it to be generally either beneficial or harmless. On Mach-O it
423 // is disabled as we emit the .subsections_via_symbols directive which
424 // means that merging extern globals is not safe.
425 bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
426 addPass(createGlobalMergePass(TM, 127, OnlyOptimizeForSize,
427 MergeExternalByDefault));
428 }
429
430 if (TM->getOptLevel() != CodeGenOptLevel::None) {
433 // FIXME: IR passes can delete address-taken basic blocks, deleting
434 // corresponding blockaddresses. ARMConstantPoolConstant holds references to
435 // address-taken basic blocks which can be invalidated if the function
436 // containing the blockaddress has already been codegen'd and the basic
437 // block is removed. Work around this by forcing all IR passes to run before
438 // any ISel takes place. We should have a more principled way of handling
439 // this. See D99707 for more details.
440 addPass(createBarrierNoopPass());
441 }
442
443 return false;
444}
445
446bool ARMPassConfig::addInstSelector() {
447 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
448 return false;
449}
450
451bool ARMPassConfig::addIRTranslator() {
452 addPass(new IRTranslator(getOptLevel()));
453 return false;
454}
455
456bool ARMPassConfig::addLegalizeMachineIR() {
457 addPass(new Legalizer());
458 return false;
459}
460
461bool ARMPassConfig::addRegBankSelect() {
462 addPass(new RegBankSelect());
463 return false;
464}
465
466bool ARMPassConfig::addGlobalInstructionSelect() {
467 addPass(new InstructionSelect(getOptLevel()));
468 return false;
469}
470
471void ARMPassConfig::addPreRegAlloc() {
472 if (getOptLevel() != CodeGenOptLevel::None) {
473 if (getOptLevel() == CodeGenOptLevel::Aggressive)
474 addPass(&MachinePipelinerID);
475
477
478 addPass(createMLxExpansionPass());
479
481 addPass(createARMLoadStoreOptLegacyPass(/* pre-register alloc */ true));
482
484 addPass(createA15SDOptimizerPass());
485 }
486}
487
488void ARMPassConfig::addPreSched2() {
489 if (getOptLevel() != CodeGenOptLevel::None) {
492
493 addPass(new ARMExecutionDomainFix());
495 }
496
497 // Expand some pseudo instructions into multiple instructions to allow
498 // proper scheduling.
499 addPass(createARMExpandPseudoPass());
500
501 // Emit KCFI checks for indirect calls.
502 addPass(createKCFIPass());
503
504 if (getOptLevel() != CodeGenOptLevel::None) {
505 // When optimising for size, always run the Thumb2SizeReduction pass before
506 // IfConversion. Otherwise, check whether IT blocks are restricted
507 // (e.g. in v8, IfConversion depends on Thumb instruction widths)
508 addPass(createThumb2SizeReductionPass([this](const Function &F) {
509 return this->TM->getSubtarget<ARMSubtarget>(F).hasMinSize() ||
510 this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
511 }));
512
513 addPass(createIfConverter([](const MachineFunction &MF) {
514 return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
515 }));
516 }
517 addPass(createThumb2ITBlockPass());
518
519 // Add both scheduling passes to give the subtarget an opportunity to pick
520 // between them.
521 if (getOptLevel() != CodeGenOptLevel::None) {
522 addPass(&PostMachineSchedulerID);
523 addPass(&PostRASchedulerID);
524 }
525
526 addPass(createMVEVPTBlockPass());
527 addPass(createARMIndirectThunks());
528 addPass(createARMSLSHardeningPass());
529}
530
531void ARMPassConfig::addPreEmitPass() {
533
534 // Unpack bundles for:
535 // - Thumb2: Constant island pass requires unbundled instructions
536 // - KCFI: KCFI_CHECK pseudo instructions need to be unbundled for AsmPrinter
538 return MF.getSubtarget<ARMSubtarget>().isThumb2() ||
539 MF.getFunction().getParent()->getModuleFlag("kcfi");
540 }));
541
542 // Don't optimize barriers or block placement at -O0.
543 if (getOptLevel() != CodeGenOptLevel::None) {
546 }
547}
548
549void ARMPassConfig::addPreEmitPass2() {
550
551 // Inserts fixup instructions before unsafe AES operations. Instructions may
552 // be inserted at the start of blocks and at within blocks so this pass has to
553 // come before those below.
555 // Inserts BTIs at the start of functions and indirectly-called basic blocks,
556 // so passes cannot add to the start of basic blocks once this has run.
558 // Inserts Constant Islands. Block sizes cannot be increased after this point,
559 // as this may push the branch ranges and load offsets of accessing constant
560 // pools out of range..
562 // Finalises Low-Overhead Loops. This replaces pseudo instructions with real
563 // instructions, but the pseudos all have conservative sizes so that block
564 // sizes will only be decreased by this pass.
566
567 if (TM->getTargetTriple().isOSWindows()) {
568 // Identify valid longjmp targets for Windows Control Flow Guard.
569 addPass(createCFGuardLongjmpPass());
570 // Identify valid eh continuation targets for Windows EHCont Guard.
572 }
573}
574
579
582 const auto *MFI = MF.getInfo<ARMFunctionInfo>();
583 return new yaml::ARMFunctionInfo(*MFI);
584}
585
588 SMDiagnostic &Error, SMRange &SourceRange) const {
589 const auto &YamlMFI = static_cast<const yaml::ARMFunctionInfo &>(MFI);
590 MachineFunction &MF = PFS.MF;
591 MF.getInfo<ARMFunctionInfo>()->initializeBaseYamlFields(YamlMFI);
592 return false;
593}
594
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 std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
static Reloc::Model getEffectiveRelocModel()
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()
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))
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...
#define X(NUM, ENUM, NAME)
Definition ELF.h:856
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
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:215
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
DXIL Legalizer
static RegisterPass< DebugifyModulePass > DM("debugify", "Attach debug info to everything")
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.
Interface for Targets to specify which operations they can successfully select and how the others sho...
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define T
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, const TargetOptions &Options)
PowerPC VSX FMA Mutation
if(PassOpts->AAPipeline)
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
#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
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
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.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
std::unique_ptr< TargetLoweringObjectFile > TLOF
void reset() override
Reset internal state.
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)
Create an ARM architecture model.
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
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline.
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Return a TargetTransformInfo for a given function.
ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const override
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
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)
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:105
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition Attributes.h:261
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Module * getParent()
Get the module that this global value is contained inside of...
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.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Metadata * getModuleFlag(StringRef Key) const
Return the corresponding value if Key appears in module flags, otherwise return null.
Definition Module.cpp:358
This class provides access to building LLVM's passes.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition Registry.h:116
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition SourceMgr.h:308
Represents a range in source code.
Definition SMLoc.h:47
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.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::string str() const
Get the contents as an std::string.
Definition StringRef.h:222
void setSupportsDebugEntryValues(bool Enable)
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
const Triple & getTargetTriple() const
void setMachineOutliner(bool Enable)
void setSupportsDefaultOutlining(bool Enable)
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
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:48
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Interfaces for registering analysis passes, producing common pass manager configurations,...
Define some predicates that are used for node matching.
Definition ARMEHABI.h:25
@ DynamicNoPIC
Definition CodeGen.h:26
@ ARM
Windows AXP64.
Definition MCAsmInfo.h:50
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
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:85
FunctionPass * createARMLowOverheadLoopsPass()
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
void initializeARMPreAllocLoadStoreOptLegacyPass(PassRegistry &)
FunctionPass * createARMBranchTargetsPass()
LLVM_ABI void initializeMachineKCFILegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createUnpackMachineBundlesLegacy(std::function< bool(const MachineFunction &)> Ftor)
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
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 * createKCFIPass()
Lowers KCFI operand bundles for indirect calls.
Definition KCFI.cpp:75
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:149
@ Default
-O2, -Os, -Oz
Definition CodeGen.h:152
FunctionPass * createARMLoadStoreOptLegacyPass(bool PreAlloc=false)
Returns an instance of the load / store optimization pass.
LLVM_ABI FunctionPass * createCFGuardLongjmpPass()
Creates CFGuard longjmp target identification pass.
void initializeARMExpandPseudoPass(PassRegistry &)
FunctionPass * createA15SDOptimizerPass()
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
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.
void initializeARMAsmPrinterPass(PassRegistry &)
LLVM_ABI FunctionPass * createCFGuardPass()
Insert Control Flow Guard checks on indirect function calls.
Definition CFGuard.cpp:316
void initializeARMLoadStoreOptLegacyPass(PassRegistry &)
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.
void initializeARMLowOverheadLoopsPass(PassRegistry &)
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,...
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:390
FunctionPass * createThumb2SizeReductionPass(std::function< bool(const Function &)> Ftor=nullptr)
createThumb2SizeReductionPass - Returns an instance of the Thumb2 size reduction pass.
Target & getTheARMLETarget()
LLVM_ABI FunctionPass * createBreakFalseDepsLegacyPass()
Creates Break False Dependencies pass.
void initializeMVEVPTBlockPass(PassRegistry &)
void initializeARMDAGToDAGISelLegacyPass(PassRegistry &)
FunctionPass * createMLxExpansionPass()
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.
Represent subnormal handling kind for floating point instruction inputs and outputs.
static constexpr DenormalMode getIEEE()
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
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.