| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 1 | //=====---- ARMSubtarget.h - Define Subtarget for the ARM -----*- C++ -*--====// | 
|  | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
|  | 5 | // This file was developed by Evan Cheng and is distributed under the | 
|  | 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. | 
|  | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 | // | 
|  | 10 | // This file declares the ARM specific subclass of TargetSubtarget. | 
|  | 11 | // | 
|  | 12 | //===----------------------------------------------------------------------===// | 
|  | 13 |  | 
|  | 14 | #ifndef ARMSUBTARGET_H | 
|  | 15 | #define ARMSUBTARGET_H | 
|  | 16 |  | 
|  | 17 | #include "llvm/Target/TargetSubtarget.h" | 
|  | 18 | #include <string> | 
|  | 19 |  | 
|  | 20 | namespace llvm { | 
|  | 21 | class Module; | 
|  | 22 |  | 
|  | 23 | class ARMSubtarget : public TargetSubtarget { | 
|  | 24 | protected: | 
|  | 25 | enum ARMArchEnum { | 
|  | 26 | V4T, V5T, V5TE, V6 | 
|  | 27 | }; | 
|  | 28 |  | 
|  | 29 | /// ARMArchVersion - ARM architecture vecrsion: V4T (base), V5T, V5TE, | 
|  | 30 | /// and V6. | 
|  | 31 | ARMArchEnum ARMArchVersion; | 
|  | 32 |  | 
|  | 33 | /// HasVFP2 - True if the processor supports Vector Floating Point (VFP) V2 | 
|  | 34 | /// instructions. | 
|  | 35 | bool HasVFP2; | 
|  | 36 |  | 
|  | 37 | /// IsThumb - True if we are in thumb mode, false if in ARM mode. | 
|  | 38 | bool IsThumb; | 
|  | 39 |  | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 40 | /// UseThumbBacktraces - True if we use thumb style backtraces. | 
|  | 41 | bool UseThumbBacktraces; | 
|  | 42 |  | 
|  | 43 | /// IsR9Reserved - True if R9 is a not available as general purpose register. | 
|  | 44 | bool IsR9Reserved; | 
| Lauro Ramos Venancio | 3630e78 | 2007-02-13 19:52:28 +0000 | [diff] [blame] | 45 |  | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 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; | 
|  | 49 |  | 
|  | 50 | public: | 
| Evan Cheng | 1a3771e | 2007-01-19 19:22:40 +0000 | [diff] [blame] | 51 | enum { | 
|  | 52 | isELF, isDarwin | 
|  | 53 | } TargetType; | 
|  | 54 |  | 
| Lauro Ramos Venancio | 3630e78 | 2007-02-13 19:52:28 +0000 | [diff] [blame] | 55 | enum { | 
|  | 56 | ARM_ABI_APCS, | 
|  | 57 | ARM_ABI_AAPCS // ARM EABI | 
|  | 58 | } TargetABI; | 
|  | 59 |  | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 60 | /// This constructor initializes the data members to match that | 
|  | 61 | /// of the specified module. | 
|  | 62 | /// | 
| Evan Cheng | 04321f7 | 2007-02-23 03:14:31 +0000 | [diff] [blame] | 63 | ARMSubtarget(const Module &M, const std::string &FS, bool thumb); | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 64 |  | 
| Rafael Espindola | fc05f40 | 2007-10-31 11:52:06 +0000 | [diff] [blame^] | 65 | unsigned getMaxInlineSizeThreshold() const { return 64; } | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 66 | /// ParseSubtargetFeatures - Parses features string setting specified | 
|  | 67 | /// subtarget options.  Definition of function is auto generated by tblgen. | 
|  | 68 | void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); | 
|  | 69 |  | 
|  | 70 | bool hasV4TOps()  const { return ARMArchVersion >= V4T; } | 
|  | 71 | bool hasV5TOps()  const { return ARMArchVersion >= V5T; } | 
|  | 72 | bool hasV5TEOps() const { return ARMArchVersion >= V5TE; } | 
|  | 73 | bool hasV6Ops()   const { return ARMArchVersion >= V6; } | 
|  | 74 |  | 
|  | 75 | bool hasVFP2() const { return HasVFP2; } | 
|  | 76 |  | 
| Evan Cheng | 1a3771e | 2007-01-19 19:22:40 +0000 | [diff] [blame] | 77 | bool isTargetDarwin() const { return TargetType == isDarwin; } | 
|  | 78 | bool isTargetELF() const { return TargetType == isELF; } | 
|  | 79 |  | 
| Lauro Ramos Venancio | 3630e78 | 2007-02-13 19:52:28 +0000 | [diff] [blame] | 80 | bool isAPCS_ABI() const { return TargetABI == ARM_ABI_APCS; } | 
|  | 81 | bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; } | 
|  | 82 |  | 
| Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 83 | bool isThumb() const { return IsThumb; } | 
|  | 84 |  | 
|  | 85 | bool useThumbBacktraces() const { return UseThumbBacktraces; } | 
|  | 86 | bool isR9Reserved() const { return IsR9Reserved; } | 
|  | 87 |  | 
|  | 88 | /// getStackAlignment - Returns the minimum alignment known to hold of the | 
|  | 89 | /// stack frame on entry to the function and which must be maintained by every | 
|  | 90 | /// function for this subtarget. | 
|  | 91 | unsigned getStackAlignment() const { return stackAlignment; } | 
|  | 92 | }; | 
|  | 93 | } // End llvm namespace | 
|  | 94 |  | 
|  | 95 | #endif  // ARMSUBTARGET_H |