You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

311 lines
9.8KB

  1. /* Definitions of target machine for GNU compiler, for ARM with a.out
  2. Copyright (C) 1995-2020 Free Software Foundation, Inc.
  3. Contributed by Richard Earnshaw (rearnsha@armltd.co.uk).
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published
  7. by the Free Software Foundation; either version 3, or (at your
  8. option) any later version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. License for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. #ifndef ASM_APP_ON
  21. #define ASM_APP_ON ""
  22. #endif
  23. #ifndef ASM_APP_OFF
  24. #define ASM_APP_OFF ""
  25. #endif
  26. /* Switch to the text or data segment. */
  27. #define TEXT_SECTION_ASM_OP "\t.text"
  28. #define DATA_SECTION_ASM_OP "\t.data"
  29. #define BSS_SECTION_ASM_OP "\t.bss"
  30. /* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed,
  31. make sure that this change is reflected in the function
  32. coff_arm_is_local_label_name() in bfd/coff-arm.c. */
  33. #ifndef REGISTER_PREFIX
  34. #define REGISTER_PREFIX ""
  35. #endif
  36. #ifndef USER_LABEL_PREFIX
  37. #define USER_LABEL_PREFIX "_"
  38. #endif
  39. #ifndef LOCAL_LABEL_PREFIX
  40. #define LOCAL_LABEL_PREFIX ""
  41. #endif
  42. /* The assembler's names for the registers. Note that the ?xx registers are
  43. there so that VFPv3/NEON registers D16-D31 have the same spacing as D0-D15
  44. (each of which is overlaid on two S registers), although there are no
  45. actual single-precision registers which correspond to D16-D31. New register
  46. p0 is added which is used for MVE predicated cases. */
  47. #ifndef REGISTER_NAMES
  48. #define REGISTER_NAMES \
  49. { \
  50. "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
  51. "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc", \
  52. "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
  53. "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \
  54. "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \
  55. "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \
  56. "d16", "?16", "d17", "?17", "d18", "?18", "d19", "?19", \
  57. "d20", "?20", "d21", "?21", "d22", "?22", "d23", "?23", \
  58. "d24", "?24", "d25", "?25", "d26", "?26", "d27", "?27", \
  59. "d28", "?28", "d29", "?29", "d30", "?30", "d31", "?31", \
  60. "wr0", "wr1", "wr2", "wr3", \
  61. "wr4", "wr5", "wr6", "wr7", \
  62. "wr8", "wr9", "wr10", "wr11", \
  63. "wr12", "wr13", "wr14", "wr15", \
  64. "wcgr0", "wcgr1", "wcgr2", "wcgr3", \
  65. "cc", "vfpcc", "sfp", "afp", "apsrq", "apsrge", "p0" \
  66. }
  67. #endif
  68. #ifndef ADDITIONAL_REGISTER_NAMES
  69. #define ADDITIONAL_REGISTER_NAMES \
  70. { \
  71. {"a1", 0}, \
  72. {"a2", 1}, \
  73. {"a3", 2}, \
  74. {"a4", 3}, \
  75. {"v1", 4}, \
  76. {"v2", 5}, \
  77. {"v3", 6}, \
  78. {"v4", 7}, \
  79. {"v5", 8}, \
  80. {"v6", 9}, \
  81. {"rfp", 9}, /* Historical. */ \
  82. {"sb", 9}, /* Historical. */ \
  83. {"v7", 10}, \
  84. {"sl", 10}, /* Historical. */ \
  85. {"r11", 11}, /* fp */ \
  86. {"r12", 12}, /* ip */ \
  87. {"r13", 13}, /* sp */ \
  88. {"r14", 14}, /* lr */ \
  89. {"r15", 15} /* pc */ \
  90. }
  91. #endif
  92. #ifndef OVERLAPPING_REGISTER_NAMES
  93. #define OVERLAPPING_REGISTER_NAMES \
  94. { \
  95. {"d0", FIRST_VFP_REGNUM + 0, 2}, \
  96. {"d1", FIRST_VFP_REGNUM + 2, 2}, \
  97. {"d2", FIRST_VFP_REGNUM + 4, 2}, \
  98. {"d3", FIRST_VFP_REGNUM + 6, 2}, \
  99. {"d4", FIRST_VFP_REGNUM + 8, 2}, \
  100. {"d5", FIRST_VFP_REGNUM + 10, 2}, \
  101. {"d6", FIRST_VFP_REGNUM + 12, 2}, \
  102. {"d7", FIRST_VFP_REGNUM + 14, 2}, \
  103. {"d8", FIRST_VFP_REGNUM + 16, 2}, \
  104. {"d9", FIRST_VFP_REGNUM + 18, 2}, \
  105. {"d10", FIRST_VFP_REGNUM + 20, 2}, \
  106. {"d11", FIRST_VFP_REGNUM + 22, 2}, \
  107. {"d12", FIRST_VFP_REGNUM + 24, 2}, \
  108. {"d13", FIRST_VFP_REGNUM + 26, 2}, \
  109. {"d14", FIRST_VFP_REGNUM + 28, 2}, \
  110. {"d15", FIRST_VFP_REGNUM + 30, 2}, \
  111. {"q0", FIRST_VFP_REGNUM + 0, 4}, \
  112. {"q1", FIRST_VFP_REGNUM + 4, 4}, \
  113. {"q2", FIRST_VFP_REGNUM + 8, 4}, \
  114. {"q3", FIRST_VFP_REGNUM + 12, 4}, \
  115. {"q4", FIRST_VFP_REGNUM + 16, 4}, \
  116. {"q5", FIRST_VFP_REGNUM + 20, 4}, \
  117. {"q6", FIRST_VFP_REGNUM + 24, 4}, \
  118. {"q7", FIRST_VFP_REGNUM + 28, 4}, \
  119. {"q8", FIRST_VFP_REGNUM + 32, 4}, \
  120. {"q9", FIRST_VFP_REGNUM + 36, 4}, \
  121. {"q10", FIRST_VFP_REGNUM + 40, 4}, \
  122. {"q11", FIRST_VFP_REGNUM + 44, 4}, \
  123. {"q12", FIRST_VFP_REGNUM + 48, 4}, \
  124. {"q13", FIRST_VFP_REGNUM + 52, 4}, \
  125. {"q14", FIRST_VFP_REGNUM + 56, 4}, \
  126. {"q15", FIRST_VFP_REGNUM + 60, 4} \
  127. }
  128. #endif
  129. #ifndef NO_DOLLAR_IN_LABEL
  130. #define NO_DOLLAR_IN_LABEL 1
  131. #endif
  132. /* Generate DBX debugging information. riscix.h will undefine this because
  133. the native assembler does not support stabs. */
  134. #define DBX_DEBUGGING_INFO 1
  135. /* Acorn dbx moans about continuation chars, so don't use any. */
  136. #ifndef DBX_CONTIN_LENGTH
  137. #define DBX_CONTIN_LENGTH 0
  138. #endif
  139. /* Output a function label definition. */
  140. #ifndef ASM_DECLARE_FUNCTION_NAME
  141. #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
  142. do \
  143. { \
  144. ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
  145. ASM_OUTPUT_LABEL (STREAM, NAME); \
  146. } \
  147. while (0)
  148. #endif
  149. /* Globalizing directive for a label. */
  150. #define GLOBAL_ASM_OP "\t.global\t"
  151. /* Make an internal label into a string. */
  152. #ifndef ASM_GENERATE_INTERNAL_LABEL
  153. #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
  154. sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
  155. #endif
  156. /* Output an element of a dispatch table. */
  157. #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
  158. do \
  159. { \
  160. gcc_assert (!TARGET_THUMB2); \
  161. asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE); \
  162. } \
  163. while (0)
  164. /* Thumb-2 always uses addr_diff_elf so that the Table Branch instructions
  165. can be used. For non-pic code where the offsets do not suitable for
  166. TBB/TBH the elements are output as absolute labels. */
  167. #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
  168. do \
  169. { \
  170. if (TARGET_ARM) \
  171. asm_fprintf (STREAM, "\tb\t%LL%d\n", VALUE); \
  172. else if (TARGET_THUMB1) \
  173. { \
  174. if (flag_pic || optimize_size) \
  175. { \
  176. switch (GET_MODE(body)) \
  177. { \
  178. case E_QImode: \
  179. asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \
  180. VALUE, REL); \
  181. break; \
  182. case E_HImode: /* TBH */ \
  183. asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \
  184. VALUE, REL); \
  185. break; \
  186. case E_SImode: \
  187. asm_fprintf (STREAM, "\t.word\t%LL%d-%LL%d\n", \
  188. VALUE, REL); \
  189. break; \
  190. default: \
  191. gcc_unreachable(); \
  192. } \
  193. } \
  194. else \
  195. asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \
  196. } \
  197. else /* Thumb-2 */ \
  198. { \
  199. switch (GET_MODE(body)) \
  200. { \
  201. case E_QImode: /* TBB */ \
  202. asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \
  203. VALUE, REL); \
  204. break; \
  205. case E_HImode: /* TBH */ \
  206. asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \
  207. VALUE, REL); \
  208. break; \
  209. case E_SImode: \
  210. if (flag_pic) \
  211. asm_fprintf (STREAM, "\t.word\t%LL%d+1-%LL%d\n", VALUE, REL); \
  212. else \
  213. asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \
  214. break; \
  215. default: \
  216. gcc_unreachable(); \
  217. } \
  218. } \
  219. } \
  220. while (0)
  221. #undef ASM_OUTPUT_ASCII
  222. #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
  223. output_ascii_pseudo_op (STREAM, (const unsigned char *) (PTR), LEN)
  224. /* Output a gap. In fact we fill it with nulls. */
  225. #undef ASM_OUTPUT_SKIP
  226. #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
  227. fprintf (STREAM, "\t.space\t%d\n", (int) (NBYTES))
  228. /* Align output to a power of two. Horrible /bin/as. */
  229. #ifndef ASM_OUTPUT_ALIGN
  230. #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
  231. do \
  232. { \
  233. register int amount = 1 << (POWER); \
  234. \
  235. if (amount == 2) \
  236. fprintf (STREAM, "\t.even\n"); \
  237. else if (amount != 1) \
  238. fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
  239. } \
  240. while (0)
  241. #endif
  242. /* Output a common block. */
  243. #ifndef ASM_OUTPUT_COMMON
  244. #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
  245. do \
  246. { \
  247. fprintf (STREAM, "\t.comm\t"); \
  248. assemble_name (STREAM, NAME); \
  249. asm_fprintf (STREAM, ", %d\t%@ %d\n", \
  250. (int)(ROUNDED), (int)(SIZE)); \
  251. } \
  252. while (0)
  253. #endif
  254. /* Output a local common block. /bin/as can't do this, so hack a
  255. `.space' into the bss segment. Note that this is *bad* practice,
  256. which is guaranteed NOT to work since it doesn't define STATIC
  257. COMMON space but merely STATIC BSS space. */
  258. #ifndef ASM_OUTPUT_ALIGNED_LOCAL
  259. #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
  260. do \
  261. { \
  262. switch_to_section (bss_section); \
  263. ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
  264. ASM_OUTPUT_LABEL (STREAM, NAME); \
  265. fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \
  266. } \
  267. while (0)
  268. #endif
  269. /* Output a zero-initialized block. */
  270. #ifndef ASM_OUTPUT_ALIGNED_BSS
  271. #define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \
  272. asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN)
  273. #endif
  274. #ifndef ASM_COMMENT_START
  275. #define ASM_COMMENT_START "@"
  276. #endif
  277. /* This works for GAS and some other assemblers. */
  278. #define SET_ASM_OP "\t.set\t"