Upload Tizen:Base source
[external/binutils.git] / gas / config / tc-tic6x.h
1 /* Definitions for TI C6X assembler.
2    Copyright 2010
3    Free Software Foundation, Inc.
4
5    This file is part of GAS, the GNU Assembler.
6
7    GAS is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    GAS is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GAS; see the file COPYING.  If not, write to the Free
19    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20    02110-1301, USA.  */
21
22 #define TC_TIC6X 1
23 #define TARGET_BYTES_BIG_ENDIAN 0
24 #define WORKING_DOT_WORD
25 #define DOUBLEBAR_PARALLEL
26 #define DWARF2_LINE_MIN_INSN_LENGTH 2
27 #define MD_APPLY_SYM_VALUE(FIX) 0
28 #define TC_PREDICATE_START_CHAR '['
29 #define TC_PREDICATE_END_CHAR ']'
30 /* For TI C6X, we keep spaces in what the preprocessor considers
31    operands as they may separate functional unit specifiers from
32    operands.  */
33 #define TC_KEEP_OPERAND_SPACES 1
34
35 #define TARGET_ARCH     bfd_arch_tic6x
36 #define TARGET_FORMAT   (target_big_endian      \
37                          ? "elf32-tic6x-be"     \
38                          : "elf32-tic6x-le")
39
40 typedef struct tic6x_label_list
41 {
42   struct tic6x_label_list *next;
43   symbolS *label;
44 } tic6x_label_list;
45
46 typedef struct
47 {
48   /* Any labels seen since the last instruction or data.  If not NULL,
49      a following instruction may not have parallel bars, but must
50      start a new execute packet.  */
51   tic6x_label_list *label_list;
52
53   /* Whether compact instructions are forbidden here.  */
54   bfd_boolean nocmp;
55
56   /* If there is a current execute packet, the frag being used for
57      that execute packet.  */
58   fragS *execute_packet_frag;
59
60   /* If there is a current execute packet, a pointer to the
61      least-significant byte of the last instruction in it (for setting
62      the p-bit).  */
63   char *last_insn_lsb;
64
65   /* If there has been an SPMASK instruction in the current execute
66      packet, a pointer to the first byte in it (for processing
67      ||^); otherwise NULL.  */
68   char *spmask_addr;
69
70   /* The functional units used in the current execute packet, recorded
71      by setting the same bits as would be set in the 32-bit SPMASK
72      instruction.  */
73   unsigned int func_units_used;
74
75   /* If an SPLOOP-family instruction has been seen, and a following
76      SPKERNEL-family instruction has not yet been seen, the ii value
77      from the SPLOOP instruction (in the range 1 to 14); otherwise
78      0.  */
79   int sploop_ii;
80 } tic6x_segment_info_type;
81 #define TC_SEGMENT_INFO_TYPE tic6x_segment_info_type
82
83 typedef struct
84 {
85   /* Whether this machine-dependent frag is used for instructions (as
86      opposed to code alignment).  */
87   bfd_boolean is_insns;
88
89   /* For a frag used for instructions, whether it is may cross a fetch
90      packet boundary (subject to alignment requirements).  */
91   bfd_boolean can_cross_fp_boundary;
92 } tic6x_frag_info;
93 #define TC_FRAG_TYPE tic6x_frag_info
94 #define TC_FRAG_INIT(fragP) tic6x_frag_init (fragP)
95 extern void tic6x_frag_init (fragS *fragp);
96
97 typedef struct
98 {
99   /* Whether this fix was for an ADDA instruction.  If so, a constant
100      resulting from resolving the fix should be implicitly shifted
101      left (it represents a value to be encoded literally in the
102      instruction, whereas a non-constant represents a DP-relative
103      value counting in the appropriate units).  */
104   bfd_boolean fix_adda;
105 } tic6x_fix_info;
106 #define TC_FIX_TYPE tic6x_fix_info
107 #define TC_INIT_FIX_DATA(fixP) tic6x_init_fix_data (fixP)
108 struct fix;
109 extern void tic6x_init_fix_data (struct fix *fixP);
110
111 #define md_after_parse_args() tic6x_after_parse_args ()
112 extern void tic6x_after_parse_args (void);
113
114 #define md_cleanup() tic6x_cleanup ()
115 extern void tic6x_cleanup (void);
116
117 #define md_cons_align(n) tic6x_cons_align (n)
118 extern void tic6x_cons_align (int n);
119
120 #define md_do_align(n, fill, len, max, label)   \
121   do {                                          \
122     if (tic6x_do_align (n, fill, len, max))     \
123       goto label;                               \
124   } while (0)
125 extern bfd_boolean tic6x_do_align (int n, char *fill, int len, int max);
126
127 #define CONVERT_SYMBOLIC_ATTRIBUTE(name)        \
128   tic6x_convert_symbolic_attribute (name)
129 extern int tic6x_convert_symbolic_attribute (const char *);
130
131 #define md_end() tic6x_end ();
132 extern void tic6x_end (void);
133
134 #define md_parse_name(name, exprP, mode, nextcharP)     \
135   tic6x_parse_name (name, exprP, mode, nextcharP)
136 extern int tic6x_parse_name (const char *name, expressionS *exprP,
137                              enum expr_mode mode, char *nextchar);
138
139 #define MD_PCREL_FROM_SECTION(FIX, SEC) tic6x_pcrel_from_section (FIX, SEC)
140 extern long tic6x_pcrel_from_section (struct fix *fixp, segT sec);
141
142 #define md_start_line_hook() tic6x_start_line_hook ()
143 extern void tic6x_start_line_hook (void);
144
145 #define TC_CONS_FIX_NEW(frag, where, size, exp) \
146   tic6x_cons_fix_new (frag, where, size, exp)
147 extern void tic6x_cons_fix_new (fragS *frag, int where, int size,
148                                 expressionS *exp);
149
150 #define tc_fix_adjustable(FIX) tic6x_fix_adjustable (FIX)
151 extern bfd_boolean tic6x_fix_adjustable (struct fix *);
152
153 #define tc_frob_label(sym) tic6x_frob_label (sym)
154 extern void tic6x_frob_label (symbolS *sym);
155
156 #define tc_init_after_args() tic6x_init_after_args ()
157 extern void tic6x_init_after_args (void);
158
159 #define tc_unrecognized_line(c) tic6x_unrecognized_line (c)
160 extern int tic6x_unrecognized_line (int c);