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/CallingConv.h"
39#include "llvm/IR/DataLayout.h"
41#include "llvm/IR/Function.h"
43#include "llvm/IR/InstrTypes.h"
44#include "llvm/IR/Module.h"
46#include "llvm/Pass.h"
57#include "llvm/Transforms/IPO.h"
59#include <cassert>
60#include <memory>
61#include <optional>
62#include <string>
63
64using namespace llvm;
65
66static cl::opt<bool>
67DisableA15SDOptimization("disable-a15-sd-optimization", cl::Hidden,
68 cl::desc("Inhibit optimization of S->D register accesses on A15"),
69 cl::init(false));
70
71static cl::opt<bool>
72EnableAtomicTidy("arm-atomic-cfg-tidy", cl::Hidden,
73 cl::desc("Run SimplifyCFG after expanding atomic operations"
74 " to make use of cmpxchg flow-based information"),
75 cl::init(true));
76
77static cl::opt<bool>
78EnableARMLoadStoreOpt("arm-load-store-opt", cl::Hidden,
79 cl::desc("Enable ARM load/store optimization pass"),
80 cl::init(true));
81
82// FIXME: Unify control over GlobalMerge.
84EnableGlobalMerge("arm-global-merge", cl::Hidden,
85 cl::desc("Enable the global merge pass"));
86
87namespace llvm {
89}
90
121
122static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
123 if (TT.isOSBinFormatMachO())
124 return std::make_unique<TargetLoweringObjectFileMachO>();
125 if (TT.isOSWindows())
126 return std::make_unique<TargetLoweringObjectFileCOFF>();
127 return std::make_unique<ARMElfTargetObjectFile>();
128}
129
131 std::optional<Reloc::Model> RM) {
132 if (!RM)
133 // Default relocation model on Darwin is PIC.
134 return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
135
136 if (*RM == Reloc::ROPI || *RM == Reloc::RWPI || *RM == Reloc::ROPI_RWPI)
137 assert(TT.isOSBinFormatELF() &&
138 "ROPI/RWPI currently only supported for ELF");
139
140 // DynamicNoPIC is only used on darwin.
141 if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())
142 return Reloc::Static;
143
144 return *RM;
145}
146
147/// Create an ARM architecture model.
148///
150 StringRef CPU, StringRef FS,
151 const TargetOptions &Options,
152 std::optional<Reloc::Model> RM,
153 std::optional<CodeModel::Model> CM,
155 : CodeGenTargetMachineImpl(T, TT, CPU, FS, Options,
157 getEffectiveCodeModel(CM, CodeModel::Small), OL),
159
160 if (TT.isOSBinFormatMachO()) {
161 this->Options.TrapUnreachable = true;
162 this->Options.NoTrapAfterNoreturn = true;
163 }
164
165 // ARM supports the debug entry values.
167
168 initAsmInfo();
169
170 // ARM supports the MachineOutliner.
171 setMachineOutliner(true);
173}
174
176
178 BumpPtrAllocator &Allocator, const Function &F,
179 const TargetSubtargetInfo *STI) const {
180 const auto *ARMSTI = static_cast<const ARMSubtarget *>(STI);
181 if (!ARMSTI->hasFPRegs() || ARMSTI->isThumb1Only() ||
182 ARMSTI->useSoftFloat()) {
183 const StringRef FPRegsUnavailableMsg =
184 ", but floating-point registers are unavailable";
185 const ARMTargetLowering *TLI = ARMSTI->getTargetLowering();
186
187 if (TLI->getEffectiveCallingConv(F.getCallingConv(), F.isVarArg()) ==
189 F.getContext().diagnose(DiagnosticInfoUnsupported(
190 F, Twine("calling convention is hard-float") + FPRegsUnavailableMsg,
191 DiagnosticLocation(F.getSubprogram())));
192 } else {
193 for (const Instruction &I : instructions(F)) {
194 const auto *CB = dyn_cast<CallBase>(&I);
195 if (!CB || CB->isInlineAsm() ||
196 (CB->getCalledFunction() && CB->getCalledFunction()->isIntrinsic()))
197 continue;
198 if (TLI->getEffectiveCallingConv(CB->getCallingConv(),
199 CB->getFunctionType()->isVarArg()) ==
201 const Function *Callee = CB->getCalledFunction();
202 F.getContext().diagnose(DiagnosticInfoUnsupported(
203 F,
204 (Callee ? Twine("'") + F.getName() + "' calls '" +
205 Callee->getName() + "', which"
206 : Twine("'") + F.getName() +
207 "' makes an indirect call that") +
208 " expects a hard-float calling convention" +
209 FPRegsUnavailableMsg,
210 CB->getDebugLoc()));
211 }
212 }
213 }
214 }
215 return ARMFunctionInfo::create<ARMFunctionInfo>(Allocator, F, ARMSTI);
216}
217
219 // An explicit "float-abi" module flag always wins, even for AAPCS16.
220 if (auto *Val = dyn_cast_or_null<MDString>(M.getModuleFlag("float-abi")))
221 return *FloatABI::parseABIType(Val->getString());
222 return M.getTargetTriple().getDefaultFloatABI(getTargetABIName(M));
223}
224
226 // Consistency of "target-abi" and -target-abi is validated elsewhere.
227 if (const auto *MD = cast_or_null<MDString>(M.getModuleFlag("target-abi")))
228 return ARM::computeTargetABI(TargetTriple, MD->getString());
229 return ARM::computeTargetABI(TargetTriple, Options.MCOptions.getABIName());
230}
231
232const ARMSubtarget *
234 Attribute CPUAttr = F.getFnAttribute("target-cpu");
235 Attribute FSAttr = F.getFnAttribute("target-features");
236
237 std::string CPU =
238 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
239 std::string FS =
240 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
241
242 // FIXME: This is related to the code below to reset the target options,
243 // we need to know whether or not the soft float flag is set on the
244 // function before we can generate a subtarget. We also need to use
245 // it as a key for the subtarget since that can be the only difference
246 // between two functions.
247 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
248 // If the soft float attribute is set on the function turn on the soft float
249 // subtarget feature.
250 if (SoftFloat)
251 FS += FS.empty() ? "+soft-float" : ",+soft-float";
252
253 // Use the optminsize to identify the subtarget, but don't use it in the
254 // feature string.
255 std::string Key = CPU + FS;
256 if (F.hasMinSize())
257 Key += "+minsize";
258
259 DenormalMode DM = F.getDenormalFPEnv().DefaultMode;
260 if (DM != DenormalMode::getIEEE())
261 Key += "denormal-fp-math=" + DM.str();
262
263 FloatABI::ABIType FloatABI = getFloatABI(*F.getParent());
264 // It is legal to have FloatABI::Hard for targets with SIMD registers
265 // but no floating-point hardware (mve+nofp).
266 Key += FloatABI == FloatABI::Hard ? "+hard-float-abi" : "+soft-float-abi";
267
268 ARM::ARMABI ABI = getEffectiveABI(*F.getParent());
269 Key += "+abi=" + std::to_string((int)ABI);
270
271 auto &I = SubtargetMap[Key];
272 if (!I) {
273 I = std::make_unique<ARMSubtarget>(TargetTriple, CPU, FS, *this, isLittle,
274 FloatABI, ABI, F.hasMinSize(), DM);
275
276 if (!I->isThumb() && !I->hasARMOps())
277 F.getContext().emitError("Function '" + F.getName() + "' uses ARM "
278 "instructions, but the target does not support ARM mode execution.");
279 }
280
281 return I.get();
282}
283
286 return TargetTransformInfo(std::make_unique<ARMTTIImpl>(this, F));
287}
288
292 // add DAG Mutations here.
293 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
294 if (ST.hasFusion())
296 return DAG;
297}
298
302 // add DAG Mutations here.
303 const ARMSubtarget &ST = C->MF->getSubtarget<ARMSubtarget>();
304 if (ST.hasFusion())
306 if (auto Mutation = createARMLatencyMutations(ST, C->AA))
307 DAG->addMutation(std::move(Mutation));
308 return DAG;
309}
310
312 StringRef CPU, StringRef FS,
313 const TargetOptions &Options,
314 std::optional<Reloc::Model> RM,
315 std::optional<CodeModel::Model> CM,
316 CodeGenOptLevel OL, bool JIT)
317 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
318
320 StringRef CPU, StringRef FS,
321 const TargetOptions &Options,
322 std::optional<Reloc::Model> RM,
323 std::optional<CodeModel::Model> CM,
324 CodeGenOptLevel OL, bool JIT)
325 : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
326
327namespace {
328
329/// ARM Code Generator Pass Configuration Options.
330class ARMPassConfig : public TargetPassConfig {
331public:
332 ARMPassConfig(ARMBaseTargetMachine &TM, PassManagerBase &PM)
333 : TargetPassConfig(TM, PM) {}
334
335 ARMBaseTargetMachine &getARMTargetMachine() const {
337 }
338
339 void addIRPasses() override;
340 void addCodeGenPrepare() override;
341 bool addPreISel() override;
342 bool addInstSelector() override;
343 bool addIRTranslator() override;
344 bool addLegalizeMachineIR() override;
345 bool addRegBankSelect() override;
346 bool addGlobalInstructionSelect() override;
347 void addPreRegAlloc() override;
348 void addPreSched2() override;
349 void addPreEmitPass() override;
350 void addPreEmitPass2() override;
351
352 std::unique_ptr<CSEConfigBase> getCSEConfig() const override;
353};
354
355class ARMExecutionDomainFix : public ExecutionDomainFix {
356public:
357 static char ID;
358 ARMExecutionDomainFix() : ExecutionDomainFix(ID, ARM::DPRRegClass) {}
359 StringRef getPassName() const override {
360 return "ARM Execution Domain Fix";
361 }
362};
363char ARMExecutionDomainFix::ID;
364
365} // end anonymous namespace
366
367INITIALIZE_PASS_BEGIN(ARMExecutionDomainFix, "arm-execution-domain-fix",
368 "ARM Execution Domain Fix", false, false)
370INITIALIZE_PASS_END(ARMExecutionDomainFix, "arm-execution-domain-fix",
371 "ARM Execution Domain Fix", false, false)
372
374#define GET_PASS_REGISTRY "ARMPassRegistry.def"
376}
377
379 return new ARMPassConfig(*this, PM);
380}
381
382std::unique_ptr<CSEConfigBase> ARMPassConfig::getCSEConfig() const {
383 return getStandardCSEConfigForOpt(TM->getOptLevel());
384}
385
386void ARMPassConfig::addIRPasses() {
388
389 // Cmpxchg instructions are often used with a subsequent comparison to
390 // determine whether it succeeded. We can exploit existing control-flow in
391 // ldrex/strex loops to simplify this, but it needs tidying up.
392 if (TM->getOptLevel() != CodeGenOptLevel::None && EnableAtomicTidy)
394 SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true),
395 [this](const Function &F) {
396 const auto &ST = this->TM->getSubtarget<ARMSubtarget>(F);
397 return ST.hasAnyDataBarrier() && !ST.isThumb1Only();
398 }));
399
402
404
405 // Run the parallel DSP pass.
406 if (getOptLevel() == CodeGenOptLevel::Aggressive)
407 addPass(createARMParallelDSPPass());
408
409 // Match complex arithmetic patterns
410 if (TM->getOptLevel() >= CodeGenOptLevel::Default)
412
413 // Match interleaved memory accesses to ldN/stN intrinsics.
414 if (TM->getOptLevel() != CodeGenOptLevel::None)
416
417 // Add Control Flow Guard checks.
418 if (TM->getTargetTriple().isOSWindows())
419 addPass(createCFGuardPass());
420
421 if (TM->Options.JMCInstrument)
422 addPass(createJMCInstrumenterPass());
423}
424
425void ARMPassConfig::addCodeGenPrepare() {
426 if (getOptLevel() != CodeGenOptLevel::None)
429}
430
431bool ARMPassConfig::addPreISel() {
432 if ((TM->getOptLevel() != CodeGenOptLevel::None &&
435 // FIXME: This is using the thumb1 only constant value for
436 // maximal global offset for merging globals. We may want
437 // to look into using the old value for non-thumb1 code of
438 // 4095 based on the TargetMachine, but this starts to become
439 // tricky when doing code gen per function.
440 bool OnlyOptimizeForSize =
441 (TM->getOptLevel() < CodeGenOptLevel::Aggressive) &&
443 // Merging of extern globals is enabled by default on non-Mach-O as we
444 // expect it to be generally either beneficial or harmless. On Mach-O it
445 // is disabled as we emit the .subsections_via_symbols directive which
446 // means that merging extern globals is not safe.
447 bool MergeExternalByDefault = !TM->getTargetTriple().isOSBinFormatMachO();
448 addPass(createGlobalMergePass(TM, 127, OnlyOptimizeForSize,
449 MergeExternalByDefault));
450 }
451
452 if (TM->getOptLevel() != CodeGenOptLevel::None) {
455 // FIXME: IR passes can delete address-taken basic blocks, deleting
456 // corresponding blockaddresses. ARMConstantPoolConstant holds references to
457 // address-taken basic blocks which can be invalidated if the function
458 // containing the blockaddress has already been codegen'd and the basic
459 // block is removed. Work around this by forcing all IR passes to run before
460 // any ISel takes place. We should have a more principled way of handling
461 // this. See D99707 for more details.
462 addPass(createBarrierNoopPass());
463 }
464
465 return false;
466}
467
468bool ARMPassConfig::addInstSelector() {
469 addPass(createARMISelDag(getARMTargetMachine(), getOptLevel()));
470 return false;
471}
472
473bool ARMPassConfig::addIRTranslator() {
474 addPass(new IRTranslatorLegacy(getOptLevel()));
475 return false;
476}
477
478bool ARMPassConfig::addLegalizeMachineIR() {
479 addPass(new LegalizerLegacy());
480 return false;
481}
482
483bool ARMPassConfig::addRegBankSelect() {
484 addPass(new RegBankSelectLegacy());
485 return false;
486}
487
488bool ARMPassConfig::addGlobalInstructionSelect() {
489 addPass(new InstructionSelectLegacy(getOptLevel()));
490 return false;
491}
492
493void ARMPassConfig::addPreRegAlloc() {
494 if (getOptLevel() != CodeGenOptLevel::None) {
495 if (getOptLevel() == CodeGenOptLevel::Aggressive)
496 addPass(&MachinePipelinerID);
497
499
500 addPass(createMLxExpansionPass());
501
503 addPass(createARMLoadStoreOptLegacyPass(/* pre-register alloc */ true));
504
506 addPass(createA15SDOptimizerPass());
507 }
508}
509
510void ARMPassConfig::addPreSched2() {
511 if (getOptLevel() != CodeGenOptLevel::None) {
514
515 addPass(new ARMExecutionDomainFix());
517 }
518
519 // Expand some pseudo instructions into multiple instructions to allow
520 // proper scheduling.
521 addPass(createARMExpandPseudoPass());
522
523 // Emit KCFI checks for indirect calls.
524 addPass(createKCFIPass());
525
526 if (getOptLevel() != CodeGenOptLevel::None) {
527 // When optimising for size, always run the Thumb2SizeReduction pass before
528 // IfConversion. Otherwise, check whether IT blocks are restricted
529 // (e.g. in v8, IfConversion depends on Thumb instruction widths)
530 addPass(createThumb2SizeReductionPass([this](const Function &F) {
531 return this->TM->getSubtarget<ARMSubtarget>(F).hasMinSize() ||
532 this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
533 }));
534
535 addPass(createIfConverter([](const MachineFunction &MF) {
536 return !MF.getSubtarget<ARMSubtarget>().isThumb1Only();
537 }));
538 }
539 addPass(createThumb2ITBlockPass());
540
541 // Add both scheduling passes to give the subtarget an opportunity to pick
542 // between them.
543 if (getOptLevel() != CodeGenOptLevel::None) {
544 addPass(&PostMachineSchedulerID);
545 addPass(&PostRASchedulerID);
546 }
547
548 addPass(createMVEVPTBlockPass());
549 addPass(createARMIndirectThunks());
550 addPass(createARMSLSHardeningPass());
551}
552
553void ARMPassConfig::addPreEmitPass() {
555
556 // Unpack bundles for:
557 // - Thumb2: Constant island pass requires unbundled instructions
558 // - KCFI: KCFI_CHECK pseudo instructions need to be unbundled for AsmPrinter
560 return MF.getSubtarget<ARMSubtarget>().isThumb2() ||
561 MF.getFunction().getParent()->getModuleFlag("kcfi");
562 }));
563
564 // Don't optimize barriers or block placement at -O0.
565 if (getOptLevel() != CodeGenOptLevel::None) {
568 }
569}
570
571void ARMPassConfig::addPreEmitPass2() {
572
573 // Inserts fixup instructions before unsafe AES operations. Instructions may
574 // be inserted at the start of blocks and at within blocks so this pass has to
575 // come before those below.
577 // Inserts BTIs at the start of functions and indirectly-called basic blocks,
578 // so passes cannot add to the start of basic blocks once this has run.
580 // Inserts Constant Islands. Block sizes cannot be increased after this point,
581 // as this may push the branch ranges and load offsets of accessing constant
582 // pools out of range..
584 // Finalises Low-Overhead Loops. This replaces pseudo instructions with real
585 // instructions, but the pseudos all have conservative sizes so that block
586 // sizes will only be decreased by this pass.
588
589 if (TM->getTargetTriple().isOSWindows()) {
590 // Identify valid longjmp targets for Windows Control Flow Guard.
591 addPass(createCFGuardLongjmpPass());
592 // Identify valid eh continuation targets for Windows EHCont Guard.
594 }
595}
596
601
604 const auto *MFI = MF.getInfo<ARMFunctionInfo>();
605 return new yaml::ARMFunctionInfo(*MFI);
606}
607
610 SMDiagnostic &Error, SMRange &SourceRange) const {
611 const auto &YamlMFI = static_cast<const yaml::ARMFunctionInfo &>(MFI);
612 MachineFunction &MF = PFS.MF;
613 MF.getInfo<ARMFunctionInfo>()->initializeBaseYamlFields(YamlMFI);
614 return false;
615}
616
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.
Expand Atomic instructions
This file contains the simple types necessary to represent the attributes associated with functions a...
#define X(NUM, ENUM, NAME)
Definition ELF.h:857
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
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.
Module.h This file contains the declarations for the Module class.
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
PowerPC VSX FMA Mutation
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
ARM::ARMABI getEffectiveABI(const Module &M) const
Returns the ABI in effect for M: the "target-abi" module flag if present, otherwise the legacy -targe...
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
FloatABI::ABIType getFloatABI(const Module &M) const
Returns the floating-point ABI in effect for M: the "float-abi" module flag if present,...
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)
CallingConv::ID getEffectiveCallingConv(CallingConv::ID CC, bool isVarArg) const
getEffectiveCallingConv - Get the effective calling convention, taking into account presence of float...
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:106
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:266
CodeGenTargetMachineImpl(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
Diagnostic information for unsupported feature in backend.
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...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
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:305
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)
StringRef getTargetABIName(const Module &M) const
Returns the effective target ABI name: the "target-abi" module flag if present, otherwise the -target...
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
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
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,...
LLVM_ABI LLVM_READONLY ARMABI computeTargetABI(const Triple &TT, StringRef ABIName="")
@ ARM_AAPCS_VFP
Same as ARM_AAPCS, but uses hard floating point ABI.
std::optional< ABIType > parseABIType(StringRef S)
Parse the string spelling used by the "float-abi" IR module flag into an ABIType.
Definition CodeGen.h:167
@ 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.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
void initializeMVETailPredicationPass(PassRegistry &)
void initializeMVELaneInterleavingPass(PassRegistry &)
Pass * createMVEGatherScatterLoweringPass()
LLVM_ABI FunctionPass * createEHContGuardTargetsLegacy()
Creates Windows EH Continuation Guard target identification pass.
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...
auto cast_or_null(const Y &Val)
Definition Casting.h:714
LLVM_ABI 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 ...
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()
auto dyn_cast_or_null(const Y &Val)
Definition Casting.h:753
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:227
@ Default
-O2, -Os, -Oz
Definition CodeGen.h:230
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:315
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 &)
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.