c6x.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. /* Target Definitions for TI C6X.
  2. Copyright (C) 2010-2015 Free Software Foundation, Inc.
  3. Contributed by Andrew Jenner <andrew@codesourcery.com>
  4. Contributed by Bernd Schmidt <bernds@codesourcery.com>
  5. This file is part of GCC.
  6. GCC is free software; you can redistribute it and/or modify it
  7. under the terms of the GNU General Public License as published
  8. by the Free Software Foundation; either version 3, or (at your
  9. option) any later version.
  10. GCC is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  13. License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with GCC; see the file COPYING3. If not see
  16. <http://www.gnu.org/licenses/>. */
  17. #ifndef GCC_C6X_H
  18. #define GCC_C6X_H
  19. /* Feature bit definitions that enable specific insns. */
  20. #define C6X_INSNS_C62X 1
  21. #define C6X_INSNS_C64X 2
  22. #define C6X_INSNS_C64XP 4
  23. #define C6X_INSNS_C67X 8
  24. #define C6X_INSNS_C67XP 16
  25. #define C6X_INSNS_C674X 32
  26. #define C6X_INSNS_ATOMIC 64
  27. #define C6X_INSNS_ALL_CPU_BITS 127
  28. #define C6X_DEFAULT_INSN_MASK \
  29. (C6X_INSNS_C62X | C6X_INSNS_C64X | C6X_INSNS_C64XP)
  30. /* A mask of allowed insn types, as defined above. */
  31. extern unsigned long c6x_insn_mask;
  32. /* Value of -march= */
  33. extern c6x_cpu_t c6x_arch;
  34. #define C6X_DEFAULT_ARCH C6X_CPU_C64XP
  35. /* True if the target has C64x instructions. */
  36. #define TARGET_INSNS_64 ((c6x_insn_mask & C6X_INSNS_C64X) != 0)
  37. /* True if the target has C64x+ instructions. */
  38. #define TARGET_INSNS_64PLUS ((c6x_insn_mask & C6X_INSNS_C64XP) != 0)
  39. /* True if the target has C67x instructions. */
  40. #define TARGET_INSNS_67 ((c6x_insn_mask & C6X_INSNS_C67X) != 0)
  41. /* True if the target has C67x+ instructions. */
  42. #define TARGET_INSNS_67PLUS ((c6x_insn_mask & C6X_INSNS_C67XP) != 0)
  43. /* True if the target supports doubleword loads. */
  44. #define TARGET_LDDW (TARGET_INSNS_64 || TARGET_INSNS_67)
  45. /* True if the target supports doubleword loads. */
  46. #define TARGET_STDW TARGET_INSNS_64
  47. /* True if the target supports the MPY32 family of instructions. */
  48. #define TARGET_MPY32 TARGET_INSNS_64PLUS
  49. /* True if the target has floating point hardware. */
  50. #define TARGET_FP TARGET_INSNS_67
  51. /* True if the target has C67x+ floating point extensions. */
  52. #define TARGET_FP_EXT TARGET_INSNS_67PLUS
  53. #define TARGET_DEFAULT 0
  54. /* Run-time Target. */
  55. #define TARGET_CPU_CPP_BUILTINS() \
  56. do \
  57. { \
  58. builtin_assert ("machine=tic6x"); \
  59. builtin_assert ("cpu=tic6x"); \
  60. builtin_define ("__TMS320C6X__"); \
  61. builtin_define ("_TMS320C6X"); \
  62. \
  63. if (TARGET_DSBT) \
  64. builtin_define ("__DSBT__"); \
  65. \
  66. if (TARGET_BIG_ENDIAN) \
  67. builtin_define ("_BIG_ENDIAN"); \
  68. else \
  69. builtin_define ("_LITTLE_ENDIAN"); \
  70. \
  71. switch (c6x_arch) \
  72. { \
  73. case C6X_CPU_C62X: \
  74. builtin_define ("_TMS320C6200"); \
  75. break; \
  76. \
  77. case C6X_CPU_C64XP: \
  78. builtin_define ("_TMS320C6400_PLUS"); \
  79. /* ... fall through ... */ \
  80. case C6X_CPU_C64X: \
  81. builtin_define ("_TMS320C6400"); \
  82. break; \
  83. \
  84. case C6X_CPU_C67XP: \
  85. builtin_define ("_TMS320C6700_PLUS"); \
  86. /* ... fall through ... */ \
  87. case C6X_CPU_C67X: \
  88. builtin_define ("_TMS320C6700"); \
  89. break; \
  90. \
  91. case C6X_CPU_C674X: \
  92. builtin_define ("_TMS320C6740"); \
  93. builtin_define ("_TMS320C6700_PLUS"); \
  94. builtin_define ("_TMS320C6700"); \
  95. builtin_define ("_TMS320C6400_PLUS"); \
  96. builtin_define ("_TMS320C6400"); \
  97. break; \
  98. } \
  99. } while (0)
  100. #define OPTION_DEFAULT_SPECS \
  101. {"arch", "%{!march=*:-march=%(VALUE)}" }
  102. /* Storage Layout. */
  103. #define BITS_BIG_ENDIAN 0
  104. #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
  105. #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0)
  106. #define REG_WORDS_BIG_ENDIAN 0
  107. #define UNITS_PER_WORD 4
  108. #define PARM_BOUNDARY 8
  109. #define STACK_BOUNDARY 64
  110. #define FUNCTION_BOUNDARY 32
  111. #define BIGGEST_ALIGNMENT 64
  112. #define STRICT_ALIGNMENT 1
  113. /* The ABI requires static arrays must be at least 8 byte aligned.
  114. Really only externally visible arrays must be aligned this way, as
  115. only those are directly visible from another compilation unit. But
  116. we don't have that information available here. */
  117. #define DATA_ABI_ALIGNMENT(TYPE, ALIGN) \
  118. (((ALIGN) < BITS_PER_UNIT * 8 && TREE_CODE (TYPE) == ARRAY_TYPE) \
  119. ? BITS_PER_UNIT * 8 : (ALIGN))
  120. /* Type Layout. */
  121. #define DEFAULT_SIGNED_CHAR 1
  122. #undef SIZE_TYPE
  123. #define SIZE_TYPE "unsigned int"
  124. #undef PTRDIFF_TYPE
  125. #define PTRDIFF_TYPE "int"
  126. /* Registers. */
  127. #define FIRST_PSEUDO_REGISTER 67
  128. #define FIXED_REGISTERS \
  129. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  130. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  131. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, \
  132. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
  133. 1, 1, 1}
  134. #define CALL_USED_REGISTERS \
  135. { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, \
  136. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
  137. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, \
  138. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
  139. 1, 1, 1}
  140. /* This lists call-used non-predicate registers first, followed by call-used
  141. registers, followed by predicate registers. We want to avoid allocating
  142. the predicate registers for other uses as much as possible. */
  143. #define REG_ALLOC_ORDER \
  144. { \
  145. REG_A0, REG_A3, REG_A4, REG_A5, REG_A6, REG_A7, REG_A8, REG_A9, \
  146. REG_A16, REG_A17, REG_A18, REG_A19, REG_A20, REG_A21, REG_A22, REG_A23, \
  147. REG_A24, REG_A25, REG_A26, REG_A27, REG_A28, REG_A29, REG_A30, REG_A31, \
  148. REG_B4, REG_B5, REG_B6, REG_B7, REG_B8, REG_B9, REG_B16, \
  149. REG_B17, REG_B18, REG_B19, REG_B20, REG_B21, REG_B22, REG_B23, REG_B24, \
  150. REG_B25, REG_B26, REG_B27, REG_B28, REG_B29, REG_B30, REG_B31, \
  151. REG_A10, REG_A11, REG_A12, REG_A13, REG_A14, REG_A15, \
  152. REG_B3, REG_B10, REG_B11, REG_B12, REG_B13, REG_B14, REG_B15, \
  153. REG_A1, REG_A2, REG_B0, REG_B1, REG_B2, REG_ILC \
  154. }
  155. #define HARD_REGNO_NREGS(regno, mode) \
  156. ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) \
  157. / UNITS_PER_WORD)
  158. #define HARD_REGNO_MODE_OK(reg, mode) (GET_MODE_SIZE (mode) <= UNITS_PER_WORD \
  159. ? 1 : ((reg) & 1) == 0)
  160. #define MODES_TIEABLE_P(mode1, mode2) \
  161. ((mode1) == (mode2) || \
  162. (GET_MODE_SIZE (mode1) <= UNITS_PER_WORD && \
  163. GET_MODE_SIZE (mode2) <= UNITS_PER_WORD))
  164. /* Register Classes. */
  165. enum reg_class
  166. {
  167. NO_REGS,
  168. PREDICATE_A_REGS,
  169. PREDICATE_B_REGS,
  170. PREDICATE_REGS,
  171. PICREG,
  172. SPREG,
  173. CALL_USED_B_REGS,
  174. NONPREDICATE_A_REGS,
  175. NONPREDICATE_B_REGS,
  176. NONPREDICATE_REGS,
  177. A_REGS,
  178. B_REGS,
  179. GENERAL_REGS,
  180. ALL_REGS,
  181. LIM_REG_CLASSES
  182. };
  183. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  184. #define REG_CLASS_NAMES { \
  185. "NO_REGS", \
  186. "PREDICATE_A_REGS", \
  187. "PREDICATE_B_REGS", \
  188. "PREDICATE_REGS", \
  189. "PICREG", \
  190. "SPREG", \
  191. "CALL_USED_B_REGS", \
  192. "NONPREDICATE_A_REGS", \
  193. "NONPREDICATE_B_REGS", \
  194. "NONPREDICATE_REGS", \
  195. "A_REGS", \
  196. "B_REGS", \
  197. "GENERAL_REGS", \
  198. "ALL_REGS" }
  199. #define REG_CLASS_CONTENTS \
  200. { \
  201. /* NO_REGS. */ \
  202. { 0x00000000, 0x00000000, 0 }, \
  203. /* PREDICATE_A_REGS. */ \
  204. { 0x00000006, 0x00000000, 0 }, \
  205. /* PREDICATE_B_REGS. */ \
  206. { 0x00000000, 0x00000007, 0 }, \
  207. /* PREDICATE_REGS. */ \
  208. { 0x00000006, 0x00000007, 0 }, \
  209. /* PICREG. */ \
  210. { 0x00000000, 0x00004000, 0 }, \
  211. /* SPREG. */ \
  212. { 0x00000000, 0x00008000, 0 }, \
  213. /* CALL_USED_B_REGS. */ \
  214. { 0x00000000, 0xFFFF03FF, 0 }, \
  215. /* NONPREDICATE_A_REGS. */ \
  216. { 0xFFFFFFF9, 0x00000000, 0 }, \
  217. /* NONPREDICATE_B_REGS. */ \
  218. { 0x00000000, 0xFFFFFFF8, 0 }, \
  219. /* NONPREDICATE_REGS. */ \
  220. { 0xFFFFFFF9, 0xFFFFFFF8, 0 }, \
  221. /* A_REGS. */ \
  222. { 0xFFFFFFFF, 0x00000000, 3 }, \
  223. /* B_REGS. */ \
  224. { 0x00000000, 0xFFFFFFFF, 3 }, \
  225. /* GENERAL_REGS. */ \
  226. { 0xFFFFFFFF, 0xFFFFFFFF, 3 }, \
  227. /* ALL_REGS. */ \
  228. { 0xFFFFFFFF, 0xFFFFFFFF, 7 }, \
  229. }
  230. #define A_REGNO_P(N) ((N) <= REG_A31)
  231. #define B_REGNO_P(N) ((N) >= REG_B0 && (N) <= REG_B31)
  232. #define A_REG_P(X) (REG_P (X) && A_REGNO_P (REGNO (X)))
  233. #define CROSS_OPERANDS(X0,X1) \
  234. (A_REG_P (X0) == A_REG_P (X1) ? CROSS_N : CROSS_Y)
  235. #define REGNO_REG_CLASS(reg) \
  236. ((reg) >= REG_A1 && (reg) <= REG_A2 ? PREDICATE_A_REGS \
  237. : (reg) == REG_A0 && TARGET_INSNS_64 ? PREDICATE_A_REGS \
  238. : (reg) >= REG_B0 && (reg) <= REG_B2 ? PREDICATE_B_REGS \
  239. : A_REGNO_P (reg) ? NONPREDICATE_A_REGS \
  240. : call_used_regs[reg] ? CALL_USED_B_REGS : B_REGS)
  241. #define BASE_REG_CLASS ALL_REGS
  242. #define INDEX_REG_CLASS ALL_REGS
  243. #define REGNO_OK_FOR_BASE_STRICT_P(X) \
  244. ((X) < FIRST_PSEUDO_REGISTER \
  245. || (reg_renumber[X] >= 0 && reg_renumber[X] < FIRST_PSEUDO_REGISTER))
  246. #define REGNO_OK_FOR_BASE_NONSTRICT_P(X) 1
  247. #define REGNO_OK_FOR_INDEX_STRICT_P(X) \
  248. ((X) < FIRST_PSEUDO_REGISTER \
  249. || (reg_renumber[X] >= 0 && reg_renumber[X] < FIRST_PSEUDO_REGISTER))
  250. #define REGNO_OK_FOR_INDEX_NONSTRICT_P(X) 1
  251. #ifdef REG_OK_STRICT
  252. #define REGNO_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_STRICT_P (X)
  253. #define REGNO_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_STRICT_P (X)
  254. #else
  255. #define REGNO_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_NONSTRICT_P (X)
  256. #define REGNO_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_NONSTRICT_P (X)
  257. #endif
  258. #define CLASS_MAX_NREGS(class, mode) \
  259. ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
  260. #define REGNO_OK_FOR_INDIRECT_JUMP_P(REGNO, MODE) B_REGNO_P (REGNO)
  261. /* Stack and Calling. */
  262. /* SP points to 4 bytes below the first word of the frame. */
  263. #define STACK_POINTER_OFFSET 4
  264. /* Likewise for AP (which is the incoming stack pointer). */
  265. #define FIRST_PARM_OFFSET(fundecl) 4
  266. #define STARTING_FRAME_OFFSET 0
  267. #define FRAME_GROWS_DOWNWARD 1
  268. #define STACK_GROWS_DOWNWARD
  269. #define STACK_POINTER_REGNUM REG_B15
  270. #define HARD_FRAME_POINTER_REGNUM REG_A15
  271. /* These two always get eliminated in favour of the stack pointer
  272. or the hard frame pointer. */
  273. #define FRAME_POINTER_REGNUM REG_FRAME
  274. #define ARG_POINTER_REGNUM REG_ARGP
  275. #define PIC_OFFSET_TABLE_REGNUM REG_B14
  276. /* We keep the stack pointer constant rather than using push/pop
  277. instructions. */
  278. #define ACCUMULATE_OUTGOING_ARGS 1
  279. /* Before the prologue, the return address is in the B3 register. */
  280. #define RETURN_ADDR_REGNO REG_B3
  281. #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNO)
  282. #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (RETURN_ADDR_REGNO)
  283. #define RETURN_ADDR_RTX(COUNT, FRAME) c6x_return_addr_rtx (COUNT)
  284. #define INCOMING_FRAME_SP_OFFSET 0
  285. #define ARG_POINTER_CFA_OFFSET(fundecl) 0
  286. #define STATIC_CHAIN_REGNUM REG_A2
  287. struct c6x_args {
  288. /* Number of arguments to pass in registers. */
  289. int nregs;
  290. /* Number of arguments passed in registers so far. */
  291. int count;
  292. };
  293. #define CUMULATIVE_ARGS struct c6x_args
  294. #define INIT_CUMULATIVE_ARGS(cum, fntype, libname, fndecl, n_named_args) \
  295. c6x_init_cumulative_args (&cum, fntype, libname, n_named_args)
  296. #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
  297. (c6x_block_reg_pad_upward (MODE, TYPE, FIRST) ? upward : downward)
  298. #define FUNCTION_ARG_REGNO_P(r) \
  299. (((r) >= REG_A4 && (r) <= REG_A13) || ((r) >= REG_B4 && (r) <= REG_B13))
  300. #define DEFAULT_PCC_STRUCT_RETURN 0
  301. #define FUNCTION_PROFILER(file, labelno) \
  302. fatal_error (input_location, \
  303. "profiling is not yet implemented for this architecture")
  304. /* Trampolines. */
  305. #define TRAMPOLINE_SIZE 32
  306. #define TRAMPOLINE_ALIGNMENT 256
  307. #define ELIMINABLE_REGS \
  308. {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  309. { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
  310. { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
  311. { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}} \
  312. /* Define the offset between two registers, one to be eliminated, and the other
  313. its replacement, at the start of a routine. */
  314. #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
  315. ((OFFSET) = c6x_initial_elimination_offset ((FROM), (TO)))
  316. /* Addressing Modes. */
  317. #define CONSTANT_ADDRESS_P(x) (CONSTANT_P(x) && GET_CODE(x) != CONST_DOUBLE)
  318. #define MAX_REGS_PER_ADDRESS 2
  319. #define HAVE_PRE_DECREMENT 1
  320. #define HAVE_POST_DECREMENT 1
  321. #define HAVE_PRE_INCREMENT 1
  322. #define HAVE_POST_INCREMENT 1
  323. /* Register forms are available, but due to scaling we currently don't
  324. support them. */
  325. #define HAVE_PRE_MODIFY_DISP 1
  326. #define HAVE_POST_MODIFY_DISP 1
  327. #define LEGITIMATE_PIC_OPERAND_P(X) \
  328. (!symbolic_operand (X, SImode))
  329. struct GTY(()) machine_function
  330. {
  331. /* True if we expanded a sibling call. */
  332. int contains_sibcall;
  333. };
  334. /* Costs. */
  335. #define NO_FUNCTION_CSE 1
  336. #define SLOW_BYTE_ACCESS 0
  337. #define BRANCH_COST(speed_p, predictable_p) 6
  338. /* Model costs for the vectorizer. */
  339. /* Cost of conditional branch. */
  340. #ifndef TARG_COND_BRANCH_COST
  341. #define TARG_COND_BRANCH_COST 6
  342. #endif
  343. /* Cost of any scalar operation, excluding load and store. */
  344. #ifndef TARG_SCALAR_STMT_COST
  345. #define TARG_SCALAR_STMT_COST 1
  346. #endif
  347. /* Cost of scalar load. */
  348. #undef TARG_SCALAR_LOAD_COST
  349. #define TARG_SCALAR_LOAD_COST 2 /* load + rotate */
  350. /* Cost of scalar store. */
  351. #undef TARG_SCALAR_STORE_COST
  352. #define TARG_SCALAR_STORE_COST 10
  353. /* Cost of any vector operation, excluding load, store,
  354. or vector to scalar operation. */
  355. #undef TARG_VEC_STMT_COST
  356. #define TARG_VEC_STMT_COST 1
  357. /* Cost of vector to scalar operation. */
  358. #undef TARG_VEC_TO_SCALAR_COST
  359. #define TARG_VEC_TO_SCALAR_COST 1
  360. /* Cost of scalar to vector operation. */
  361. #undef TARG_SCALAR_TO_VEC_COST
  362. #define TARG_SCALAR_TO_VEC_COST 1
  363. /* Cost of aligned vector load. */
  364. #undef TARG_VEC_LOAD_COST
  365. #define TARG_VEC_LOAD_COST 1
  366. /* Cost of misaligned vector load. */
  367. #undef TARG_VEC_UNALIGNED_LOAD_COST
  368. #define TARG_VEC_UNALIGNED_LOAD_COST 2
  369. /* Cost of vector store. */
  370. #undef TARG_VEC_STORE_COST
  371. #define TARG_VEC_STORE_COST 1
  372. /* Cost of vector permutation. */
  373. #ifndef TARG_VEC_PERMUTE_COST
  374. #define TARG_VEC_PERMUTE_COST 1
  375. #endif
  376. /* ttype entries (the only interesting data references used) are
  377. sb-relative got-indirect (aka .ehtype). */
  378. #define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \
  379. (((code) == 0 && (data) == 1) ? (DW_EH_PE_datarel | DW_EH_PE_indirect) \
  380. : DW_EH_PE_absptr)
  381. /* This should be the same as the definition in elfos.h, plus the call
  382. to output special unwinding directives. */
  383. #undef ASM_DECLARE_FUNCTION_NAME
  384. #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
  385. do \
  386. { \
  387. c6x_output_file_unwind (FILE); \
  388. ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
  389. ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
  390. ASM_OUTPUT_LABEL (FILE, NAME); \
  391. } \
  392. while (0)
  393. /* This should be the same as the definition in elfos.h, plus the call
  394. to output special unwinding directives. */
  395. #undef ASM_DECLARE_FUNCTION_SIZE
  396. #define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \
  397. c6x_function_end (STREAM, NAME)
  398. /* Arbitrarily choose A4/A5. */
  399. #define EH_RETURN_DATA_REGNO(N) (((N) < 2) ? (N) + 4 : INVALID_REGNUM)
  400. /* The register that holds the return address in exception handlers. */
  401. #define C6X_EH_STACKADJ_REGNUM 3
  402. #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, C6X_EH_STACKADJ_REGNUM)
  403. /* Assembler Format. */
  404. #define DWARF2_ASM_LINE_DEBUG_INFO 1
  405. #undef ASM_APP_ON
  406. #define ASM_APP_ON "\t; #APP \n"
  407. #undef ASM_APP_OFF
  408. #define ASM_APP_OFF "\t; #NO_APP \n"
  409. #define ASM_OUTPUT_COMMON(stream, name, size, rounded)
  410. #define ASM_OUTPUT_LOCAL(stream, name, size, rounded)
  411. #define GLOBAL_ASM_OP "\t.global\t"
  412. #define REGISTER_NAMES \
  413. { \
  414. "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", \
  415. "A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", \
  416. "A16", "A17", "A18", "A19", "A20", "A21", "A22", "A23", \
  417. "A24", "A25", "A26", "A27", "A28", "A29", "A30", "A31", \
  418. "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", \
  419. "B8", "B9", "B10", "B11", "B12", "B13", "B14", "B15", \
  420. "B16", "B17", "B18", "B19", "B20", "B21", "B22", "B23", \
  421. "B24", "B25", "B26", "B27", "B28", "B29", "B30", "B31", \
  422. "FP", "ARGP", "ILC" }
  423. #define DBX_REGISTER_NUMBER(N) (dbx_register_map[(N)])
  424. extern unsigned const dbx_register_map[FIRST_PSEUDO_REGISTER];
  425. #define FINAL_PRESCAN_INSN c6x_final_prescan_insn
  426. #define TEXT_SECTION_ASM_OP ".text;"
  427. #define DATA_SECTION_ASM_OP ".data;"
  428. #define ASM_OUTPUT_ALIGN(stream, power) \
  429. do \
  430. { \
  431. if (power) \
  432. fprintf ((stream), "\t.align\t%d\n", power); \
  433. } \
  434. while (0)
  435. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
  436. do { char __buf[256]; \
  437. fprintf (FILE, "\t.long\t"); \
  438. ASM_GENERATE_INTERNAL_LABEL (__buf, "L", VALUE); \
  439. assemble_name (FILE, __buf); \
  440. fputc ('\n', FILE); \
  441. } while (0)
  442. /* Determine whether to place EXP (an expression or a decl) should be
  443. placed into one of the small data sections. */
  444. #define PLACE_IN_SDATA_P(EXP) \
  445. (c6x_sdata_mode == C6X_SDATA_NONE ? false \
  446. : c6x_sdata_mode == C6X_SDATA_ALL ? true \
  447. : !AGGREGATE_TYPE_P (TREE_TYPE (EXP)))
  448. #define SCOMMON_ASM_OP "\t.scomm\t"
  449. #undef ASM_OUTPUT_ALIGNED_DECL_COMMON
  450. #define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
  451. do \
  452. { \
  453. if (DECL != NULL && PLACE_IN_SDATA_P (DECL)) \
  454. fprintf ((FILE), "%s", SCOMMON_ASM_OP); \
  455. else \
  456. fprintf ((FILE), "%s", COMMON_ASM_OP); \
  457. assemble_name ((FILE), (NAME)); \
  458. fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (ALIGN) / BITS_PER_UNIT);\
  459. } \
  460. while (0)
  461. /* This says how to output assembler code to declare an
  462. uninitialized internal linkage data object. */
  463. #undef ASM_OUTPUT_ALIGNED_DECL_LOCAL
  464. #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \
  465. do { \
  466. if (PLACE_IN_SDATA_P (DECL)) \
  467. switch_to_section (sbss_section); \
  468. else \
  469. switch_to_section (bss_section); \
  470. ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
  471. if (!flag_inhibit_size_directive) \
  472. ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
  473. ASM_OUTPUT_ALIGN ((FILE), exact_log2((ALIGN) / BITS_PER_UNIT)); \
  474. ASM_OUTPUT_LABEL(FILE, NAME); \
  475. ASM_OUTPUT_SKIP((FILE), (SIZE) ? (SIZE) : 1); \
  476. } while (0)
  477. #define CASE_VECTOR_PC_RELATIVE flag_pic
  478. #define JUMP_TABLES_IN_TEXT_SECTION flag_pic
  479. #define ADDR_VEC_ALIGN(VEC) (JUMP_TABLES_IN_TEXT_SECTION ? 5 : 2)
  480. /* This is how to output an element of a case-vector that is relative. */
  481. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
  482. do { char buf[100]; \
  483. fputs ("\t.long ", FILE); \
  484. ASM_GENERATE_INTERNAL_LABEL (buf, "L", VALUE); \
  485. assemble_name (FILE, buf); \
  486. putc ('-', FILE); \
  487. ASM_GENERATE_INTERNAL_LABEL (buf, "L", REL); \
  488. assemble_name (FILE, buf); \
  489. putc ('\n', FILE); \
  490. } while (0)
  491. /* Misc. */
  492. #define CASE_VECTOR_MODE SImode
  493. #define MOVE_MAX 4
  494. #define MOVE_RATIO(SPEED) 4
  495. #define TRULY_NOOP_TRUNCATION(outprec, inprec) 1
  496. #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
  497. #define Pmode SImode
  498. #define FUNCTION_MODE QImode
  499. #define CPU_UNITS_QUERY 1
  500. extern int c6x_initial_flag_pic;
  501. #endif /* GCC_C6X_H */