OLD | NEW |
1 //===-- ARMSubtarget.cpp - ARM Subtarget Information ----------------------===// | 1 //===-- ARMSubtarget.cpp - ARM Subtarget Information ----------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the ARM specific subclass of TargetSubtargetInfo. | 10 // This file implements the ARM specific subclass of TargetSubtargetInfo. |
(...skipping 27 matching lines...) Expand all Loading... |
38 #define GET_SUBTARGETINFO_CTOR | 38 #define GET_SUBTARGETINFO_CTOR |
39 #include "ARMGenSubtargetInfo.inc" | 39 #include "ARMGenSubtargetInfo.inc" |
40 | 40 |
41 static cl::opt<bool> | 41 static cl::opt<bool> |
42 ReserveR9("arm-reserve-r9", cl::Hidden, | 42 ReserveR9("arm-reserve-r9", cl::Hidden, |
43 cl::desc("Reserve R9, making it unavailable as GPR")); | 43 cl::desc("Reserve R9, making it unavailable as GPR")); |
44 | 44 |
45 static cl::opt<bool> | 45 static cl::opt<bool> |
46 ArmUseMOVT("arm-use-movt", cl::init(true), cl::Hidden); | 46 ArmUseMOVT("arm-use-movt", cl::init(true), cl::Hidden); |
47 | 47 |
| 48 // @LOCALMOD-START |
| 49 // TODO: * JITing has not been tested at all |
| 50 // * Thumb mode operation is also not clear: it seems jump tables |
| 51 // for thumb are broken independent of this option |
| 52 static cl::opt<bool> |
| 53 NoInlineJumpTables("no-inline-jumptables", |
| 54 cl::desc("Do not place jump tables inline in the code")); |
| 55 // @LOCALMOD-END |
| 56 |
48 static cl::opt<bool> | 57 static cl::opt<bool> |
49 UseFusedMulOps("arm-use-mulops", | 58 UseFusedMulOps("arm-use-mulops", |
50 cl::init(true), cl::Hidden); | 59 cl::init(true), cl::Hidden); |
51 | 60 |
52 namespace { | 61 namespace { |
53 enum AlignMode { | 62 enum AlignMode { |
54 DefaultAlign, | 63 DefaultAlign, |
55 StrictAlign, | 64 StrictAlign, |
56 NoStrictAlign | 65 NoStrictAlign |
57 }; | 66 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 HasV6MOps = false; | 181 HasV6MOps = false; |
173 HasV6T2Ops = false; | 182 HasV6T2Ops = false; |
174 HasV7Ops = false; | 183 HasV7Ops = false; |
175 HasV8Ops = false; | 184 HasV8Ops = false; |
176 HasVFPv2 = false; | 185 HasVFPv2 = false; |
177 HasVFPv3 = false; | 186 HasVFPv3 = false; |
178 HasVFPv4 = false; | 187 HasVFPv4 = false; |
179 HasFPARMv8 = false; | 188 HasFPARMv8 = false; |
180 HasNEON = false; | 189 HasNEON = false; |
181 UseNEONForSinglePrecisionFP = false; | 190 UseNEONForSinglePrecisionFP = false; |
| 191 // @LOCALMOD-START |
| 192 UseInlineJumpTables = !NoInlineJumpTables; |
| 193 UseConstIslands = true; |
| 194 // @LOCALMOD-END |
182 UseMulOps = UseFusedMulOps; | 195 UseMulOps = UseFusedMulOps; |
183 SlowFPVMLx = false; | 196 SlowFPVMLx = false; |
184 HasVMLxForwarding = false; | 197 HasVMLxForwarding = false; |
185 SlowFPBrcc = false; | 198 SlowFPBrcc = false; |
186 InThumbMode = false; | 199 InThumbMode = false; |
187 HasThumb2 = false; | 200 HasThumb2 = false; |
188 NoARM = false; | 201 NoARM = false; |
189 IsR9Reserved = ReserveR9; | 202 IsR9Reserved = ReserveR9; |
190 UseMovt = false; | 203 UseMovt = false; |
191 SupportsTailCall = false; | 204 SupportsTailCall = false; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 UseMovt = hasV6T2Ops() && ArmUseMOVT; | 291 UseMovt = hasV6T2Ops() && ArmUseMOVT; |
279 | 292 |
280 if (isTargetMachO()) { | 293 if (isTargetMachO()) { |
281 IsR9Reserved = ReserveR9 || !HasV6Ops; | 294 IsR9Reserved = ReserveR9 || !HasV6Ops; |
282 SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0); | 295 SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0); |
283 } else { | 296 } else { |
284 IsR9Reserved = ReserveR9; | 297 IsR9Reserved = ReserveR9; |
285 SupportsTailCall = !isThumb1Only(); | 298 SupportsTailCall = !isThumb1Only(); |
286 } | 299 } |
287 | 300 |
| 301 // @LOCALMOD-BEGIN |
| 302 if (isTargetNaCl()) { |
| 303 // NaCl reserves R9 for TLS. |
| 304 IsR9Reserved = true; |
| 305 // NaCl uses MovT to avoid generating constant islands. |
| 306 UseMovt = true; |
| 307 UseInlineJumpTables = false; |
| 308 UseConstIslands = false; |
| 309 } |
| 310 // @LOCALMOD-END |
| 311 |
288 if (Align == DefaultAlign) { | 312 if (Align == DefaultAlign) { |
289 // Assume pre-ARMv6 doesn't support unaligned accesses. | 313 // Assume pre-ARMv6 doesn't support unaligned accesses. |
290 // | 314 // |
291 // ARMv6 may or may not support unaligned accesses depending on the | 315 // ARMv6 may or may not support unaligned accesses depending on the |
292 // SCTLR.U bit, which is architecture-specific. We assume ARMv6 | 316 // SCTLR.U bit, which is architecture-specific. We assume ARMv6 |
293 // Darwin and NetBSD targets support unaligned accesses, and others don't. | 317 // Darwin and NetBSD targets support unaligned accesses, and others don't. |
294 // | 318 // |
295 // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit | 319 // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit |
296 // which raises an alignment fault on unaligned accesses. Linux | 320 // which raises an alignment fault on unaligned accesses. Linux |
297 // defaults this bit to 0 and handles it as a system-wide (not | 321 // defaults this bit to 0 and handles it as a system-wide (not |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 421 } |
398 | 422 |
399 bool ARMSubtarget::useMovt(const MachineFunction &MF) const { | 423 bool ARMSubtarget::useMovt(const MachineFunction &MF) const { |
400 // NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit | 424 // NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit |
401 // immediates as it is inherently position independent, and may be out of | 425 // immediates as it is inherently position independent, and may be out of |
402 // range otherwise. | 426 // range otherwise. |
403 return UseMovt && (isTargetWindows() || | 427 return UseMovt && (isTargetWindows() || |
404 !MF.getFunction()->getAttributes().hasAttribute( | 428 !MF.getFunction()->getAttributes().hasAttribute( |
405 AttributeSet::FunctionIndex, Attribute::MinSize)); | 429 AttributeSet::FunctionIndex, Attribute::MinSize)); |
406 } | 430 } |
OLD | NEW |