* config/tc-xtensa.c (insn_labels, free_insn_labels, saved_insn_labels,
[deliverable/binutils-gdb.git] / gas / config / tc-xtensa.h
1 /* tc-xtensa.h -- Header file for tc-xtensa.c.
2 Copyright (C) 2003 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 2, 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, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
20
21 #ifndef TC_XTENSA
22 #define TC_XTENSA 1
23
24 #ifdef ANSI_PROTOTYPES
25 struct fix;
26 #endif
27
28 #ifndef BFD_ASSEMBLER
29 #error Xtensa support requires BFD_ASSEMBLER
30 #endif
31
32 #ifndef OBJ_ELF
33 #error Xtensa support requires ELF object format
34 #endif
35
36 #include "xtensa-config.h"
37
38 #define TARGET_BYTES_BIG_ENDIAN XCHAL_HAVE_BE
39
40
41 struct xtensa_frag_type
42 {
43 unsigned is_literal:1;
44 unsigned is_text:1;
45 unsigned is_loop_target:1;
46 unsigned is_branch_target:1;
47 unsigned is_insn:1;
48
49 /* Info about the current state of assembly, i.e., density, relax,
50 generics, freeregs, longcalls. These need to be passed to the
51 backend and then to the linking file. */
52
53 unsigned is_no_density:1;
54 unsigned is_relax:1;
55 unsigned is_generics:1;
56 unsigned is_longcalls:1;
57
58 /* For text fragments that can generate literals at relax time, this
59 variable points to the frag where the literal will be stored. For
60 literal frags, this variable points to the nearest literal pool
61 location frag. This literal frag will be moved to after this
62 location. */
63
64 fragS *literal_frag;
65
66 /* The destination segment for literal frags. (Note that this is only
67 valid after xtensa_move_literals. */
68
69 segT lit_seg;
70
71 /* For the relaxation scheme, some literal fragments can have their
72 expansions modified by an instruction that relaxes. */
73
74 unsigned text_expansion;
75 unsigned literal_expansion;
76 unsigned unreported_expansion;
77 };
78
79 typedef struct xtensa_block_info_struct
80 {
81 segT sec;
82 bfd_vma offset;
83 size_t size;
84 struct xtensa_block_info_struct *next;
85 } xtensa_block_info;
86
87 typedef enum
88 {
89 xt_insn_sec,
90 xt_literal_sec,
91 max_xt_sec
92 } xt_section_type;
93
94 typedef struct xtensa_segment_info_struct
95 {
96 fragS *literal_pool_loc;
97 xtensa_block_info *blocks[max_xt_sec];
98 } xtensa_segment_info;
99
100 typedef struct xtensa_symfield_type_struct
101 {
102 unsigned int plt : 1;
103 unsigned int is_loop_target : 1;
104 unsigned int is_branch_target : 1;
105 } xtensa_symfield_type;
106
107
108 /* Section renaming is only supported in Tensilica's version of GAS. */
109 #define XTENSA_SECTION_RENAME 1
110 #ifdef XTENSA_SECTION_RENAME
111 extern const char *xtensa_section_rename
112 PARAMS ((const char *));
113 #else
114 /* Tensilica's section renaming feature is not included here. */
115 #define xtensa_section_rename(name) (name)
116 #endif /* XTENSA_SECTION_RENAME */
117
118
119 extern const char *xtensa_target_format
120 PARAMS ((void));
121 extern void xtensa_frag_init
122 PARAMS ((fragS *));
123 extern void xtensa_cons_fix_new
124 PARAMS ((fragS *, int, int, expressionS *));
125 extern void xtensa_frob_label
126 PARAMS ((struct symbol *));
127 extern void xtensa_end
128 PARAMS ((void));
129 extern void xtensa_post_relax_hook
130 PARAMS ((void));
131 extern void xtensa_file_arch_init
132 PARAMS ((bfd *));
133 extern void xtensa_flush_pending_output
134 PARAMS ((void));
135 extern bfd_boolean xtensa_fix_adjustable
136 PARAMS ((struct fix *));
137 extern void xtensa_symbol_new_hook
138 PARAMS ((symbolS *));
139 extern long xtensa_relax_frag
140 PARAMS ((fragS *, long, int *));
141
142 #define TARGET_FORMAT xtensa_target_format ()
143 #define TARGET_ARCH bfd_arch_xtensa
144 #define TC_SEGMENT_INFO_TYPE xtensa_segment_info
145 #define TC_SYMFIELD_TYPE xtensa_symfield_type
146 #define TC_FRAG_TYPE struct xtensa_frag_type
147 #define TC_FRAG_INIT(frag) xtensa_frag_init (frag)
148 #define TC_CONS_FIX_NEW xtensa_cons_fix_new
149 #define tc_canonicalize_symbol_name(s) xtensa_section_rename (s)
150 #define tc_init_after_args() xtensa_file_arch_init (stdoutput)
151 #define tc_fix_adjustable(fix) xtensa_fix_adjustable (fix)
152 #define tc_frob_label(sym) xtensa_frob_label (sym)
153 #define tc_symbol_new_hook(s) xtensa_symbol_new_hook (s)
154 #define md_elf_section_rename(name) xtensa_section_rename (name)
155 #define md_end xtensa_end
156 #define md_flush_pending_output() xtensa_flush_pending_output ()
157 #define md_operand(x)
158 #define TEXT_SECTION_NAME xtensa_section_rename (".text")
159 #define DATA_SECTION_NAME xtensa_section_rename (".data")
160 #define BSS_SECTION_NAME xtensa_section_rename (".bss")
161
162
163 /* The renumber_section function must be mapped over all the sections
164 after calling xtensa_post_relax_hook. That function is static in
165 write.c so it cannot be called from xtensa_post_relax_hook itself. */
166
167 #define md_post_relax_hook \
168 do \
169 { \
170 int i = 0; \
171 xtensa_post_relax_hook (); \
172 bfd_map_over_sections (stdoutput, renumber_sections, &i); \
173 } \
174 while (0)
175
176
177 /* Because xtensa relaxation can insert a new literal into the middle of
178 fragment and thus require re-running the relaxation pass on the
179 section, we need an explicit flag here. We explicitly use the name
180 "stretched" here to avoid changing the source code in write.c. */
181
182 #define md_relax_frag(segment, fragP, stretch) \
183 xtensa_relax_frag (fragP, stretch, &stretched)
184
185
186 #define LOCAL_LABELS_FB 1
187 #define WORKING_DOT_WORD 1
188 #define DOUBLESLASH_LINE_COMMENTS
189 #define TC_HANDLES_FX_DONE
190 #define TC_FINALIZE_SYMS_BEFORE_SIZE_SEG 0
191
192 #define MD_APPLY_SYM_VALUE(FIX) 0
193
194 #endif /* TC_XTENSA */
This page took 0.035991 seconds and 4 git commands to generate.