blob: 2ce083ca2b624af1311a7263ca507245a6fdb950 [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 Christopher80b24ef2014-06-26 19:30:02 +000018#include "ARMSelectionDAGInfo.h"
19#include "ARMSubtarget.h"
Chris Bieneman03695ab2014-07-15 17:18:41 +000020#include "ARMMachineFunctionInfo.h"
Eric Christopher80b24ef2014-06-26 19:30:02 +000021#include "Thumb1FrameLowering.h"
22#include "Thumb1InstrInfo.h"
23#include "Thumb2InstrInfo.h"
Bill Wendling5a92eec2013-02-15 22:41:25 +000024#include "llvm/IR/Attributes.h"
Bill Wendling5a92eec2013-02-15 22:41:25 +000025#include "llvm/IR/Function.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000026#include "llvm/IR/GlobalValue.h"
Bob Wilson45825302009-06-22 21:01:46 +000027#include "llvm/Support/CommandLine.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000028#include "llvm/Target/TargetInstrInfo.h"
Renato Golinb4dd6c52013-03-21 18:47:47 +000029#include "llvm/Target/TargetOptions.h"
Chris Bieneman03695ab2014-07-15 17:18:41 +000030#include "llvm/Target/TargetRegisterInfo.h"
31#include "llvm/CodeGen/MachineRegisterInfo.h"
Evan Cheng54b68e32011-07-01 20:45:01 +000032
Chandler Carruthd174b722014-04-22 02:03:14 +000033using namespace llvm;
34
Chandler Carruthe96dd892014-04-21 22:55:11 +000035#define DEBUG_TYPE "arm-subtarget"
36
Evan Cheng54b68e32011-07-01 20:45:01 +000037#define GET_SUBTARGETINFO_TARGET_DESC
Evan Cheng4d1ca962011-07-08 01:53:10 +000038#define GET_SUBTARGETINFO_CTOR
Evan Chengc9c090d2011-07-01 22:36:09 +000039#include "ARMGenSubtargetInfo.inc"
Evan Cheng54b68e32011-07-01 20:45:01 +000040
Bob Wilson45825302009-06-22 21:01:46 +000041static cl::opt<bool>
42ReserveR9("arm-reserve-r9", cl::Hidden,
43 cl::desc("Reserve R9, making it unavailable as GPR"));
44
Anton Korobeynikov25229082009-11-24 00:44:37 +000045static cl::opt<bool>
Renato Golinca570632013-08-15 20:54:38 +000046ArmUseMOVT("arm-use-movt", cl::init(true), cl::Hidden);
Anton Korobeynikov25229082009-11-24 00:44:37 +000047
Bob Wilson3dc97322010-09-28 04:09:35 +000048static cl::opt<bool>
Bob Wilsone8a549c2012-09-29 21:43:49 +000049UseFusedMulOps("arm-use-mulops",
50 cl::init(true), cl::Hidden);
51
JF Bastien97b08c402013-05-17 23:49:01 +000052enum AlignMode {
53 DefaultAlign,
54 StrictAlign,
55 NoStrictAlign
56};
57
58static cl::opt<AlignMode>
59Align(cl::desc("Load/store alignment support"),
60 cl::Hidden, cl::init(DefaultAlign),
61 cl::values(
62 clEnumValN(DefaultAlign, "arm-default-align",
63 "Generate unaligned accesses only on hardware/OS "
64 "combinations that are known to support them"),
65 clEnumValN(StrictAlign, "arm-strict-align",
66 "Disallow all unaligned memory accesses"),
67 clEnumValN(NoStrictAlign, "arm-no-strict-align",
68 "Allow unaligned memory accesses"),
69 clEnumValEnd));
Bob Wilson3dc97322010-09-28 04:09:35 +000070
Weiming Zhao0da5cc02013-11-13 18:29:49 +000071enum ITMode {
72 DefaultIT,
73 RestrictedIT,
74 NoRestrictedIT
75};
76
77static cl::opt<ITMode>
78IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT),
79 cl::ZeroOrMore,
80 cl::values(clEnumValN(DefaultIT, "arm-default-it",
81 "Generate IT block based on arch"),
82 clEnumValN(RestrictedIT, "arm-restrict-it",
83 "Disallow deprecated IT based on ARMv8"),
84 clEnumValN(NoRestrictedIT, "arm-no-restrict-it",
85 "Allow IT blocks based on ARMv7"),
86 clEnumValEnd));
87
Eric Christophera47f6802014-06-13 00:20:35 +000088static std::string computeDataLayout(ARMSubtarget &ST) {
89 std::string Ret = "";
90
91 if (ST.isLittle())
92 // Little endian.
93 Ret += "e";
94 else
95 // Big endian.
96 Ret += "E";
97
98 Ret += DataLayout::getManglingComponent(ST.getTargetTriple());
99
100 // Pointers are 32 bits and aligned to 32 bits.
101 Ret += "-p:32:32";
102
103 // On thumb, i16,i18 and i1 have natural aligment requirements, but we try to
104 // align to 32.
105 if (ST.isThumb())
106 Ret += "-i1:8:32-i8:8:32-i16:16:32";
107
108 // ABIs other than APCS have 64 bit integers with natural alignment.
109 if (!ST.isAPCS_ABI())
110 Ret += "-i64:64";
111
112 // We have 64 bits floats. The APCS ABI requires them to be aligned to 32
113 // bits, others to 64 bits. We always try to align to 64 bits.
114 if (ST.isAPCS_ABI())
115 Ret += "-f64:32:64";
116
117 // We have 128 and 64 bit vectors. The APCS ABI aligns them to 32 bits, others
118 // to 64. We always ty to give them natural alignment.
119 if (ST.isAPCS_ABI())
120 Ret += "-v64:32:64-v128:32:128";
121 else
122 Ret += "-v128:64:128";
123
124 // On thumb and APCS, only try to align aggregates to 32 bits (the default is
125 // 64 bits).
126 if (ST.isThumb() || ST.isAPCS_ABI())
127 Ret += "-a:0:32";
128
129 // Integer registers are 32 bits.
130 Ret += "-n32";
131
132 // The stack is 128 bit aligned on NaCl, 64 bit aligned on AAPCS and 32 bit
133 // aligned everywhere else.
134 if (ST.isTargetNaCl())
135 Ret += "-S128";
136 else if (ST.isAAPCS_ABI())
137 Ret += "-S64";
138 else
139 Ret += "-S32";
140
141 return Ret;
142}
143
144/// initializeSubtargetDependencies - Initializes using a CPU and feature string
145/// so that we can use initializer lists for subtarget initialization.
146ARMSubtarget &ARMSubtarget::initializeSubtargetDependencies(StringRef CPU,
147 StringRef FS) {
148 initializeEnvironment();
149 resetSubtargetFeatures(CPU, FS);
150 return *this;
151}
152
Evan Chengfe6e4052011-06-30 01:53:36 +0000153ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &CPU,
Eric Christopher80b24ef2014-06-26 19:30:02 +0000154 const std::string &FS, TargetMachine &TM,
155 bool IsLittle, const TargetOptions &Options)
Eric Christophera47f6802014-06-13 00:20:35 +0000156 : ARMGenSubtargetInfo(TT, CPU, FS), ARMProcFamily(Others),
157 ARMProcClass(None), stackAlignment(4), CPUString(CPU), IsLittle(IsLittle),
158 TargetTriple(TT), Options(Options), TargetABI(ARM_ABI_UNKNOWN),
Eric Christopher030294e2014-06-13 00:20:39 +0000159 DL(computeDataLayout(initializeSubtargetDependencies(CPU, FS))),
Rafael Espindolaf8b27c42014-08-07 14:21:18 +0000160 TSInfo(DL),
Eric Christopher80b24ef2014-06-26 19:30:02 +0000161 InstrInfo(isThumb1Only()
162 ? (ARMBaseInstrInfo *)new Thumb1InstrInfo(*this)
163 : !isThumb()
164 ? (ARMBaseInstrInfo *)new ARMInstrInfo(*this)
165 : (ARMBaseInstrInfo *)new Thumb2InstrInfo(*this)),
166 TLInfo(TM),
167 FrameLowering(!isThumb1Only()
168 ? new ARMFrameLowering(*this)
169 : (ARMFrameLowering *)new Thumb1FrameLowering(*this)) {}
Bill Wendling5a92eec2013-02-15 22:41:25 +0000170
Bill Wendling61375d82013-02-16 01:36:26 +0000171void ARMSubtarget::initializeEnvironment() {
172 HasV4TOps = false;
173 HasV5TOps = false;
174 HasV5TEOps = false;
175 HasV6Ops = false;
Amara Emerson5035ee02013-10-07 16:55:23 +0000176 HasV6MOps = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000177 HasV6T2Ops = false;
178 HasV7Ops = false;
Joey Goulyb3f550e2013-06-26 16:58:26 +0000179 HasV8Ops = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000180 HasVFPv2 = false;
181 HasVFPv3 = false;
182 HasVFPv4 = false;
Joey Goulyccd04892013-09-13 13:46:57 +0000183 HasFPARMv8 = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000184 HasNEON = false;
185 UseNEONForSinglePrecisionFP = false;
186 UseMulOps = UseFusedMulOps;
187 SlowFPVMLx = false;
188 HasVMLxForwarding = false;
189 SlowFPBrcc = false;
190 InThumbMode = false;
191 HasThumb2 = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000192 NoARM = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000193 IsR9Reserved = ReserveR9;
194 UseMovt = false;
195 SupportsTailCall = false;
196 HasFP16 = false;
197 HasD16 = false;
198 HasHardwareDivide = false;
199 HasHardwareDivideInARM = false;
200 HasT2ExtractPack = false;
201 HasDataBarrier = false;
202 Pref32BitThumb = false;
203 AvoidCPSRPartialUpdate = false;
204 AvoidMOVsShifterOperand = false;
205 HasRAS = false;
206 HasMPExtension = false;
Bradley Smith25219752013-11-01 13:27:35 +0000207 HasVirtualization = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000208 FPOnlySP = false;
Tim Northovercedd4812013-05-23 19:11:14 +0000209 HasPerfMon = false;
Tim Northoverc6047652013-04-10 12:08:35 +0000210 HasTrustZone = false;
Amara Emerson33089092013-09-19 11:59:01 +0000211 HasCrypto = false;
Amara Emersonf9a67fc2013-10-29 16:54:52 +0000212 HasCRC = false;
Tim Northover13510302014-04-01 13:22:02 +0000213 HasZeroCycleZeroing = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000214 AllowsUnalignedMem = false;
215 Thumb2DSP = false;
216 UseNaClTrap = false;
Renato Golinb4dd6c52013-03-21 18:47:47 +0000217 UnsafeFPMath = false;
Bill Wendling61375d82013-02-16 01:36:26 +0000218}
219
Bill Wendling5a92eec2013-02-15 22:41:25 +0000220void ARMSubtarget::resetSubtargetFeatures(const MachineFunction *MF) {
221 AttributeSet FnAttrs = MF->getFunction()->getAttributes();
222 Attribute CPUAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,
223 "target-cpu");
224 Attribute FSAttr = FnAttrs.getAttribute(AttributeSet::FunctionIndex,
225 "target-features");
226 std::string CPU =
227 !CPUAttr.hasAttribute(Attribute::None) ?CPUAttr.getValueAsString() : "";
228 std::string FS =
229 !FSAttr.hasAttribute(Attribute::None) ? FSAttr.getValueAsString() : "";
Bill Wendling61375d82013-02-16 01:36:26 +0000230 if (!FS.empty()) {
231 initializeEnvironment();
Bill Wendling5a92eec2013-02-15 22:41:25 +0000232 resetSubtargetFeatures(CPU, FS);
Bill Wendling61375d82013-02-16 01:36:26 +0000233 }
Bill Wendling5a92eec2013-02-15 22:41:25 +0000234}
235
236void ARMSubtarget::resetSubtargetFeatures(StringRef CPU, StringRef FS) {
Tilmann Scheller63872ce2013-09-02 17:09:01 +0000237 if (CPUString.empty()) {
238 if (isTargetIOS() && TargetTriple.getArchName().endswith("v7s"))
239 // Default to the Swift CPU when targeting armv7s/thumbv7s.
240 CPUString = "swift";
241 else
242 CPUString = "generic";
243 }
Evan Chengec415ef2009-03-08 04:02:49 +0000244
Evan Cheng0b33a322011-06-30 02:12:44 +0000245 // Insert the architecture feature derived from the target triple into the
246 // feature string. This is important for setting features that are implied
247 // based on the architecture version.
Bill Wendling5a92eec2013-02-15 22:41:25 +0000248 std::string ArchFS = ARM_MC::ParseARMTriple(TargetTriple.getTriple(),
249 CPUString);
Evan Cheng2bd65362011-07-07 00:08:19 +0000250 if (!FS.empty()) {
251 if (!ArchFS.empty())
Bill Wendling5a92eec2013-02-15 22:41:25 +0000252 ArchFS = ArchFS + "," + FS.str();
Evan Cheng2bd65362011-07-07 00:08:19 +0000253 else
254 ArchFS = FS;
255 }
Evan Cheng1a72add62011-07-07 07:07:08 +0000256 ParseSubtargetFeatures(CPUString, ArchFS);
Evan Cheng2bd65362011-07-07 00:08:19 +0000257
Joerg Sonnenberger002a1472013-12-13 11:16:00 +0000258 // FIXME: This used enable V6T2 support implicitly for Thumb2 mode.
259 // Assert this for now to make the change obvious.
260 assert(hasV6T2Ops() || !hasThumb2());
Bob Wilsond0046ca2010-11-09 22:50:47 +0000261
Andrew Trick352abc12012-08-08 02:44:16 +0000262 // Keep a pointer to static instruction cost data for the specified CPU.
263 SchedModel = getSchedModelForCPU(CPUString);
264
Evan Cheng54b68e32011-07-01 20:45:01 +0000265 // Initialize scheduling itinerary for the specified CPU.
266 InstrItins = getInstrItineraryForCPU(CPUString);
267
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000268 if (TargetABI == ARM_ABI_UNKNOWN) {
269 switch (TargetTriple.getEnvironment()) {
270 case Triple::Android:
271 case Triple::EABI:
272 case Triple::EABIHF:
273 case Triple::GNUEABI:
274 case Triple::GNUEABIHF:
Joerg Sonnenberger74669792013-12-15 00:12:52 +0000275 TargetABI = ARM_ABI_AAPCS;
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000276 break;
277 default:
Saleem Abdulrasool35476332014-03-06 20:47:11 +0000278 if ((isTargetIOS() && isMClass()) ||
279 (TargetTriple.isOSBinFormatMachO() &&
280 TargetTriple.getOS() == Triple::UnknownOS))
Rafael Espindolad89b16d2014-01-02 13:40:08 +0000281 TargetABI = ARM_ABI_AAPCS;
282 else
283 TargetABI = ARM_ABI_APCS;
284 break;
285 }
Joerg Sonnenberger74669792013-12-15 00:12:52 +0000286 }
Evan Cheng1a72add62011-07-07 07:07:08 +0000287
Saleem Abdulrasoolcd130822014-04-02 20:32:05 +0000288 // FIXME: this is invalid for WindowsCE
289 if (isTargetWindows()) {
290 TargetABI = ARM_ABI_AAPCS;
291 NoARM = true;
292 }
293
Lauro Ramos Venancio048e16ff2007-02-13 19:52:28 +0000294 if (isAAPCS_ABI())
295 stackAlignment = 8;
Mark Seabornbe266aa2014-02-16 18:59:48 +0000296 if (isTargetNaCl())
297 stackAlignment = 16;
Lauro Ramos Venancio048e16ff2007-02-13 19:52:28 +0000298
Renato Golinca570632013-08-15 20:54:38 +0000299 UseMovt = hasV6T2Ops() && ArmUseMOVT;
300
Tim Northoverd6a729b2014-01-06 14:28:05 +0000301 if (isTargetMachO()) {
Evan Cheng8b2bda02011-07-07 03:55:05 +0000302 IsR9Reserved = ReserveR9 | !HasV6Ops;
Tim Northoverd6a729b2014-01-06 14:28:05 +0000303 SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0);
Saleem Abdulrasoolec1ec1b2014-03-11 15:09:44 +0000304 } else {
Tim Northoverd6a729b2014-01-06 14:28:05 +0000305 IsR9Reserved = ReserveR9;
Saleem Abdulrasoolec1ec1b2014-03-11 15:09:44 +0000306 SupportsTailCall = !isThumb1Only();
307 }
David Goodwin9a051a52009-10-01 21:46:35 +0000308
JF Bastien97b08c402013-05-17 23:49:01 +0000309 switch (Align) {
310 case DefaultAlign:
311 // Assume pre-ARMv6 doesn't support unaligned accesses.
312 //
313 // ARMv6 may or may not support unaligned accesses depending on the
314 // SCTLR.U bit, which is architecture-specific. We assume ARMv6
Jim Grosbach4a1a9ce2014-04-02 19:28:13 +0000315 // Darwin and NetBSD targets support unaligned accesses, and others don't.
JF Bastien97b08c402013-05-17 23:49:01 +0000316 //
317 // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit
318 // which raises an alignment fault on unaligned accesses. Linux
319 // defaults this bit to 0 and handles it as a system-wide (not
320 // per-process) setting. It is therefore safe to assume that ARMv7+
321 // Linux targets support unaligned accesses. The same goes for NaCl.
322 //
323 // The above behavior is consistent with GCC.
Joerg Sonnenberger4455ffc2014-02-02 21:18:36 +0000324 AllowsUnalignedMem =
325 (hasV7Ops() && (isTargetLinux() || isTargetNaCl() ||
326 isTargetNetBSD())) ||
327 (hasV6Ops() && (isTargetMachO() || isTargetNetBSD()));
Jim Grosbach4a1a9ce2014-04-02 19:28:13 +0000328 // The one exception is cortex-m0, which despite being v6, does not
329 // support unaligned accesses. Rather than make the above boolean
330 // expression even more obtuse, just override the value here.
331 if (isThumb1Only() && isMClass())
332 AllowsUnalignedMem = false;
JF Bastien97b08c402013-05-17 23:49:01 +0000333 break;
334 case StrictAlign:
335 AllowsUnalignedMem = false;
336 break;
337 case NoStrictAlign:
338 AllowsUnalignedMem = true;
339 break;
340 }
Renato Golinb4dd6c52013-03-21 18:47:47 +0000341
Weiming Zhao0da5cc02013-11-13 18:29:49 +0000342 switch (IT) {
343 case DefaultIT:
344 RestrictIT = hasV8Ops() ? true : false;
345 break;
346 case RestrictedIT:
347 RestrictIT = true;
348 break;
349 case NoRestrictedIT:
350 RestrictIT = false;
351 break;
352 }
353
Renato Golinb4dd6c52013-03-21 18:47:47 +0000354 // NEON f32 ops are non-IEEE 754 compliant. Darwin is ok with it by default.
355 uint64_t Bits = getFeatureBits();
356 if ((Bits & ARM::ProcA5 || Bits & ARM::ProcA8) && // Where this matters
357 (Options.UnsafeFPMath || isTargetDarwin()))
358 UseNEONForSinglePrecisionFP = true;
Evan Cheng10043e22007-01-19 07:51:42 +0000359}
Evan Cheng43b9ca62009-08-28 23:18:09 +0000360
361/// GVIsIndirectSymbol - true if the GV will be accessed via an indirect symbol.
Evan Cheng1b389522009-09-03 07:04:02 +0000362bool
Dan Gohmanbcaf6812010-04-15 01:51:59 +0000363ARMSubtarget::GVIsIndirectSymbol(const GlobalValue *GV,
364 Reloc::Model RelocM) const {
Evan Cheng1b389522009-09-03 07:04:02 +0000365 if (RelocM == Reloc::Static)
Evan Cheng43b9ca62009-08-28 23:18:09 +0000366 return false;
Evan Cheng1b389522009-09-03 07:04:02 +0000367
Jeffrey Yasskin091217b2010-01-27 20:34:15 +0000368 // Materializable GVs (in JIT lazy compilation mode) do not require an extra
369 // load from stub.
Evan Cheng2ce66302011-02-22 06:58:34 +0000370 bool isDecl = GV->hasAvailableExternallyLinkage();
371 if (GV->isDeclaration() && !GV->isMaterializable())
372 isDecl = true;
Evan Cheng1b389522009-09-03 07:04:02 +0000373
Tim Northoverd6a729b2014-01-06 14:28:05 +0000374 if (!isTargetMachO()) {
Evan Cheng1b389522009-09-03 07:04:02 +0000375 // Extra load is needed for all externally visible.
376 if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
377 return false;
378 return true;
379 } else {
380 if (RelocM == Reloc::PIC_) {
381 // If this is a strong reference to a definition, it is definitely not
382 // through a stub.
383 if (!isDecl && !GV->isWeakForLinker())
384 return false;
385
386 // Unless we have a symbol with hidden visibility, we have to go through a
387 // normal $non_lazy_ptr stub because this symbol might be resolved late.
388 if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
389 return true;
390
391 // If symbol visibility is hidden, we have a stub for common symbol
392 // references and external declarations.
393 if (isDecl || GV->hasCommonLinkage())
394 // Hidden $non_lazy_ptr reference.
395 return true;
396
397 return false;
398 } else {
399 // If this is a strong reference to a definition, it is definitely not
400 // through a stub.
401 if (!isDecl && !GV->isWeakForLinker())
402 return false;
Andrew Trickc416ba62010-12-24 04:28:06 +0000403
Evan Cheng1b389522009-09-03 07:04:02 +0000404 // Unless we have a symbol with hidden visibility, we have to go through a
405 // normal $non_lazy_ptr stub because this symbol might be resolved late.
406 if (!GV->hasHiddenVisibility()) // Non-hidden $non_lazy_ptr reference.
407 return true;
408 }
409 }
410
411 return false;
Evan Cheng43b9ca62009-08-28 23:18:09 +0000412}
David Goodwin0d412c22009-11-10 00:48:55 +0000413
Owen Andersona3181e22010-09-28 21:57:50 +0000414unsigned ARMSubtarget::getMispredictionPenalty() const {
Andrew Trick352abc12012-08-08 02:44:16 +0000415 return SchedModel->MispredictPenalty;
Owen Andersona3181e22010-09-28 21:57:50 +0000416}
417
Bob Wilsone7dde0c2013-11-03 06:14:38 +0000418bool ARMSubtarget::hasSinCos() const {
419 return getTargetTriple().getOS() == Triple::IOS &&
420 !getTargetTriple().isOSVersionLT(7, 0);
421}
422
Sanjay Patela2f658d2014-07-15 22:39:58 +0000423// This overrides the PostRAScheduler bit in the SchedModel for any CPU.
Andrew Trick8d2ee372014-06-04 07:06:27 +0000424bool ARMSubtarget::enablePostMachineScheduler() const {
Sanjay Patela2f658d2014-07-15 22:39:58 +0000425 return (!isThumb() || hasThumb2());
Andrew Trick8d2ee372014-06-04 07:06:27 +0000426}
427
Eric Christopherc40e5ed2014-06-19 21:03:04 +0000428bool ARMSubtarget::enableAtomicExpandLoadLinked() const {
429 return hasAnyDataBarrier() && !isThumb1Only();
430}
431
Eric Christopherc1058df2014-07-04 01:55:26 +0000432bool ARMSubtarget::useMovt(const MachineFunction &MF) const {
433 // NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit
434 // immediates as it is inherently position independent, and may be out of
435 // range otherwise.
436 return UseMovt && (isTargetWindows() ||
437 !MF.getFunction()->getAttributes().hasAttribute(
438 AttributeSet::FunctionIndex, Attribute::MinSize));
439}