tc-tic6x.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /* Definitions for TI C6X assembler.
  2. Copyright (C) 2010-2015 Free Software Foundation, Inc.
  3. This file is part of GAS, the GNU Assembler.
  4. GAS is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GAS is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GAS; see the file COPYING. If not, write to the Free
  14. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  15. 02110-1301, USA. */
  16. #define TC_TIC6X 1
  17. #define TARGET_BYTES_BIG_ENDIAN 0
  18. #define WORKING_DOT_WORD
  19. #define DOUBLEBAR_PARALLEL
  20. #define DWARF2_LINE_MIN_INSN_LENGTH 2
  21. #define MD_APPLY_SYM_VALUE(FIX) 0
  22. #define TC_PREDICATE_START_CHAR '['
  23. #define TC_PREDICATE_END_CHAR ']'
  24. /* For TI C6X, we keep spaces in what the preprocessor considers
  25. operands as they may separate functional unit specifiers from
  26. operands. */
  27. #define TC_KEEP_OPERAND_SPACES 1
  28. #define TARGET_ARCH bfd_arch_tic6x
  29. #define TARGET_FORMAT (target_big_endian \
  30. ? "elf32-tic6x-be" \
  31. : "elf32-tic6x-le")
  32. typedef struct tic6x_label_list
  33. {
  34. struct tic6x_label_list *next;
  35. symbolS *label;
  36. } tic6x_label_list;
  37. /* Must be consistent with the enum in tc-tic6x.c. */
  38. #define TIC6X_NUM_UNWIND_REGS 13
  39. /* Unwinding information state. */
  40. typedef struct tic6x_unwind_info {
  41. int personality_index;
  42. symbolS *personality_routine;
  43. symbolS *function_start;
  44. segT saved_seg;
  45. subsegT saved_subseg;
  46. /* NULL if table entry is inline. */
  47. symbolS *table_entry;
  48. char *frag_start;
  49. valueT data;
  50. /* 0 before .cfi_startproc
  51. -1 between .cfi_startproc and .handlerdata
  52. >0 between .handlerdata and .endp */
  53. int data_bytes;
  54. offsetT reg_offset[TIC6X_NUM_UNWIND_REGS];
  55. bfd_boolean reg_saved[TIC6X_NUM_UNWIND_REGS];
  56. int cfa_reg;
  57. int return_reg;
  58. unsigned safe_mask;
  59. unsigned compact_mask;
  60. unsigned reg_saved_mask;
  61. offsetT cfa_offset;
  62. bfd_boolean pop_rts;
  63. /* Only valid for UNWIND_OP_POP_REG */
  64. int saved_reg_count;
  65. } tic6x_unwind_info;
  66. typedef struct
  67. {
  68. /* Any labels seen since the last instruction or data. If not NULL,
  69. a following instruction may not have parallel bars, but must
  70. start a new execute packet. */
  71. tic6x_label_list *label_list;
  72. /* Whether compact instructions are forbidden here. */
  73. bfd_boolean nocmp;
  74. /* If there is a current execute packet, the frag being used for
  75. that execute packet. */
  76. fragS *execute_packet_frag;
  77. /* If there is a current execute packet, a pointer to the
  78. least-significant byte of the last instruction in it (for setting
  79. the p-bit). */
  80. char *last_insn_lsb;
  81. /* If there has been an SPMASK instruction in the current execute
  82. packet, a pointer to the first byte in it (for processing
  83. ||^); otherwise NULL. */
  84. char *spmask_addr;
  85. /* The functional units used in the current execute packet, recorded
  86. by setting the same bits as would be set in the 32-bit SPMASK
  87. instruction. */
  88. unsigned int func_units_used;
  89. /* If an SPLOOP-family instruction has been seen, and a following
  90. SPKERNEL-family instruction has not yet been seen, the ii value
  91. from the SPLOOP instruction (in the range 1 to 14); otherwise
  92. 0. */
  93. int sploop_ii;
  94. /* Bit N indicates that an R_C6000_NONE relocation has been output for
  95. __c6xabi_unwind_cpp_prN already if set. This enables dependencies to be
  96. emitted only once per section, to save unnecessary bloat. */
  97. unsigned int marked_pr_dependency;
  98. tic6x_unwind_info *unwind;
  99. tic6x_unwind_info *text_unwind;
  100. } tic6x_segment_info_type;
  101. #define TC_SEGMENT_INFO_TYPE tic6x_segment_info_type
  102. typedef struct
  103. {
  104. /* Whether this machine-dependent frag is used for instructions (as
  105. opposed to code alignment). */
  106. bfd_boolean is_insns;
  107. /* For a frag used for instructions, whether it is may cross a fetch
  108. packet boundary (subject to alignment requirements). */
  109. bfd_boolean can_cross_fp_boundary;
  110. } tic6x_frag_info;
  111. #define TC_FRAG_TYPE tic6x_frag_info
  112. #define TC_FRAG_INIT(fragP) tic6x_frag_init (fragP)
  113. extern void tic6x_frag_init (fragS *fragp);
  114. typedef struct
  115. {
  116. /* Whether this fix was for an ADDA instruction. If so, a constant
  117. resulting from resolving the fix should be implicitly shifted
  118. left (it represents a value to be encoded literally in the
  119. instruction, whereas a non-constant represents a DP-relative
  120. value counting in the appropriate units). */
  121. bfd_boolean fix_adda;
  122. /* The symbol to be subtracted in case of a PCR_H16 or PCR_L16
  123. reloc. */
  124. symbolS *fix_subsy;
  125. } tic6x_fix_info;
  126. #define TC_FIX_TYPE tic6x_fix_info
  127. #define TC_INIT_FIX_DATA(fixP) tic6x_init_fix_data (fixP)
  128. struct fix;
  129. extern void tic6x_init_fix_data (struct fix *fixP);
  130. #define md_after_parse_args() tic6x_after_parse_args ()
  131. extern void tic6x_after_parse_args (void);
  132. #define md_cleanup() tic6x_cleanup ()
  133. extern void tic6x_cleanup (void);
  134. #define md_cons_align(n) tic6x_cons_align (n)
  135. extern void tic6x_cons_align (int n);
  136. #define md_do_align(n, fill, len, max, label) \
  137. do { \
  138. if (tic6x_do_align (n, fill, len, max)) \
  139. goto label; \
  140. } while (0)
  141. extern bfd_boolean tic6x_do_align (int n, char *fill, int len, int max);
  142. #define CONVERT_SYMBOLIC_ATTRIBUTE(name) \
  143. tic6x_convert_symbolic_attribute (name)
  144. extern int tic6x_convert_symbolic_attribute (const char *);
  145. #define md_end() tic6x_end ();
  146. extern void tic6x_end (void);
  147. #define md_parse_name(name, exprP, mode, nextcharP) \
  148. tic6x_parse_name (name, exprP, mode, nextcharP)
  149. extern int tic6x_parse_name (const char *name, expressionS *exprP,
  150. enum expr_mode mode, char *nextchar);
  151. #define MD_PCREL_FROM_SECTION(FIX, SEC) tic6x_pcrel_from_section (FIX, SEC)
  152. extern long tic6x_pcrel_from_section (struct fix *fixp, segT sec);
  153. #define md_start_line_hook() tic6x_start_line_hook ()
  154. extern void tic6x_start_line_hook (void);
  155. #define TC_CONS_FIX_NEW(frag, where, size, exp, reloc) \
  156. tic6x_cons_fix_new (frag, where, size, exp, reloc)
  157. extern void tic6x_cons_fix_new (fragS *, int, int, expressionS *,
  158. bfd_reloc_code_real_type);
  159. #define tc_fix_adjustable(FIX) tic6x_fix_adjustable (FIX)
  160. extern bfd_boolean tic6x_fix_adjustable (struct fix *);
  161. #define tc_frob_label(sym) tic6x_frob_label (sym)
  162. extern void tic6x_frob_label (symbolS *sym);
  163. #define tc_init_after_args() tic6x_init_after_args ()
  164. extern void tic6x_init_after_args (void);
  165. #define tc_unrecognized_line(c) tic6x_unrecognized_line (c)
  166. extern int tic6x_unrecognized_line (int c);
  167. /* We want .cfi_* pseudo-ops for generating unwind info. */
  168. #define TARGET_USE_CFIPOP 1
  169. /* CFI hooks. */
  170. #define tc_regname_to_dw2regnum tic6x_regname_to_dw2regnum
  171. int tic6x_regname_to_dw2regnum (char *regname);
  172. #define tc_cfi_frame_initial_instructions tic6x_frame_initial_instructions
  173. void tic6x_frame_initial_instructions (void);
  174. /* The return register is B3. */
  175. #define DWARF2_DEFAULT_RETURN_COLUMN (16 + 3)
  176. /* Registers are generally saved at negative offsets to the CFA. */
  177. #define DWARF2_CIE_DATA_ALIGNMENT (-4)
  178. #define tc_cfi_startproc tic6x_cfi_startproc
  179. void tic6x_cfi_startproc (void);
  180. #define tc_cfi_endproc tic6x_cfi_endproc
  181. struct fde_entry;
  182. void tic6x_cfi_endproc (struct fde_entry *fde);
  183. #define tc_cfi_section_name ".c6xabi.exidx"