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
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
125 std::optional<Reloc::Model> RM) {
126 if (!RM)
127 // Default relocation model on Darwin is PIC.
128 return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
129
130 if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
131 assert(TT.isOSBinFormatELF() &&
132 "ROPI/RWPI currently only supported for ELF");
133
134 // DynamicNoPIC is only used on darwin.
135 if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
136 return Reloc::Static;
137
138 return *RM;
139}
140
141/// Create an ARM architecture model.
142///
144 StringRef CPU, StringRef FS,
145 const TargetOptions &Options,
146 std::optional<Reloc::Model> RM,
147 std::optional<CodeModel::Model> CM,
150 T, TT.computeDataLayout(Options.MCOptions.ABIName), TT, CPU, FS,
152 getEffectiveCodeModel(CM, CodeModel::Small), OL),
153 TargetABI(ARM::computeTargetABI(TT, Options.MCOptions.ABIName)),
155
156 // Default to triple-appropriate float ABI
157 if (Options.FloatABIType == FloatABI::Default) {
158 if (isTargetHardFloat())
159 this->Options.FloatABIType = FloatABI::Hard;
160 else
161 this->Options.FloatABIType = FloatABI::Soft;
162 }
163
164 // Default to triple-appropriate EABI
165 if (Options.EABIVersion == EABI::Default ||
166 Options.EABIVersion == EABI::Unknown) {
167 // musl is compatible with glibc with regard to EABI version
168 if ((TargetTriple.getEnvironment() == Triple::GNUEABI ||
169 TargetTriple.getEnvironment() == Triple::GNUEABIT64 ||
170 TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
171 TargetTriple.getEnvironment() == Triple::GNUEABIHFT64 ||
172 TargetTriple.getEnvironment() == Triple::MuslEABI ||
173 TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
174 TargetTriple.getEnvironment() == Triple::OpenHOS) &&
175 !(TargetTriple.isOSWindows() || TargetTriple.isOSDarwin()))
176 this->Options.EABIVersion = EABI::GNU;
177 else
178 this->Options.EABIVersion = EABI::EABI5;
179 }
180
181 if (TT.isOSBinFormatMachO()) {
182 this->Options.TrapUnreachable = true;
183 this->Options.NoTrapAfterNoreturn = true;
184 }
185
186 // ARM supports the debug entry values.
188
189 initAsmInfo();
190
191 // ARM supports the MachineOutliner.
192 setMachineOutliner(true);
194}
195
197
204
205const ARMSubtarget *
207 Attribute CPUAttr = F.getFnAttribute("target-cpu");
208 Attribute FSAttr = F.getFnAttribute("target-features");
209
210 std::string CPU =
211 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
212 std::string FS =
213 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
214
215 // FIXME: This is related to the code below to reset the target options,
216 // we need to know whether or not the soft float flag is set on the
217 // function before we can generate a subtarget. We also need to use
218 // it as a key for the subtarget since that can be the only difference
219 // between two functions.
220 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
221 // If the soft float attribute is set on the function turn on the soft float
222 // subtarget feature.
223 if (SoftFloat)
224 FS += FS.empty() ? "+soft-float" : ",+soft-float";
225
226 // Use the optminsize to identify the subtarget, but don't use it in the
227 // feature string.
228 std::string Key = CPU + FS;
229 if (F.hasMinSize())
230 Key += "+minsize";
231
232 auto &I = SubtargetMap[Key];
233 if (!I) {
234 // This needs to be done before we create a new subtarget since any
235 // creation will depend on the TM and the code generation flags on the
236 // function that reside in TargetOptions.
238 I = std::make_unique<ARMSubtarget>(TargetTriple, CPU, FS, *this, isLittle,
239 F.hasMinSize());
240
241 if (!I->isThumb() && !I->hasARMOps())
242 F.getContext().emitError("Function '" + F.getName() + "' uses ARM "
243 "instructions, but the target does not support ARM mode execution.");
244 }
245
246 return I.get();
247}
248
251 return TargetTransformInfo(std::make_unique<ARMTTIImpl>(this, F));
252}
253
257 // add DAG Mutations here.
258 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
259 if (ST.hasFusion())
261 return DAG;
262}
263
267 // add DAG Mutations here.
268 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
269 if (ST.hasFusion())
271 if (auto Mutation = createARMLatencyMutations(ST, C->AA))
272 DAG->addMutation(std::move(Mutation));
273 return DAG;
274}
275
277 StringRef CPU, StringRef FS,
278 const TargetOptions &Options,
279 std::optional<Reloc::Model> RM,
280 std::optional<CodeModel::Model> CM,
281 CodeGenOptLevel OL, bool JIT)
282 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
283
285 StringRef CPU, StringRef FS,
286 const TargetOptions &Options,
287 std::optional<Reloc::Model> RM,
288 std::optional<CodeModel::Model> CM,
289 CodeGenOptLevel OL, bool JIT)
290 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
291
292namespace {
293
294/// ARM Code Generator Pass Configuration Options.
295class ARMPassConfig : public TargetPassConfig {
296public:
297 ARMPassConfig(ARMBaseTargetMachine &TM, PassManagerBase &PM)
298 : TargetPassConfig(TM, PM) {}
299
300 ARMBaseTargetMachine &getARMTargetMachine() const {
302 }
303
304 void addIRPasses() override;
305 void addCodeGenPrepare() override;
306 bool addPreISel() override;
307 bool addInstSelector() override;
308 bool addIRTranslator() override;
309 bool addLegalizeMachineIR() override;
310 bool addRegBankSelect() override;
311 bool addGlobalInstructionSelect() override;
312 void addPreRegAlloc() override;
313 void addPreSched2() override;
314 void addPreEmitPass() override;
315 void addPreEmitPass2() override;
316
317 std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
318};
319
320class ARMExecutionDomainFix : public ExecutionDomainFix {
321public:
322 static char ID;
323 ARMExecutionDomainFix() : ExecutionDomainFix(ID, ARM::DPRRegClass) {}
324 StringRef getPassName() const override {
325 return "ARM Execution Domain Fix";
326 }
327};
328char ARMExecutionDomainFix::ID;
329
330} // end anonymous namespace
331
332INITIALIZE_PASS_BEGIN(ARMExecutionDomainFix, "arm-execution-domain-fix",
333 "ARM Execution Domain Fix", false, false)
335INITIALIZE_PASS_END(ARMExecutionDomainFix, "arm-execution-domain-fix",
336 "ARM Execution Domain Fix", false, false)
337
339 return new ARMPassConfig(*this, PM);
340}
341
342std::unique_ptr<CSEConfigBase> ARMPassConfig::getCSEConfig() const {
343 return getStandardCSEConfigForOpt(TM->getOptLevel());
344}
345
346void ARMPassConfig::addIRPasses() {
347 if (TM->Options.ThreadModel == ThreadModel::Single)
348 addPass(createLowerAtomicPass());
349 else
351
352 // Cmpxchg instructions are often used with a subsequent comparison to
353 // determine whether it succeeded. We can exploit existing control-flow in
354 // ldrex/strex loops to simplify this, but it needs tidying up.
355 if (TM->getOptLevel() != CodeGenOptLevel::None && EnableAtomicTidy)
357 SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true),
358 [this](const Function &F) {
359 const auto &ST = this->TM->getSubtarget<ARMSubtarget>(F);
360 return ST.hasAnyDataBarrier() && !ST.isThumb1Only();
361 }));
362
365
367
368 // Run the parallel DSP pass.
369 if (getOptLevel() == CodeGenOptLevel::Aggressive)
370 addPass(createARMParallelDSPPass());
371
372 // Match complex arithmetic patterns
373 if (TM->getOptLevel() >= CodeGenOptLevel::Default)
375
376 // Match interleaved memory accesses to ldN/stN intrinsics.
377 if (TM->getOptLevel() != CodeGenOptLevel::None)
379
380 // Add Control Flow Guard checks.
381 if (TM->getTargetTriple().isOSWindows())
382 addPass(createCFGuardCheckPass());
383
384 if (TM->Options.JMCInstrument)
385 addPass(createJMCInstrumenterPass());
386}
387
388void ARMPassConfig::addCodeGenPrepare() {
389 if (getOptLevel() != CodeGenOptLevel::None)
392}
393
394bool ARMPassConfig::addPreISel() {
395 if ((TM->getOptLevel() != CodeGenOptLevel::None &&
398 // FIXME: This is using the thumb1 only constant value for
399 // maximal global offset for merging globals. We may want
400 // to look into using the old value for non-thumb1 code of
401 // 4095 based on the TargetMachine, but this starts to become
402 // tricky when doing code gen per function.
403 bool OnlyOptimizeForSize =
404 (TM->getOptLevel() < CodeGenOptLevel::Aggressive) &&
406 // Merging of extern globals is enabled by default on non-Mach-O as we
407 // expect it to be generally either beneficial or harmless. On Mach-O it
408 // is disabled as we emit the .subsections_via_symbols directive which
409 // means that merging extern globals is not safe.
410 bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
411 addPass(createGlobalMergePass(TM, 127, OnlyOptimizeForSize,
412 MergeExternalByDefault));
413 }
414
415 if (TM->getOptLevel() != CodeGenOptLevel::None) {
418 // FIXME: IR passes can delete address-taken basic blocks, deleting
419 // corresponding blockaddresses. ARMConstantPoolConstant holds references to
420 // address-taken basic blocks which can be invalidated if the function
421 // containing the blockaddress has already been codegen'd and the basic
422 // block is removed. Work around this by forcing all IR passes to run before
423 // any ISel takes place. We should have a more principled way of handling
424 // this. See D99707 for more details.
425 addPass(createBarrierNoopPass());
426 }
427
428 return false;
429}
430
431bool ARMPassConfig::addInstSelector() {
432 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
433 return false;
434}
435
436bool ARMPassConfig::addIRTranslator() {
437 addPass(new IRTranslator(getOptLevel()));
438 return false;
439}
440
441bool ARMPassConfig::addLegalizeMachineIR() {
442 addPass(new Legalizer());
443 return false;
444}
445
446bool ARMPassConfig::addRegBankSelect() {
447 addPass(new RegBankSelect());
448 return false;
449}
450
451bool ARMPassConfig::addGlobalInstructionSelect() {
452 addPass(new InstructionSelect(getOptLevel()));
453 return false;
454}
455
456void ARMPassConfig::addPreRegAlloc() {
457 if (getOptLevel() != CodeGenOptLevel::None) {
458 if (getOptLevel() == CodeGenOptLevel::Aggressive)
459 addPass(&MachinePipelinerID);
460
462
463 addPass(createMLxExpansionPass());
464
466 addPass(createARMLoadStoreOptimizationPass(/* pre-register alloc */ true));
467
469 addPass(createA15SDOptimizerPass());
470 }
471}
472
473void ARMPassConfig::addPreSched2() {
474 if (getOptLevel() != CodeGenOptLevel::None) {
477
478 addPass(new ARMExecutionDomainFix());
479 addPass(createBreakFalseDeps());
480 }
481
482 // Expand some pseudo instructions into multiple instructions to allow
483 // proper scheduling.
484 addPass(createARMExpandPseudoPass());
485
486 if (getOptLevel() != CodeGenOptLevel::None) {
487 // When optimising for size, always run the Thumb2SizeReduction pass before
488 // IfConversion. Otherwise, check whether IT blocks are restricted
489 // (e.g. in v8, IfConversion depends on Thumb instruction widths)
490 addPass(createThumb2SizeReductionPass([this](const Function &F) {
491 return this->TM->getSubtarget<ARMSubtarget>(F).hasMinSize() ||
492 this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
493 }));
494
495 addPass(createIfConverter([](const MachineFunction &MF) {
496 return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
497 }));
498 }
499 addPass(createThumb2ITBlockPass());
500
501 // Add both scheduling passes to give the subtarget an opportunity to pick
502 // between them.
503 if (getOptLevel() != CodeGenOptLevel::None) {
504 addPass(&PostMachineSchedulerID);
505 addPass(&PostRASchedulerID);
506 }
507
508 addPass(createMVEVPTBlockPass());
509 addPass(createARMIndirectThunks());
510 addPass(createARMSLSHardeningPass());
511}
512
513void ARMPassConfig::addPreEmitPass() {
515
516 // Constant island pass work on unbundled instructions.
517 addPass(createUnpackMachineBundles([](const MachineFunction &MF) {
518 return MF.getSubtarget<ARMSubtarget>().isThumb2();
519 }));
520
521 // Don't optimize barriers or block placement at -O0.
522 if (getOptLevel() != CodeGenOptLevel::None) {
525 }
526}
527
528void ARMPassConfig::addPreEmitPass2() {
529 // Inserts fixup instructions before unsafe AES operations. Instructions may
530 // be inserted at the start of blocks and at within blocks so this pass has to
531 // come before those below.
533 // Inserts BTIs at the start of functions and indirectly-called basic blocks,
534 // so passes cannot add to the start of basic blocks once this has run.
536 // Inserts Constant Islands. Block sizes cannot be increased after this point,
537 // as this may push the branch ranges and load offsets of accessing constant
538 // pools out of range..
540 // Finalises Low-Overhead Loops. This replaces pseudo instructions with real
541 // instructions, but the pseudos all have conservative sizes so that block
542 // sizes will only be decreased by this pass.
544
545 if (TM->getTargetTriple().isOSWindows()) {
546 // Identify valid longjmp targets for Windows Control Flow Guard.
547 addPass(createCFGuardLongjmpPass());
548 // Identify valid eh continuation targets for Windows EHCont Guard.
550 }
551}
552
557
560 const auto *MFI = MF.getInfo<ARMFunctionInfo>();
561 return new yaml::ARMFunctionInfo(*MFI);
562}
563
566 SMDiagnostic &Error, SMRange &SourceRange) const {
567 const auto &YamlMFI = static_cast<const yaml::ARMFunctionInfo &>(MFI);
568 MachineFunction &MF = PFS.MF;
569 MF.getInfo<ARMFunctionInfo>()->initializeBaseYamlFields(YamlMFI);
570 return false;
571}
572
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 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))
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< 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:213
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
DXIL Legalizer
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:55
#define I(x, y, z)
Definition MD5.cpp:58
#define T
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, const TargetOptions &Options)
PowerPC VSX FMA Mutation
if(PassOpts->AAPipeline)
#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")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
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.
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...
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
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
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:69
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:223
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
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...
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.
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.
const Triple & getTargetTriple() const
void setMachineOutliner(bool Enable)
void setSupportsDefaultOutlining(bool Enable)
std::unique_ptr< const MCSubtargetInfo > STI
TargetOptions Options
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
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
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Define some predicates that are used for node matching.
Definition ARMEHABI.h:25
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
@ ARM
Windows AXP64.
Definition MCAsmInfo.h:47
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: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()
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 * 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 &)
BumpPtrAllocatorImpl BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
Definition Allocator.h:383
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:82
@ Default
-O2, -Os
Definition CodeGen.h:85
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 * 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...
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.