1 //===-- ARMSubtarget.h - Define Subtarget for the ARM ----------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the ARM specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H
15 #define LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H
17 #include "ARMBaseInstrInfo.h"
18 #include "ARMBaseRegisterInfo.h"
19 #include "ARMFrameLowering.h"
20 #include "ARMISelLowering.h"
21 #include "ARMSelectionDAGInfo.h"
22 #include "llvm/ADT/Triple.h"
23 #include "llvm/CodeGen/GlobalISel/GISelAccessor.h"
24 #include "llvm/CodeGen/MachineFunction.h"
25 #include "llvm/MC/MCInstrItineraries.h"
26 #include "llvm/MC/MCSchedule.h"
27 #include "llvm/Target/TargetOptions.h"
28 #include "llvm/Target/TargetSubtargetInfo.h"
32 #define GET_SUBTARGETINFO_HEADER
33 #include "ARMGenSubtargetInfo.inc"
37 class ARMBaseTargetMachine;
41 class ARMSubtarget : public ARMGenSubtargetInfo {
43 enum ARMProcFamilyEnum {
70 enum ARMProcClassEnum {
108 /// What kind of timing do load multiple/store multiple instructions have.
109 enum ARMLdStMultipleTiming {
110 /// Can load/store 2 registers/cycle.
112 /// Can load/store 2 registers/cycle, but needs an extra cycle if the access
113 /// is not 64-bit aligned.
114 DoubleIssueCheckUnalignedAccess,
115 /// Can load/store 1 register/cycle.
117 /// Can load/store 1 register/cycle, but needs an extra cycle for address
118 /// computation and potentially also for register writeback.
119 SingleIssuePlusExtras,
123 /// ARMProcFamily - ARM processor family: Cortex-A8, Cortex-A9, and others.
124 ARMProcFamilyEnum ARMProcFamily = Others;
126 /// ARMProcClass - ARM processor class: None, AClass, RClass or MClass.
127 ARMProcClassEnum ARMProcClass = None;
129 /// ARMArch - ARM architecture
130 ARMArchEnum ARMArch = ARMv4t;
132 /// HasV4TOps, HasV5TOps, HasV5TEOps,
133 /// HasV6Ops, HasV6MOps, HasV6KOps, HasV6T2Ops, HasV7Ops, HasV8Ops -
134 /// Specify whether target support specific ARM ISA variants.
135 bool HasV4TOps = false;
136 bool HasV5TOps = false;
137 bool HasV5TEOps = false;
138 bool HasV6Ops = false;
139 bool HasV6MOps = false;
140 bool HasV6KOps = false;
141 bool HasV6T2Ops = false;
142 bool HasV7Ops = false;
143 bool HasV8Ops = false;
144 bool HasV8_1aOps = false;
145 bool HasV8_2aOps = false;
146 bool HasV8MBaselineOps = false;
147 bool HasV8MMainlineOps = false;
149 /// HasVFPv2, HasVFPv3, HasVFPv4, HasFPARMv8, HasNEON - Specify what
150 /// floating point ISAs are supported.
151 bool HasVFPv2 = false;
152 bool HasVFPv3 = false;
153 bool HasVFPv4 = false;
154 bool HasFPARMv8 = false;
155 bool HasNEON = false;
157 /// UseNEONForSinglePrecisionFP - if the NEONFP attribute has been
158 /// specified. Use the method useNEONForSinglePrecisionFP() to
159 /// determine if NEON should actually be used.
160 bool UseNEONForSinglePrecisionFP = false;
162 /// UseMulOps - True if non-microcoded fused integer multiply-add and
163 /// multiply-subtract instructions should be used.
164 bool UseMulOps = false;
166 /// SlowFPVMLx - If the VFP2 / NEON instructions are available, indicates
167 /// whether the FP VML[AS] instructions are slow (if so, don't use them).
168 bool SlowFPVMLx = false;
170 /// HasVMLxForwarding - If true, NEON has special multiplier accumulator
171 /// forwarding to allow mul + mla being issued back to back.
172 bool HasVMLxForwarding = false;
174 /// SlowFPBrcc - True if floating point compare + branch is slow.
175 bool SlowFPBrcc = false;
177 /// InThumbMode - True if compiling for Thumb, false for ARM.
178 bool InThumbMode = false;
180 /// UseSoftFloat - True if we're using software floating point features.
181 bool UseSoftFloat = false;
183 /// HasThumb2 - True if Thumb2 instructions are supported.
184 bool HasThumb2 = false;
186 /// NoARM - True if subtarget does not support ARM mode execution.
189 /// ReserveR9 - True if R9 is not available as a general purpose register.
190 bool ReserveR9 = false;
192 /// NoMovt - True if MOVT / MOVW pairs are not used for materialization of
193 /// 32-bit imms (including global addresses).
196 /// SupportsTailCall - True if the OS supports tail call. The dynamic linker
197 /// must be able to synthesize call stubs for interworking between ARM and
199 bool SupportsTailCall = false;
201 /// HasFP16 - True if subtarget supports half-precision FP conversions
202 bool HasFP16 = false;
204 /// HasFullFP16 - True if subtarget supports half-precision FP operations
205 bool HasFullFP16 = false;
207 /// HasD16 - True if subtarget is limited to 16 double precision
208 /// FP registers for VFPv3.
211 /// HasHardwareDivide - True if subtarget supports [su]div in Thumb mode
212 bool HasHardwareDivideInThumb = false;
214 /// HasHardwareDivideInARM - True if subtarget supports [su]div in ARM mode
215 bool HasHardwareDivideInARM = false;
217 /// HasDataBarrier - True if the subtarget supports DMB / DSB data barrier
219 bool HasDataBarrier = false;
221 /// HasV7Clrex - True if the subtarget supports CLREX instructions
222 bool HasV7Clrex = false;
224 /// HasAcquireRelease - True if the subtarget supports v8 atomics (LDA/LDAEX etc)
226 bool HasAcquireRelease = false;
228 /// Pref32BitThumb - If true, codegen would prefer 32-bit Thumb instructions
229 /// over 16-bit ones.
230 bool Pref32BitThumb = false;
232 /// AvoidCPSRPartialUpdate - If true, codegen would avoid using instructions
233 /// that partially update CPSR and add false dependency on the previous
234 /// CPSR setting instruction.
235 bool AvoidCPSRPartialUpdate = false;
237 /// CheapPredicableCPSRDef - If true, disable +1 predication cost
238 /// for instructions updating CPSR. Enabled for Cortex-A57.
239 bool CheapPredicableCPSRDef = false;
241 /// AvoidMOVsShifterOperand - If true, codegen should avoid using flag setting
242 /// movs with shifter operand (i.e. asr, lsl, lsr).
243 bool AvoidMOVsShifterOperand = false;
245 /// HasRetAddrStack - Some processors perform return stack prediction. CodeGen should
246 /// avoid issue "normal" call instructions to callees which do not return.
247 bool HasRetAddrStack = false;
249 /// HasBranchPredictor - True if the subtarget has a branch predictor. Having
250 /// a branch predictor or not changes the expected cost of taking a branch
251 /// which affects the choice of whether to use predicated instructions.
252 bool HasBranchPredictor = true;
254 /// HasMPExtension - True if the subtarget supports Multiprocessing
255 /// extension (ARMv7 only).
256 bool HasMPExtension = false;
258 /// HasVirtualization - True if the subtarget supports the Virtualization
260 bool HasVirtualization = false;
262 /// FPOnlySP - If true, the floating point unit only supports single
264 bool FPOnlySP = false;
266 /// If true, the processor supports the Performance Monitor Extensions. These
267 /// include a generic cycle-counter as well as more fine-grained (often
268 /// implementation-specific) events.
269 bool HasPerfMon = false;
271 /// HasTrustZone - if true, processor supports TrustZone security extensions
272 bool HasTrustZone = false;
274 /// Has8MSecExt - if true, processor supports ARMv8-M Security Extensions
275 bool Has8MSecExt = false;
277 /// HasCrypto - if true, processor supports Cryptography extensions
278 bool HasCrypto = false;
280 /// HasCRC - if true, processor supports CRC instructions
283 /// HasRAS - if true, the processor supports RAS extensions
286 /// If true, the instructions "vmov.i32 d0, #0" and "vmov.i32 q0, #0" are
287 /// particularly effective at zeroing a VFP register.
288 bool HasZeroCycleZeroing = false;
290 /// HasFPAO - if true, processor does positive address offset computation faster
291 bool HasFPAO = false;
293 /// HasFuseAES - if true, processor executes back to back AES instruction
295 bool HasFuseAES = false;
297 /// If true, if conversion may decide to leave some instructions unpredicated.
298 bool IsProfitableToUnpredicate = false;
300 /// If true, VMOV will be favored over VGETLNi32.
301 bool HasSlowVGETLNi32 = false;
303 /// If true, VMOV will be favored over VDUP.
304 bool HasSlowVDUP32 = false;
306 /// If true, VMOVSR will be favored over VMOVDRR.
307 bool PreferVMOVSR = false;
309 /// If true, ISHST barriers will be used for Release semantics.
310 bool PreferISHST = false;
312 /// If true, a VLDM/VSTM starting with an odd register number is considered to
313 /// take more microops than single VLDRS/VSTRS.
314 bool SlowOddRegister = false;
316 /// If true, loading into a D subregister will be penalized.
317 bool SlowLoadDSubregister = false;
319 /// If true, the AGU and NEON/FPU units are multiplexed.
320 bool HasMuxedUnits = false;
322 /// If true, VMOVS will never be widened to VMOVD
323 bool DontWidenVMOVS = false;
325 /// If true, run the MLx expansion pass.
326 bool ExpandMLx = false;
328 /// If true, VFP/NEON VMLA/VMLS have special RAW hazards.
329 bool HasVMLxHazards = false;
331 /// If true, VMOVRS, VMOVSR and VMOVS will be converted from VFP to NEON.
332 bool UseNEONForFPMovs = false;
334 /// If true, VLDn instructions take an extra cycle for unaligned accesses.
335 bool CheckVLDnAlign = false;
337 /// If true, VFP instructions are not pipelined.
338 bool NonpipelinedVFP = false;
340 /// StrictAlign - If true, the subtarget disallows unaligned memory
341 /// accesses for some types. For details, see
342 /// ARMTargetLowering::allowsMisalignedMemoryAccesses().
343 bool StrictAlign = false;
345 /// RestrictIT - If true, the subtarget disallows generation of deprecated IT
346 /// blocks to conform to ARMv8 rule.
347 bool RestrictIT = false;
349 /// HasDSP - If true, the subtarget supports the DSP (saturating arith
350 /// and such) instructions.
353 /// NaCl TRAP instruction is generated instead of the regular TRAP.
354 bool UseNaClTrap = false;
356 /// Generate calls via indirect call instructions.
357 bool GenLongCalls = false;
359 /// Generate code that does not contain data access to code sections.
360 bool GenExecuteOnly = false;
362 /// Target machine allowed unsafe FP math (such as use of NEON fp)
363 bool UnsafeFPMath = false;
365 /// UseSjLjEH - If true, the target uses SjLj exception handling (e.g. iOS).
366 bool UseSjLjEH = false;
368 /// Implicitly convert an instruction to a different one if its immediates
369 /// cannot be encoded. For example, ADD r0, r1, #FFFFFFFF -> SUB r0, r1, #1.
370 bool NegativeImmediates = true;
372 /// stackAlignment - The minimum alignment known to hold of the stack frame on
373 /// entry to the function and which must be maintained by every function.
374 unsigned stackAlignment = 4;
376 /// CPUString - String name of used CPU.
377 std::string CPUString;
379 unsigned MaxInterleaveFactor = 1;
381 /// Clearance before partial register updates (in number of instructions)
382 unsigned PartialUpdateClearance = 0;
384 /// What kind of timing do load multiple/store multiple have (double issue,
385 /// single issue etc).
386 ARMLdStMultipleTiming LdStMultipleTiming = SingleIssue;
388 /// The adjustment that we need to apply to get the operand latency from the
389 /// operand cycle returned by the itinerary data for pre-ISel operands.
390 int PreISelOperandLatencyAdjustment = 2;
392 /// IsLittle - The target is Little Endian
395 /// TargetTriple - What processor and OS we're targeting.
398 /// SchedModel - Processor specific instruction costs.
399 MCSchedModel SchedModel;
401 /// Selected instruction itineraries (one entry per itinerary class.)
402 InstrItineraryData InstrItins;
404 /// Options passed via command line that could influence the target
405 const TargetOptions &Options;
407 const ARMBaseTargetMachine &TM;
410 /// This constructor initializes the data members to match that
411 /// of the specified triple.
413 ARMSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
414 const ARMBaseTargetMachine &TM, bool IsLittle);
416 /// This object will take onwership of \p GISelAccessor.
417 void setGISelAccessor(GISelAccessor &GISel) { this->GISel.reset(&GISel); }
419 /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
420 /// that still makes it profitable to inline the call.
421 unsigned getMaxInlineSizeThreshold() const {
425 /// ParseSubtargetFeatures - Parses features string setting specified
426 /// subtarget options. Definition of function is auto generated by tblgen.
427 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
429 /// initializeSubtargetDependencies - Initializes using a CPU and feature string
430 /// so that we can use initializer lists for subtarget initialization.
431 ARMSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
433 const ARMSelectionDAGInfo *getSelectionDAGInfo() const override {
437 const ARMBaseInstrInfo *getInstrInfo() const override {
438 return InstrInfo.get();
441 const ARMTargetLowering *getTargetLowering() const override {
445 const ARMFrameLowering *getFrameLowering() const override {
446 return FrameLowering.get();
449 const ARMBaseRegisterInfo *getRegisterInfo() const override {
450 return &InstrInfo->getRegisterInfo();
453 const CallLowering *getCallLowering() const override;
454 const InstructionSelector *getInstructionSelector() const override;
455 const LegalizerInfo *getLegalizerInfo() const override;
456 const RegisterBankInfo *getRegBankInfo() const override;
459 ARMSelectionDAGInfo TSInfo;
460 // Either Thumb1FrameLowering or ARMFrameLowering.
461 std::unique_ptr<ARMFrameLowering> FrameLowering;
462 // Either Thumb1InstrInfo or Thumb2InstrInfo.
463 std::unique_ptr<ARMBaseInstrInfo> InstrInfo;
464 ARMTargetLowering TLInfo;
466 /// Gather the accessor points to GlobalISel-related APIs.
467 /// This is used to avoid ifndefs spreading around while GISel is
468 /// an optional library.
469 std::unique_ptr<GISelAccessor> GISel;
471 void initializeEnvironment();
472 void initSubtargetFeatures(StringRef CPU, StringRef FS);
473 ARMFrameLowering *initializeFrameLowering(StringRef CPU, StringRef FS);
476 void computeIssueWidth();
478 bool hasV4TOps() const { return HasV4TOps; }
479 bool hasV5TOps() const { return HasV5TOps; }
480 bool hasV5TEOps() const { return HasV5TEOps; }
481 bool hasV6Ops() const { return HasV6Ops; }
482 bool hasV6MOps() const { return HasV6MOps; }
483 bool hasV6KOps() const { return HasV6KOps; }
484 bool hasV6T2Ops() const { return HasV6T2Ops; }
485 bool hasV7Ops() const { return HasV7Ops; }
486 bool hasV8Ops() const { return HasV8Ops; }
487 bool hasV8_1aOps() const { return HasV8_1aOps; }
488 bool hasV8_2aOps() const { return HasV8_2aOps; }
489 bool hasV8MBaselineOps() const { return HasV8MBaselineOps; }
490 bool hasV8MMainlineOps() const { return HasV8MMainlineOps; }
493 /// These functions are obsolete, please consider adding subtarget features
494 /// or properties instead of calling them.
495 bool isCortexA5() const { return ARMProcFamily == CortexA5; }
496 bool isCortexA7() const { return ARMProcFamily == CortexA7; }
497 bool isCortexA8() const { return ARMProcFamily == CortexA8; }
498 bool isCortexA9() const { return ARMProcFamily == CortexA9; }
499 bool isCortexA15() const { return ARMProcFamily == CortexA15; }
500 bool isSwift() const { return ARMProcFamily == Swift; }
501 bool isCortexM3() const { return ARMProcFamily == CortexM3; }
502 bool isLikeA9() const { return isCortexA9() || isCortexA15() || isKrait(); }
503 bool isCortexR5() const { return ARMProcFamily == CortexR5; }
504 bool isKrait() const { return ARMProcFamily == Krait; }
507 bool hasARMOps() const { return !NoARM; }
509 bool hasVFP2() const { return HasVFPv2; }
510 bool hasVFP3() const { return HasVFPv3; }
511 bool hasVFP4() const { return HasVFPv4; }
512 bool hasFPARMv8() const { return HasFPARMv8; }
513 bool hasNEON() const { return HasNEON; }
514 bool hasCrypto() const { return HasCrypto; }
515 bool hasCRC() const { return HasCRC; }
516 bool hasRAS() const { return HasRAS; }
517 bool hasVirtualization() const { return HasVirtualization; }
519 bool useNEONForSinglePrecisionFP() const {
520 return hasNEON() && UseNEONForSinglePrecisionFP;
523 bool hasDivideInThumbMode() const { return HasHardwareDivideInThumb; }
524 bool hasDivideInARMMode() const { return HasHardwareDivideInARM; }
525 bool hasDataBarrier() const { return HasDataBarrier; }
526 bool hasV7Clrex() const { return HasV7Clrex; }
527 bool hasAcquireRelease() const { return HasAcquireRelease; }
529 bool hasAnyDataBarrier() const {
530 return HasDataBarrier || (hasV6Ops() && !isThumb());
533 bool useMulOps() const { return UseMulOps; }
534 bool useFPVMLx() const { return !SlowFPVMLx; }
535 bool hasVMLxForwarding() const { return HasVMLxForwarding; }
536 bool isFPBrccSlow() const { return SlowFPBrcc; }
537 bool isFPOnlySP() const { return FPOnlySP; }
538 bool hasPerfMon() const { return HasPerfMon; }
539 bool hasTrustZone() const { return HasTrustZone; }
540 bool has8MSecExt() const { return Has8MSecExt; }
541 bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
542 bool hasFPAO() const { return HasFPAO; }
543 bool isProfitableToUnpredicate() const { return IsProfitableToUnpredicate; }
544 bool hasSlowVGETLNi32() const { return HasSlowVGETLNi32; }
545 bool hasSlowVDUP32() const { return HasSlowVDUP32; }
546 bool preferVMOVSR() const { return PreferVMOVSR; }
547 bool preferISHSTBarriers() const { return PreferISHST; }
548 bool expandMLx() const { return ExpandMLx; }
549 bool hasVMLxHazards() const { return HasVMLxHazards; }
550 bool hasSlowOddRegister() const { return SlowOddRegister; }
551 bool hasSlowLoadDSubregister() const { return SlowLoadDSubregister; }
552 bool hasMuxedUnits() const { return HasMuxedUnits; }
553 bool dontWidenVMOVS() const { return DontWidenVMOVS; }
554 bool useNEONForFPMovs() const { return UseNEONForFPMovs; }
555 bool checkVLDnAccessAlignment() const { return CheckVLDnAlign; }
556 bool nonpipelinedVFP() const { return NonpipelinedVFP; }
557 bool prefers32BitThumb() const { return Pref32BitThumb; }
558 bool avoidCPSRPartialUpdate() const { return AvoidCPSRPartialUpdate; }
559 bool cheapPredicableCPSRDef() const { return CheapPredicableCPSRDef; }
560 bool avoidMOVsShifterOperand() const { return AvoidMOVsShifterOperand; }
561 bool hasRetAddrStack() const { return HasRetAddrStack; }
562 bool hasBranchPredictor() const { return HasBranchPredictor; }
563 bool hasMPExtension() const { return HasMPExtension; }
564 bool hasDSP() const { return HasDSP; }
565 bool useNaClTrap() const { return UseNaClTrap; }
566 bool useSjLjEH() const { return UseSjLjEH; }
567 bool genLongCalls() const { return GenLongCalls; }
568 bool genExecuteOnly() const { return GenExecuteOnly; }
570 bool hasFP16() const { return HasFP16; }
571 bool hasD16() const { return HasD16; }
572 bool hasFullFP16() const { return HasFullFP16; }
574 bool hasFuseAES() const { return HasFuseAES; }
575 /// \brief Return true if the CPU supports any kind of instruction fusion.
576 bool hasFusion() const { return hasFuseAES(); }
578 const Triple &getTargetTriple() const { return TargetTriple; }
580 bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
581 bool isTargetIOS() const { return TargetTriple.isiOS(); }
582 bool isTargetWatchOS() const { return TargetTriple.isWatchOS(); }
583 bool isTargetWatchABI() const { return TargetTriple.isWatchABI(); }
584 bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
585 bool isTargetNaCl() const { return TargetTriple.isOSNaCl(); }
586 bool isTargetNetBSD() const { return TargetTriple.isOSNetBSD(); }
587 bool isTargetWindows() const { return TargetTriple.isOSWindows(); }
589 bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); }
590 bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
591 bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
593 // ARM EABI is the bare-metal EABI described in ARM ABI documents and
594 // can be accessed via -target arm-none-eabi. This is NOT GNUEABI.
595 // FIXME: Add a flag for bare-metal for that target and set Triple::EABI
596 // even for GNUEABI, so we can make a distinction here and still conform to
597 // the EABI on GNU (and Android) mode. This requires change in Clang, too.
598 // FIXME: The Darwin exception is temporary, while we move users to
599 // "*-*-*-macho" triples as quickly as possible.
600 bool isTargetAEABI() const {
601 return (TargetTriple.getEnvironment() == Triple::EABI ||
602 TargetTriple.getEnvironment() == Triple::EABIHF) &&
603 !isTargetDarwin() && !isTargetWindows();
605 bool isTargetGNUAEABI() const {
606 return (TargetTriple.getEnvironment() == Triple::GNUEABI ||
607 TargetTriple.getEnvironment() == Triple::GNUEABIHF) &&
608 !isTargetDarwin() && !isTargetWindows();
610 bool isTargetMuslAEABI() const {
611 return (TargetTriple.getEnvironment() == Triple::MuslEABI ||
612 TargetTriple.getEnvironment() == Triple::MuslEABIHF) &&
613 !isTargetDarwin() && !isTargetWindows();
616 // ARM Targets that support EHABI exception handling standard
617 // Darwin uses SjLj. Other targets might need more checks.
618 bool isTargetEHABICompatible() const {
619 return (TargetTriple.getEnvironment() == Triple::EABI ||
620 TargetTriple.getEnvironment() == Triple::GNUEABI ||
621 TargetTriple.getEnvironment() == Triple::MuslEABI ||
622 TargetTriple.getEnvironment() == Triple::EABIHF ||
623 TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
624 TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
625 isTargetAndroid()) &&
626 !isTargetDarwin() && !isTargetWindows();
629 bool isTargetHardFloat() const {
630 // FIXME: this is invalid for WindowsCE
631 return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
632 TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
633 TargetTriple.getEnvironment() == Triple::EABIHF ||
634 isTargetWindows() || isAAPCS16_ABI();
637 bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
639 bool isXRaySupported() const override;
641 bool isAPCS_ABI() const;
642 bool isAAPCS_ABI() const;
643 bool isAAPCS16_ABI() const;
648 bool useSoftFloat() const { return UseSoftFloat; }
649 bool isThumb() const { return InThumbMode; }
650 bool isThumb1Only() const { return InThumbMode && !HasThumb2; }
651 bool isThumb2() const { return InThumbMode && HasThumb2; }
652 bool hasThumb2() const { return HasThumb2; }
653 bool isMClass() const { return ARMProcClass == MClass; }
654 bool isRClass() const { return ARMProcClass == RClass; }
655 bool isAClass() const { return ARMProcClass == AClass; }
657 bool isR9Reserved() const {
658 return isTargetMachO() ? (ReserveR9 || !HasV6Ops) : ReserveR9;
661 bool useR7AsFramePointer() const {
662 return isTargetDarwin() || (!isTargetWindows() && isThumb());
665 /// Returns true if the frame setup is split into two separate pushes (first
666 /// r0-r7,lr then r8-r11), principally so that the frame pointer is adjacent
667 /// to lr. This is always required on Thumb1-only targets, as the push and
668 /// pop instructions can't access the high registers.
669 bool splitFramePushPop(const MachineFunction &MF) const {
670 return (useR7AsFramePointer() &&
671 MF.getTarget().Options.DisableFramePointerElim(MF)) ||
675 bool useStride4VFPs(const MachineFunction &MF) const;
677 bool useMovt(const MachineFunction &MF) const;
679 bool supportsTailCall() const { return SupportsTailCall; }
681 bool allowsUnalignedMem() const { return !StrictAlign; }
683 bool restrictIT() const { return RestrictIT; }
685 const std::string & getCPUString() const { return CPUString; }
687 bool isLittle() const { return IsLittle; }
689 unsigned getMispredictionPenalty() const;
691 /// This function returns true if the target has sincos() routine in its
692 /// compiler runtime or math libraries.
693 bool hasSinCos() const;
695 /// Returns true if machine scheduler should be enabled.
696 bool enableMachineScheduler() const override;
698 /// True for some subtargets at > -O0.
699 bool enablePostRAScheduler() const override;
701 // enableAtomicExpand- True if we need to expand our atomics.
702 bool enableAtomicExpand() const override;
704 /// getInstrItins - Return the instruction itineraries based on subtarget
706 const InstrItineraryData *getInstrItineraryData() const override {
710 /// getStackAlignment - Returns the minimum alignment known to hold of the
711 /// stack frame on entry to the function and which must be maintained by every
712 /// function for this subtarget.
713 unsigned getStackAlignment() const { return stackAlignment; }
715 unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
717 unsigned getPartialUpdateClearance() const { return PartialUpdateClearance; }
719 ARMLdStMultipleTiming getLdStMultipleTiming() const {
720 return LdStMultipleTiming;
723 int getPreISelOperandLatencyAdjustment() const {
724 return PreISelOperandLatencyAdjustment;
727 /// True if the GV will be accessed via an indirect symbol.
728 bool isGVIndirectSymbol(const GlobalValue *GV) const;
730 /// True if fast-isel is used.
731 bool useFastISel() const;
734 } // end namespace llvm
736 #endif // LLVM_LIB_TARGET_ARM_ARMSUBTARGET_H