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 TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARMSUBTARGET_H
15 #define ARMSUBTARGET_H
17 #include "llvm/Target/TargetSubtarget.h"
23 class ARMSubtarget
: public TargetSubtarget
{
29 /// ARMArchVersion - ARM architecture vecrsion: V4T (base), V5T, V5TE,
31 ARMArchEnum ARMArchVersion
;
33 /// HasVFP2 - True if the processor supports Vector Floating Point (VFP) V2
37 /// IsThumb - True if we are in thumb mode, false if in ARM mode.
40 /// UseThumbBacktraces - True if we use thumb style backtraces.
41 bool UseThumbBacktraces
;
43 /// IsR9Reserved - True if R9 is a not available as general purpose register.
46 /// stackAlignment - The minimum alignment known to hold of the stack frame on
47 /// entry to the function and which must be maintained by every function.
48 unsigned stackAlignment
;
57 ARM_ABI_AAPCS
// ARM EABI
60 /// This constructor initializes the data members to match that
61 /// of the specified module.
63 ARMSubtarget(const Module
&M
, const std::string
&FS
, bool thumb
);
65 /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
66 /// that still makes it profitable to inline the call.
67 unsigned getMaxInlineSizeThreshold() const {
68 // FIXME: For now, we don't lower memcpy's to loads / stores for Thumb.
69 // Change this once Thumb ldmia / stmia support is added.
70 return isThumb() ? 0 : 64;
72 /// ParseSubtargetFeatures - Parses features string setting specified
73 /// subtarget options. Definition of function is auto generated by tblgen.
74 void ParseSubtargetFeatures(const std::string
&FS
, const std::string
&CPU
);
76 bool hasV4TOps() const { return ARMArchVersion
>= V4T
; }
77 bool hasV5TOps() const { return ARMArchVersion
>= V5T
; }
78 bool hasV5TEOps() const { return ARMArchVersion
>= V5TE
; }
79 bool hasV6Ops() const { return ARMArchVersion
>= V6
; }
81 bool hasVFP2() const { return HasVFP2
; }
83 bool isTargetDarwin() const { return TargetType
== isDarwin
; }
84 bool isTargetELF() const { return TargetType
== isELF
; }
86 bool isAPCS_ABI() const { return TargetABI
== ARM_ABI_APCS
; }
87 bool isAAPCS_ABI() const { return TargetABI
== ARM_ABI_AAPCS
; }
89 bool isThumb() const { return IsThumb
; }
91 bool useThumbBacktraces() const { return UseThumbBacktraces
; }
92 bool isR9Reserved() const { return IsR9Reserved
; }
94 /// getStackAlignment - Returns the minimum alignment known to hold of the
95 /// stack frame on entry to the function and which must be maintained by every
96 /// function for this subtarget.
97 unsigned getStackAlignment() const { return stackAlignment
; }
99 } // End llvm namespace
101 #endif // ARMSUBTARGET_H