ARMBuildAttributes.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //===-- ARMBuildAttributes.h - ARM Build Attributes -------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file contains enumerations and support routines for ARM build attributes
  11. // as defined in ARM ABI addenda document (ABI release 2.08).
  12. //
  13. // ELF for the ARM Architecture r2.09 - November 30, 2012
  14. //
  15. // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
  19. #define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H
  20. namespace llvm {
  21. class StringRef;
  22. namespace ARMBuildAttrs {
  23. enum SpecialAttr {
  24. // This is for the .cpu asm attr. It translates into one or more
  25. // AttrType (below) entries in the .ARM.attributes section in the ELF.
  26. SEL_CPU
  27. };
  28. enum AttrType {
  29. // Rest correspond to ELF/.ARM.attributes
  30. File = 1,
  31. CPU_raw_name = 4,
  32. CPU_name = 5,
  33. CPU_arch = 6,
  34. CPU_arch_profile = 7,
  35. ARM_ISA_use = 8,
  36. THUMB_ISA_use = 9,
  37. FP_arch = 10,
  38. WMMX_arch = 11,
  39. Advanced_SIMD_arch = 12,
  40. PCS_config = 13,
  41. ABI_PCS_R9_use = 14,
  42. ABI_PCS_RW_data = 15,
  43. ABI_PCS_RO_data = 16,
  44. ABI_PCS_GOT_use = 17,
  45. ABI_PCS_wchar_t = 18,
  46. ABI_FP_rounding = 19,
  47. ABI_FP_denormal = 20,
  48. ABI_FP_exceptions = 21,
  49. ABI_FP_user_exceptions = 22,
  50. ABI_FP_number_model = 23,
  51. ABI_align_needed = 24,
  52. ABI_align_preserved = 25,
  53. ABI_enum_size = 26,
  54. ABI_HardFP_use = 27,
  55. ABI_VFP_args = 28,
  56. ABI_WMMX_args = 29,
  57. ABI_optimization_goals = 30,
  58. ABI_FP_optimization_goals = 31,
  59. compatibility = 32,
  60. CPU_unaligned_access = 34,
  61. FP_HP_extension = 36,
  62. ABI_FP_16bit_format = 38,
  63. MPextension_use = 42, // recoded from 70 (ABI r2.08)
  64. DIV_use = 44,
  65. also_compatible_with = 65,
  66. conformance = 67,
  67. Virtualization_use = 68,
  68. /// Legacy Tags
  69. Section = 2, // deprecated (ABI r2.09)
  70. Symbol = 3, // deprecated (ABI r2.09)
  71. ABI_align8_needed = 24, // renamed to ABI_align_needed (ABI r2.09)
  72. ABI_align8_preserved = 25, // renamed to ABI_align_preserved (ABI r2.09)
  73. nodefaults = 64, // deprecated (ABI r2.09)
  74. T2EE_use = 66, // deprecated (ABI r2.09)
  75. MPextension_use_old = 70 // recoded to MPextension_use (ABI r2.08)
  76. };
  77. StringRef AttrTypeAsString(unsigned Attr, bool HasTagPrefix = true);
  78. StringRef AttrTypeAsString(AttrType Attr, bool HasTagPrefix = true);
  79. int AttrTypeFromString(StringRef Tag);
  80. // Magic numbers for .ARM.attributes
  81. enum AttrMagic {
  82. Format_Version = 0x41
  83. };
  84. // Legal Values for CPU_arch, (=6), uleb128
  85. enum CPUArch {
  86. Pre_v4 = 0,
  87. v4 = 1, // e.g. SA110
  88. v4T = 2, // e.g. ARM7TDMI
  89. v5T = 3, // e.g. ARM9TDMI
  90. v5TE = 4, // e.g. ARM946E_S
  91. v5TEJ = 5, // e.g. ARM926EJ_S
  92. v6 = 6, // e.g. ARM1136J_S
  93. v6KZ = 7, // e.g. ARM1176JZ_S
  94. v6T2 = 8, // e.g. ARM1156T2_S
  95. v6K = 9, // e.g. ARM1176JZ_S
  96. v7 = 10, // e.g. Cortex A8, Cortex M3
  97. v6_M = 11, // e.g. Cortex M1
  98. v6S_M = 12, // v6_M with the System extensions
  99. v7E_M = 13, // v7_M with DSP extensions
  100. v8 = 14, // v8,v8.1a AArch32
  101. };
  102. enum CPUArchProfile { // (=7), uleb128
  103. Not_Applicable = 0, // pre v7, or cross-profile code
  104. ApplicationProfile = (0x41), // 'A' (e.g. for Cortex A8)
  105. RealTimeProfile = (0x52), // 'R' (e.g. for Cortex R4)
  106. MicroControllerProfile = (0x4D), // 'M' (e.g. for Cortex M3)
  107. SystemProfile = (0x53) // 'S' Application or real-time profile
  108. };
  109. // The following have a lot of common use cases
  110. enum {
  111. Not_Allowed = 0,
  112. Allowed = 1,
  113. // Tag_ARM_ISA_use (=8), uleb128
  114. // Tag_THUMB_ISA_use, (=9), uleb128
  115. AllowThumb32 = 2, // 32-bit Thumb (implies 16-bit instructions)
  116. // Tag_FP_arch (=10), uleb128 (formerly Tag_VFP_arch = 10)
  117. AllowFPv2 = 2, // v2 FP ISA permitted (implies use of the v1 FP ISA)
  118. AllowFPv3A = 3, // v3 FP ISA permitted (implies use of the v2 FP ISA)
  119. AllowFPv3B = 4, // v3 FP ISA permitted, but only D0-D15, S0-S31
  120. AllowFPv4A = 5, // v4 FP ISA permitted (implies use of v3 FP ISA)
  121. AllowFPv4B = 6, // v4 FP ISA was permitted, but only D0-D15, S0-S31
  122. AllowFPARMv8A = 7, // Use of the ARM v8-A FP ISA was permitted
  123. AllowFPARMv8B = 8, // Use of the ARM v8-A FP ISA was permitted, but only
  124. // D0-D15, S0-S31
  125. // Tag_WMMX_arch, (=11), uleb128
  126. AllowWMMXv1 = 1, // The user permitted this entity to use WMMX v1
  127. AllowWMMXv2 = 2, // The user permitted this entity to use WMMX v2
  128. // Tag_Advanced_SIMD_arch, (=12), uleb128
  129. AllowNeon = 1, // SIMDv1 was permitted
  130. AllowNeon2 = 2, // SIMDv2 was permitted (Half-precision FP, MAC operations)
  131. AllowNeonARMv8 = 3, // ARM v8-A SIMD was permitted
  132. AllowNeonARMv8_1a = 4,// ARM v8.1-A SIMD was permitted (RDMA)
  133. // Tag_ABI_PCS_R9_use, (=14), uleb128
  134. R9IsGPR = 0, // R9 used as v6 (just another callee-saved register)
  135. R9IsSB = 1, // R9 used as a global static base rgister
  136. R9IsTLSPointer = 2, // R9 used as a thread local storage pointer
  137. R9Reserved = 3, // R9 not used by code associated with attributed entity
  138. // Tag_ABI_PCS_RW_data, (=15), uleb128
  139. AddressRWPCRel = 1, // Address RW static data PC-relative
  140. AddressRWSBRel = 2, // Address RW static data SB-relative
  141. AddressRWNone = 3, // No RW static data permitted
  142. // Tag_ABI_PCS_RO_data, (=14), uleb128
  143. AddressROPCRel = 1, // Address RO static data PC-relative
  144. AddressRONone = 2, // No RO static data permitted
  145. // Tag_ABI_PCS_GOT_use, (=17), uleb128
  146. AddressDirect = 1, // Address imported data directly
  147. AddressGOT = 2, // Address imported data indirectly (via GOT)
  148. // Tag_ABI_PCS_wchar_t, (=18), uleb128
  149. WCharProhibited = 0, // wchar_t is not used
  150. WCharWidth2Bytes = 2, // sizeof(wchar_t) == 2
  151. WCharWidth4Bytes = 4, // sizeof(wchar_t) == 4
  152. // Tag_ABI_FP_denormal, (=20), uleb128
  153. PositiveZero = 0,
  154. IEEEDenormals = 1,
  155. PreserveFPSign = 2, // sign when flushed-to-zero is preserved
  156. // Tag_ABI_FP_number_model, (=23), uleb128
  157. AllowRTABI = 2, // numbers, infinities, and one quiet NaN (see [RTABI])
  158. AllowIEE754 = 3, // this code to use all the IEEE 754-defined FP encodings
  159. // Tag_ABI_enum_size, (=26), uleb128
  160. EnumProhibited = 0, // The user prohibited the use of enums when building
  161. // this entity.
  162. EnumSmallest = 1, // Enum is smallest container big enough to hold all
  163. // values.
  164. Enum32Bit = 2, // Enum is at least 32 bits.
  165. Enum32BitABI = 3, // Every enumeration visible across an ABI-complying
  166. // interface contains a value needing 32 bits to encode
  167. // it; other enums can be containerized.
  168. // Tag_ABI_HardFP_use, (=27), uleb128
  169. HardFPImplied = 0, // FP use should be implied by Tag_FP_arch
  170. HardFPSinglePrecision = 1, // Single-precision only
  171. // Tag_ABI_VFP_args, (=28), uleb128
  172. BaseAAPCS = 0,
  173. HardFPAAPCS = 1,
  174. // Tag_FP_HP_extension, (=36), uleb128
  175. AllowHPFP = 1, // Allow use of Half Precision FP
  176. // Tag_FP_16bit_format, (=38), uleb128
  177. FP16FormatIEEE = 1,
  178. // Tag_MPextension_use, (=42), uleb128
  179. AllowMP = 1, // Allow use of MP extensions
  180. // Tag_DIV_use, (=44), uleb128
  181. // Note: AllowDIVExt must be emitted if and only if the permission to use
  182. // hardware divide cannot be conveyed using AllowDIVIfExists or DisallowDIV
  183. AllowDIVIfExists = 0, // Allow hardware divide if available in arch, or no
  184. // info exists.
  185. DisallowDIV = 1, // Hardware divide explicitly disallowed.
  186. AllowDIVExt = 2, // Allow hardware divide as optional architecture
  187. // extension above the base arch specified by
  188. // Tag_CPU_arch and Tag_CPU_arch_profile.
  189. // Tag_Virtualization_use, (=68), uleb128
  190. AllowTZ = 1,
  191. AllowVirtualization = 2,
  192. AllowTZVirtualization = 3
  193. };
  194. } // namespace ARMBuildAttrs
  195. } // namespace llvm
  196. #endif