blob: 9c4f05283f20ca68aec8e0113f08c2f74dba0b58 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- ARMSubtarget.cpp - ARM Subtarget Information ----------------------===//
Evan Cheng10043e22007-01-19 07:51:42 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Evan Cheng10043e22007-01-19 07:51:42 +00007//
8//===----------------------------------------------------------------------===//
9//
Evan Cheng0d639a22011-07-01 21:01:15 +000010// This file implements the ARM specific subclass of TargetSubtargetInfo.
Evan Cheng10043e22007-01-19 07:51:42 +000011//
12//===----------------------------------------------------------------------===//
13
14#include "ARMSubtarget.h"
Eric Christopher80b24ef2014-06-26 19:30:02 +000015#include "ARMFrameLowering.h"
16#include "ARMISelLowering.h"
17#include "ARMInstrInfo.h"
Eric Christopherb9fd9ed2014-08-07 22:02:54 +000018#include "ARMJITInfo.h"
Eric Christopher80b24ef2014-06-26 19:30:02 +000019#include "ARMSelectionDAGInfo.h"
20#include "ARMSubtarget.h"
Chris Bieneman03695ab2014-07-15 17:18:41 +000021#include "ARMMachineFunctionInfo.h"
Eric Christopher80b24ef2014-06-26 19:30:02 +000022#include "Thumb1FrameLowering.h"
23#include "Thumb1InstrInfo.h"
24#include "Thumb2InstrInfo.h"
Bill Wendling5a92eec2013-02-15 22:41:25 +000025#include "llvm/IR/Attributes.h"
Bill Wendling5a92eec2013-02-15 22:41:25 +000026#include "llvm/IR/Function.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000027#include "llvm/IR/GlobalValue.h"
Bob Wilson45825302009-06-22 21:01:46 +000028#include "llvm/Support/CommandLine.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000029#include "llvm/Target/TargetInstrInfo.h"
Renato Golinb4dd6c52013-03-21 18:47:47 +000030#include "llvm/Target/TargetOptions.h"
Chris Bieneman03695ab2014-07-15 17:18:41 +000031#include "llvm/Target/TargetRegisterInfo.h"
32#include "llvm/CodeGen/MachineRegisterInfo.h"
Evan Cheng54b68e32011-07-01 20:45:01 +000033
Chandler Carruthd174b722014-04-22 02:03:14 +000034using namespace llvm;
35
Chandler Carruthe96dd892014-04-21 22:55:11 +000036#define DEBUG_TYPE "arm-subtarget"
37
Evan Cheng54b68e32011-07-01 20:45:01 +000038#define GET_SUBTARGETINFO_TARGET_DESC
Evan Cheng4d1ca962011-07-08 01:53:10 +000039#define GET_SUBTARGETINFO_CTOR
Evan Chengc9c090d2011-07-01 22:36:09 +000040#include "ARMGenSubtargetInfo.inc"
Evan Cheng54b68e32011-07-01 20:45:01 +000041
Bob Wilson45825302009-06-22 21:01:46 +000042static cl::opt<bool>
43ReserveR9("arm-reserve-r9", cl::Hidden,
44 cl::desc("Reserve R9, making it unavailable as GPR"));
45
Anton Korobeynikov25229082009-11-24 00:44:37 +000046static cl::opt<bool>
Renato Golinca570632013-08-15 20:54:38 +000047ArmUseMOVT("arm-use-movt", cl::init(true), cl::Hidden);
Anton Korobeynikov25229082009-11-24 00:44:37 +000048
Bob Wilson3dc97322010-09-28 04:09:35 +000049static cl::opt<bool>
Bob Wilsone8a549c2012-09-29 21:43:49 +000050UseFusedMulOps("arm-use-mulops",
51 cl::init(true), cl::Hidden);
52
Alexey Samsonovf17f03e2014-08-19 18:40:39 +000053namespace {
JF Bastien97b08c402013-05-17 23:49:01 +000054enum AlignMode {
55 DefaultAlign,
56 StrictAlign,
57 NoStrictAlign
58};
Alexey Samsonovf17f03e2014-08-19 18:40:39 +000059}
JF Bastien97b08c402013-05-17 23:49:01 +000060
61static cl::opt<AlignMode>
62Align(cl::desc("Load/store alignment support"),
63 cl::Hidden, cl::init(DefaultAlign),
64 cl::values(
65 clEnumValN(DefaultAlign, "arm-default-align",
66 "Generate unaligned accesses only on hardware/OS "
67 "combinations that are known to support them"),
68 clEnumValN(StrictAlign, "arm-strict-align",
69 "Disallow all unaligned memory accesses"),
70 clEnumValN(NoStrictAlign, "arm-no-strict-align",
71 "Allow unaligned memory accesses"),
72 clEnumValEnd));
Bob Wilson3dc97322010-09-28 04:09:35 +000073
Weiming Zhao0da5cc02013-11-13 18:29:49 +000074enum ITMode {
75 DefaultIT,
76 RestrictedIT,
77 NoRestrictedIT
78};
79
80static cl::opt<ITMode>
81IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT),
82 cl::ZeroOrMore,
83 cl::values(clEnumValN(DefaultIT, "arm-default-it",
84 "Generate IT block based on arch"),
85 clEnumValN(RestrictedIT, "arm-restrict-it",
86 "Disallow deprecated IT based on ARMv8"),
87 clEnumValN(NoRestrictedIT, "arm-no-restrict-it",
88 "Allow IT blocks based on ARMv7"),
89 clEnumValEnd));
90
Eric Christophera47f6802014-06-13 00:20:35 +000091static std::string computeDataLayout(ARMSubtarget &ST) {
92 std::string Ret = "";
93
94 if (ST.isLittle())
95 // Little endian.
96 Ret += "e";
97 else
98 // Big endian.
99 Ret += "E";
100
101 Ret += DataLayout::getManglingComponent(ST.getTargetTriple());
102
103 // Pointers are 32 bits and aligned to 32 bits.
104 Ret += "-p:32:32";
105
106 // On thumb, i16,i18 and i1 have natural aligment requirements, but we try to
107 // align to 32.
108 if (ST.isThumb())
109 Ret += "-i1:8:32-i8:8:32-i16:16:32";
110
111 // ABIs other than APCS have 64 bit integers with natural alignment.
112 if (!ST.isAPCS_ABI())
113 Ret += "-i64:64";
114
115 // We have 64 bits floats. The APCS ABI requires them to be aligned to 32
116 // bits, others to 64 bits. We always try to align to 64 bits.
117 if (ST.isAPCS_ABI())
118 Ret += "-f64:32:64";
119
120 // We have 128 and 64 bit vectors. The APCS ABI aligns them to 32 bits, others
121 // to 64. We always ty to give them natural alignment.
122 if (ST.isAPCS_ABI())
123 Ret += "-v64:32:64-v128:32:128";
124 else
125 Ret += "-v128:64:128";
126
127 // On thumb and APCS, only try to align aggregates to 32 bits (the default is
128 // 64 bits).
129 if (ST.isThumb() || ST.isAPCS_ABI())
130 Ret += "-a:0:32";
131
132 // Integer registers are 32 bits.
133 Ret += "-n32";
134
135 // The stack is 128 bit aligned on NaCl, 64 bit aligned on AAPCS and 32 bit
136 // aligned everywhere else.
137 if (ST.isTargetNaCl())
138 Ret += "-S128";
139 else if (ST.isAAPCS_ABI())
140 Ret += "-S64";
141 else
142 Ret += "-S32";
143
144 return Ret;
145}
146
147/// initializeSubtargetDependencies - Initializes using a CPU and feature string
148/// so that we can use initializer lists for subtarget initialization.
149ARMSubtarget &ARMSubtarget::initializeSubtargetDependencies(StringRef CPU,
150 StringRef FS) {
151 initializeEnvironment();
152 resetSubtargetFeatures(CPU, FS);
153 return *this;
154}
155
Evan Chengfe6e4052011-06-30 01:53:36 +0000156ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &CPU,
Eric Christopher80b24ef2014-06-26 19:30:02 +0000157 const std::string &FS, TargetMachine &TM,
158 bool IsLittle, const TargetOptions &Options)
Eric Christophera47f6802014-06-13 00:20:35 +0000159 : ARMGenSubtargetInfo(TT, CPU, FS), ARMProcFamily(Others),
160 ARMProcClass(None), stackAlignment(4), CPUString(CPU), IsLittle(IsLittle),
161 TargetTriple(TT), Options(Options), TargetABI(ARM_ABI_UNKNOWN),
Eric Christopher030294e2014-06-13 00:20:39 +0000162 DL(computeDataLayout(initializeSubtargetDependencies(CPU, FS))),
Eric Christopherb9fd9ed2014-08-07 22:02:54 +0000163 TSInfo(DL), JITInfo(),
Eric Christopher80b24ef2014-06-26 19:30:02 +0000164 InstrInfo(isThumb1Only()
165 ? (ARMBaseInstrInfo *)new Thumb1InstrInfo(*this)
166 : !isThumb()
167 ? (ARMBaseInstrInfo *)new ARMInstrInfo(*this)
168 : (ARMBaseInstrInfo *)new Thumb2InstrInfo(*this)),
169 TLInfo(TM),
170 FrameLowering(!isThumb1Only()
171 ? new ARMFrameLowering(*this)
172 : (ARMFrameLowering *)new Thumb1FrameLowering(*this)) {}
Bill Wendling5a92eec2013-02-15 22:41:25 +0000173
Bill Wendling61375d82013-02-16 01:36:26 +0000174void ARMSubtarget::initializeEnvironment() {
175 HasV4TOps = false;
176 HasV5TOps = false;
177 HasV5TEOps = false;
178 HasV6Ops = false;
Amara Emerson5035ee02013-10-07 16:55:23 +0000179 HasV6MOps = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000180 HasV6T2Ops = false;
181 HasV7Ops = false;
Joey Goulyb3f550e2013-06-26 16:58:26 +0000182 HasV8Ops = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000183 HasVFPv2 = false;
184 HasVFPv3 = false;
185 HasVFPv4 = false;
Joey Goulyccd04892013-09-13 13:46:57 +0000186 HasFPARMv8 = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000187 HasNEON = false;
188 UseNEONForSinglePrecisionFP = false;
189 UseMulOps = UseFusedMulOps;
190 SlowFPVMLx = false;
191 HasVMLxForwarding = false;
192 SlowFPBrcc = false;
193 InThumbMode = false;
194 HasThumb2 = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000195 NoARM = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000196 IsR9Reserved = ReserveR9;
197 UseMovt = false;
198 SupportsTailCall = false;
199 HasFP16 = false;
200 HasD16 = false;
201 HasHardwareDivide = false;
202 HasHardwareDivideInARM = false;
203 HasT2ExtractPack = false;
204 HasDataBarrier = false;
205 Pref32BitThumb = false;
206 AvoidCPSRPartialUpdate = false;
207 AvoidMOVsShifterOperand = false;
208 HasRAS = false;
209 HasMPExtension = false;
Bradley Smith25219752013-11-01 13:27:35 +0000210 HasVirtualization = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000211 FPOnlySP = false;
Tim Northovercedd4812013-05-23 19:11:14 +0000212 HasPerfMon = false;
Tim Northoverc6047652013-04-10 12:08:35 +0000213 HasTrustZone = false;
Amara Emerson33089092013-09-19 11:59:01 +0000214 HasCrypto = false;
Amara Emersonf9a67fc2013-10-29 16:54:52 +0000215 HasCRC = false;
Tim Northover13510302014-04-01 13:22:02 +0000216 HasZeroCycleZeroing = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000217 AllowsUnalignedMem = false;
218 Thumb2DSP = false;
219 UseNaClTrap = false;
Renato Golinb4dd6c52013-03-21 18:47:47 +0000220 UnsafeFPMath = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000221}
222
Bill Wendling5a92eec2013-02-15 22:41:25 +0000223void ARMSubtarget::resetSubtargetFeatures(const MachineFunction *MF) {
224 AttributeSet FnAttrs = MF->getFunction()->getAttributes();
225 Attribute CPUAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,
226 "target-cpu");
227 Attribute FSAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,
228 "target-features");
229 std::string CPU =
230 !CPUAttr.hasAttribute(Attribute::None) ?CPUAttr.getValueAsString() : "";
231 std::string FS =
232 !FSAttr.hasAttribute(Attribute::None) ? FSAttr.getValueAsString() : "";
Bill Wendling61375d82013-02-16 01:36:26 +0000233 if (!FS.empty()) {
234 initializeEnvironment();
Bill Wendling5a92eec2013-02-15 22:41:25 +0000235 resetSubtargetFeatures(CPU, FS);
Bill Wendling61375d82013-02-16 01:36:26 +0000236 }
Bill Wendling5a92eec2013-02-15 22:41:25 +0000237}
238
239void ARMSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) {
Tilmann Scheller63872ce2013-09-02 17:09:01 +0000240 if (CPUString.empty()) {
241 if (isTargetIOS() && TargetTriple.getArchName().endswith("v7s"))
242 // Default to the Swift CPU when targeting armv7s/thumbv7s.
243 CPUString = "swift";
244 else
245 CPUString = "generic";
246 }
Evan Chengec415ef2009-03-08 04:02:49 +0000247
Evan Cheng0b33a322011-06-30 02:12:44 +0000248 // Insert the architecture feature derived from the target triple into the
249 // feature string. This is important for setting features that are implied
250 // based on the architecture version.
Bill Wendling5a92eec2013-02-15 22:41:25 +0000251 std::string ArchFS = ARM_MC::ParseARMTriple(TargetTriple.getTriple(),
252 CPUString);
Evan Cheng2bd65362011-07-07 00:08:19 +0000253 if (!FS.empty()) {
254 if (!ArchFS.empty())
Bill Wendling5a92eec2013-02-15 22:41:25 +0000255 ArchFS = ArchFS + "," + FS.str();
Evan Cheng2bd65362011-07-07 00:08:19 +0000256 else
257 ArchFS = FS;
258 }
Evan Cheng1a72add62011-07-07 07:07:08 +0000259 ParseSubtargetFeatures(CPUString, ArchFS);
Evan Cheng2bd65362011-07-07 00:08:19 +0000260
Joerg Sonnenberger002a1472013-12-13 11:16:00 +0000261 // FIXME: This used enable V6T2 support implicitly for Thumb2 mode.
262 // Assert this for now to make the change obvious.
263 assert(hasV6T2Ops() || !hasThumb2());
Bob Wilsond0046ca2010-11-09 22:50:47 +0000264
Andrew Trick352abc12012-08-08 02:44:16 +0000265 // Keep a pointer to static instruction cost data for the specified CPU.
266 SchedModel = getSchedModelForCPU(CPUString);
267
Evan Cheng54b68e32011-07-01 20:45:01 +0000268 // Initialize scheduling itinerary for the specified CPU.
269 InstrItins = getInstrItineraryForCPU(CPUString);
270
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000271 if (TargetABI == ARM_ABI_UNKNOWN) {
272 switch (TargetTriple.getEnvironment()) {
273 case Triple::Android:
274 case Triple::EABI:
275 case Triple::EABIHF:
276 case Triple::GNUEABI:
277 case Triple::GNUEABIHF:
Joerg Sonnenberger74669792013-12-15 00:12:52 +0000278 TargetABI = ARM_ABI_AAPCS;
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000279 break;
280 default:
Saleem Abdulrasool35476332014-03-06 20:47:11 +0000281 if ((isTargetIOS() && isMClass()) ||
282 (TargetTriple.isOSBinFormatMachO() &&
283 TargetTriple.getOS() == Triple::UnknownOS))
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000284 TargetABI = ARM_ABI_AAPCS;
285 else
286 TargetABI = ARM_ABI_APCS;
287 break;
288 }
Joerg Sonnenberger74669792013-12-15 00:12:52 +0000289 }
Evan Cheng1a72add62011-07-07 07:07:08 +0000290
Saleem Abdulrasoolcd130822014-04-02 20:32:05 +0000291 // FIXME: this is invalid for WindowsCE
292 if (isTargetWindows()) {
293 TargetABI = ARM_ABI_AAPCS;
294 NoARM = true;
295 }
296
Lauro Ramos Venancio048e16ff2007-02-13 19:52:28 +0000297 if (isAAPCS_ABI())
298 stackAlignment = 8;
Mark Seabornbe266aa2014-02-16 18:59:48 +0000299 if (isTargetNaCl())
300 stackAlignment = 16;
Lauro Ramos Venancio048e16ff2007-02-13 19:52:28 +0000301
Renato Golinca570632013-08-15 20:54:38 +0000302 UseMovt = hasV6T2Ops() && ArmUseMOVT;
303
Tim Northoverd6a729b2014-01-06 14:28:05 +0000304 if (isTargetMachO()) {
Evan Cheng8b2bda02011-07-07 03:55:05 +0000305 IsR9Reserved = ReserveR9 | !HasV6Ops;
Tim Northoverd6a729b2014-01-06 14:28:05 +0000306 SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0);
Saleem Abdulrasoolec1ec1b2014-03-11 15:09:44 +0000307 } else {
Tim Northoverd6a729b2014-01-06 14:28:05 +0000308 IsR9Reserved = ReserveR9;
Saleem Abdulrasoolec1ec1b2014-03-11 15:09:44 +0000309 SupportsTailCall = !isThumb1Only();
310 }
David Goodwin9a051a52009-10-01 21:46:35 +0000311
JF Bastien97b08c402013-05-17 23:49:01 +0000312 switch (Align) {
313 case DefaultAlign:
314 // Assume pre-ARMv6 doesn't support unaligned accesses.
315 //
316 // ARMv6 may or may not support unaligned accesses depending on the
317 // SCTLR.U bit, which is architecture-specific. We assume ARMv6
Jim Grosbach4a1a9ce2014-04-02 19:28:13 +0000318 // Darwin and NetBSD targets support unaligned accesses, and others don't.
JF Bastien97b08c402013-05-17 23:49:01 +0000319 //
320 // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit
321 // which raises an alignment fault on unaligned accesses. Linux
322 // defaults this bit to 0 and handles it as a system-wide (not
323 // per-process) setting. It is therefore safe to assume that ARMv7+
324 // Linux targets support unaligned accesses. The same goes for NaCl.
325 //
326 // The above behavior is consistent with GCC.
Joerg Sonnenberger4455ffc2014-02-02 21:18:36 +0000327 AllowsUnalignedMem =
328 (hasV7Ops() && (isTargetLinux() || isTargetNaCl() ||
329 isTargetNetBSD())) ||
330 (hasV6Ops() && (isTargetMachO() || isTargetNetBSD()));
Jim Grosbach4a1a9ce2014-04-02 19:28:13 +0000331 // The one exception is cortex-m0, which despite being v6, does not
332 // support unaligned accesses. Rather than make the above boolean
333 // expression even more obtuse, just override the value here.
334 if (isThumb1Only() && isMClass())
335 AllowsUnalignedMem = false;
JF Bastien97b08c402013-05-17 23:49:01 +0000336 break;
337 case StrictAlign:
338 AllowsUnalignedMem = false;
339 break;
340 case NoStrictAlign:
341 AllowsUnalignedMem = true;
342 break;
343 }
Renato Golinb4dd6c52013-03-21 18:47:47 +0000344
Weiming Zhao0da5cc02013-11-13 18:29:49 +0000345 switch (IT) {
346 case DefaultIT:
347 RestrictIT = hasV8Ops() ? true : false;
348 break;
349 case RestrictedIT:
350 RestrictIT = true;
351 break;
352 case NoRestrictedIT:
353 RestrictIT = false;
354 break;
355 }
356
Renato Golinb4dd6c52013-03-21 18:47:47 +0000357 // NEON f32 ops are non-IEEE 754 compliant. Darwin is ok with it by default.
358 uint64_t Bits = getFeatureBits();
359 if ((Bits & ARM::ProcA5 || Bits & ARM::ProcA8) && // Where this matters
360 (Options.UnsafeFPMath || isTargetDarwin()))
361 UseNEONForSinglePrecisionFP = true;
Evan Cheng10043e22007-01-19 07:51:42 +0000362}
Evan Cheng43b9ca62009-08-28 23:18:09 +0000363
364/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.
Evan Cheng1b389522009-09-03 07:04:02 +0000365bool
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000366ARMSubtarget::GVIsIndirectSymbol(const GlobalValue *GV,
367 Reloc::Model RelocM) const {
Evan Cheng1b389522009-09-03 07:04:02 +0000368 if (RelocM == Reloc::Static)
Evan Cheng43b9ca62009-08-28 23:18:09 +0000369 return false;
Evan Cheng1b389522009-09-03 07:04:02 +0000370
Jeffrey Yasskin091217b2010-01-27 20:34:15 +0000371 // Materializable GVs (in JIT lazy compilation mode) do not require an extra
372 // load from stub.
Evan Cheng2ce66302011-02-22 06:58:34 +0000373 bool isDecl = GV->hasAvailableExternallyLinkage();
374 if (GV->isDeclaration() && !GV->isMaterializable())
375 isDecl = true;
Evan Cheng1b389522009-09-03 07:04:02 +0000376
Tim Northoverd6a729b2014-01-06 14:28:05 +0000377 if (!isTargetMachO()) {
Evan Cheng1b389522009-09-03 07:04:02 +0000378 // Extra load is needed for all externally visible.
379 if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
380 return false;
381 return true;
382 } else {
383 if (RelocM == Reloc::PIC_) {
384 // If this is a strong reference to a definition, it is definitely not
385 // through a stub.
386 if (!isDecl && !GV->isWeakForLinker())
387 return false;
388
389 // Unless we have a symbol with hidden visibility, we have to go through a
390 // normal $non_lazy_ptr stub because this symbol might be resolved late.
391 if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
392 return true;
393
394 // If symbol visibility is hidden, we have a stub for common symbol
395 // references and external declarations.
396 if (isDecl || GV->hasCommonLinkage())
397 // Hidden $non_lazy_ptr reference.
398 return true;
399
400 return false;
401 } else {
402 // If this is a strong reference to a definition, it is definitely not
403 // through a stub.
404 if (!isDecl && !GV->isWeakForLinker())
405 return false;
Andrew Trickc416ba62010-12-24 04:28:06 +0000406
Evan Cheng1b389522009-09-03 07:04:02 +0000407 // Unless we have a symbol with hidden visibility, we have to go through a
408 // normal $non_lazy_ptr stub because this symbol might be resolved late.
409 if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
410 return true;
411 }
412 }
413
414 return false;
Evan Cheng43b9ca62009-08-28 23:18:09 +0000415}
David Goodwin0d412c22009-11-10 00:48:55 +0000416
Owen Andersona3181e22010-09-28 21:57:50 +0000417unsigned ARMSubtarget::getMispredictionPenalty() const {
Andrew Trick352abc12012-08-08 02:44:16 +0000418 return SchedModel->MispredictPenalty;
Owen Andersona3181e22010-09-28 21:57:50 +0000419}
420
Bob Wilsone7dde0c2013-11-03 06:14:38 +0000421bool ARMSubtarget::hasSinCos() const {
422 return getTargetTriple().getOS() == Triple::IOS &&
423 !getTargetTriple().isOSVersionLT(7, 0);
424}
425
Sanjay Patela2f658d2014-07-15 22:39:58 +0000426// This overrides the PostRAScheduler bit in the SchedModel for any CPU.
Andrew Trick8d2ee372014-06-04 07:06:27 +0000427bool ARMSubtarget::enablePostMachineScheduler() const {
Sanjay Patela2f658d2014-07-15 22:39:58 +0000428 return (!isThumb() || hasThumb2());
Andrew Trick8d2ee372014-06-04 07:06:27 +0000429}
430
Eric Christopherc40e5ed2014-06-19 21:03:04 +0000431bool ARMSubtarget::enableAtomicExpandLoadLinked() const {
432 return hasAnyDataBarrier() && !isThumb1Only();
433}
434
Eric Christopherc1058df2014-07-04 01:55:26 +0000435bool ARMSubtarget::useMovt(const MachineFunction &MF) const {
436 // NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit
437 // immediates as it is inherently position independent, and may be out of
438 // range otherwise.
439 return UseMovt && (isTargetWindows() ||
440 !MF.getFunction()->getAttributes().hasAttribute(
441 AttributeSet::FunctionIndex, Attribute::MinSize));
442}