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