1 |
16 |
khays |
/* tc-mmix.h -- Header file for tc-mmix.c.
|
2 |
|
|
Copyright (C) 2001, 2002, 2003, 2005, 2007, 2008
|
3 |
|
|
Free Software Foundation, Inc.
|
4 |
|
|
Written by Hans-Peter Nilsson (hp@bitrange.com).
|
5 |
|
|
|
6 |
|
|
This file is part of GAS, the GNU Assembler.
|
7 |
|
|
|
8 |
|
|
GAS is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
11 |
|
|
any later version.
|
12 |
|
|
|
13 |
|
|
GAS is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
20 |
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
21 |
|
|
02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#define TC_MMIX
|
24 |
|
|
|
25 |
|
|
/* See gas/doc/internals.texi for explanation of these macros. */
|
26 |
|
|
#define TARGET_FORMAT "elf64-mmix"
|
27 |
|
|
#define TARGET_ARCH bfd_arch_mmix
|
28 |
|
|
#define TARGET_BYTES_BIG_ENDIAN 1
|
29 |
|
|
|
30 |
|
|
extern const char mmix_comment_chars[];
|
31 |
|
|
#define tc_comment_chars mmix_comment_chars
|
32 |
|
|
|
33 |
|
|
extern const char mmix_symbol_chars[];
|
34 |
|
|
#define tc_symbol_chars mmix_symbol_chars
|
35 |
|
|
|
36 |
|
|
extern const char mmix_exp_chars[];
|
37 |
|
|
#define EXP_CHARS mmix_exp_chars
|
38 |
|
|
|
39 |
|
|
extern const char mmix_flt_chars[];
|
40 |
|
|
#define FLT_CHARS mmix_flt_chars
|
41 |
|
|
|
42 |
|
|
/* "@" is a synonym for ".". */
|
43 |
|
|
#define LEX_AT (LEX_BEGIN_NAME)
|
44 |
|
|
|
45 |
|
|
extern int mmix_label_without_colon_this_line (void);
|
46 |
|
|
#define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line ()
|
47 |
|
|
|
48 |
|
|
extern int mmix_next_semicolon_is_eoln;
|
49 |
|
|
#define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln)
|
50 |
|
|
|
51 |
|
|
/* This is one direction we can get mmixal compatibility. */
|
52 |
|
|
extern void mmix_handle_mmixal (void);
|
53 |
|
|
#define md_start_line_hook mmix_handle_mmixal
|
54 |
|
|
|
55 |
|
|
extern void mmix_md_begin (void);
|
56 |
|
|
#define md_begin mmix_md_begin
|
57 |
|
|
|
58 |
|
|
extern void mmix_md_end (void);
|
59 |
|
|
#define md_end mmix_md_end
|
60 |
|
|
|
61 |
|
|
extern int mmix_current_location \
|
62 |
|
|
(void (*fn) (expressionS *), expressionS *);
|
63 |
|
|
extern int mmix_parse_predefined_name (char *, expressionS *);
|
64 |
|
|
|
65 |
|
|
extern char *mmix_current_prefix;
|
66 |
|
|
|
67 |
|
|
/* A bit ugly, since we "know" that there's a static function
|
68 |
|
|
current_location that does what we want. We also strip off a leading
|
69 |
|
|
':' in another ugly way.
|
70 |
|
|
|
71 |
|
|
The [DVWIOUZX]_Handler symbols are provided when-used. */
|
72 |
|
|
|
73 |
|
|
extern int mmix_gnu_syntax;
|
74 |
|
|
#define md_parse_name(name, exp, mode, cpos) \
|
75 |
|
|
(! mmix_gnu_syntax \
|
76 |
|
|
&& (name[0] == '@' \
|
77 |
|
|
? (! is_part_of_name (name[1]) \
|
78 |
|
|
&& mmix_current_location (current_location, exp)) \
|
79 |
|
|
: ((name[0] == ':' || ISUPPER (name[0])) \
|
80 |
|
|
&& mmix_parse_predefined_name (name, exp))))
|
81 |
|
|
|
82 |
|
|
extern char *mmix_prefix_name (char *);
|
83 |
|
|
|
84 |
|
|
/* We implement when *creating* a symbol, we also need to strip a ':' or
|
85 |
|
|
prepend a prefix. */
|
86 |
|
|
#define tc_canonicalize_symbol_name(x) \
|
87 |
|
|
(mmix_current_prefix == NULL && (x)[0] != ':' ? (x) : mmix_prefix_name (x))
|
88 |
|
|
|
89 |
|
|
#define md_undefined_symbol(x) NULL
|
90 |
|
|
|
91 |
|
|
extern void mmix_fb_label (expressionS *);
|
92 |
|
|
|
93 |
|
|
/* Since integer_constant is local to expr.c, we have to make this a
|
94 |
|
|
macro. FIXME: Do it cleaner. */
|
95 |
|
|
#define md_operand(exp) \
|
96 |
|
|
do \
|
97 |
|
|
{ \
|
98 |
|
|
if (input_line_pointer[0] == '#') \
|
99 |
|
|
{ \
|
100 |
|
|
input_line_pointer++; \
|
101 |
|
|
integer_constant (16, (exp)); \
|
102 |
|
|
} \
|
103 |
|
|
else if (input_line_pointer[0] == '&' \
|
104 |
|
|
&& input_line_pointer[1] != '&') \
|
105 |
|
|
as_bad (_("`&' serial number operator is not supported")); \
|
106 |
|
|
else \
|
107 |
|
|
mmix_fb_label (exp); \
|
108 |
|
|
} \
|
109 |
|
|
while (0)
|
110 |
|
|
|
111 |
|
|
/* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in
|
112 |
|
|
the error-recovery loop. Hopefully there are no significant
|
113 |
|
|
differences. Also, space on a line isn't gracefully handled. */
|
114 |
|
|
extern int mmix_assemble_return_nonzero (char *);
|
115 |
|
|
#define tc_unrecognized_line(c) \
|
116 |
|
|
((c) == ' ' \
|
117 |
|
|
|| (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8') \
|
118 |
|
|
&& mmix_assemble_return_nonzero (input_line_pointer - 1)))
|
119 |
|
|
|
120 |
|
|
#define md_number_to_chars number_to_chars_bigendian
|
121 |
|
|
|
122 |
|
|
#define WORKING_DOT_WORD
|
123 |
|
|
|
124 |
|
|
extern const struct relax_type mmix_relax_table[];
|
125 |
|
|
#define TC_GENERIC_RELAX_TABLE mmix_relax_table
|
126 |
|
|
|
127 |
|
|
/* We use the relax table for everything except the GREG frags and PUSHJ. */
|
128 |
|
|
extern long mmix_md_relax_frag (segT, fragS *, long);
|
129 |
|
|
#define md_relax_frag mmix_md_relax_frag
|
130 |
|
|
|
131 |
|
|
#define tc_fix_adjustable(FIX) \
|
132 |
|
|
(((FIX)->fx_addsy == NULL \
|
133 |
|
|
|| S_GET_SEGMENT ((FIX)->fx_addsy) != reg_section) \
|
134 |
|
|
&& (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
|
135 |
|
|
&& (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
|
136 |
|
|
&& (FIX)->fx_r_type != BFD_RELOC_MMIX_LOCAL)
|
137 |
|
|
|
138 |
|
|
/* Adjust symbols which are registers. */
|
139 |
|
|
#define tc_adjust_symtab() mmix_adjust_symtab ()
|
140 |
|
|
extern void mmix_adjust_symtab (void);
|
141 |
|
|
|
142 |
|
|
/* Here's where we make all symbols global, when so requested.
|
143 |
|
|
We must avoid doing that for expression symbols or section symbols,
|
144 |
|
|
though. */
|
145 |
|
|
extern int mmix_globalize_symbols;
|
146 |
|
|
#define tc_frob_symbol(sym, punt) \
|
147 |
|
|
do \
|
148 |
|
|
{ \
|
149 |
|
|
if (S_GET_SEGMENT (sym) == reg_section) \
|
150 |
|
|
{ \
|
151 |
|
|
if (S_GET_NAME (sym)[0] != '$' \
|
152 |
|
|
&& S_GET_VALUE (sym) < 256) \
|
153 |
|
|
{ \
|
154 |
|
|
if (mmix_globalize_symbols) \
|
155 |
|
|
S_SET_EXTERNAL (sym); \
|
156 |
|
|
else \
|
157 |
|
|
symbol_mark_used_in_reloc (sym); \
|
158 |
|
|
} \
|
159 |
|
|
} \
|
160 |
|
|
else if (mmix_globalize_symbols \
|
161 |
|
|
&& ! symbol_section_p (sym) \
|
162 |
|
|
&& sym != section_symbol (absolute_section) \
|
163 |
|
|
&& ! S_IS_LOCAL (sym)) \
|
164 |
|
|
S_SET_EXTERNAL (sym); \
|
165 |
|
|
} \
|
166 |
|
|
while (0)
|
167 |
|
|
|
168 |
|
|
/* No shared lib support, so we don't need to ensure externally
|
169 |
|
|
visible symbols can be overridden. */
|
170 |
|
|
#define EXTERN_FORCE_RELOC 0
|
171 |
|
|
|
172 |
|
|
/* When relaxing, we need to emit various relocs we otherwise wouldn't. */
|
173 |
|
|
#define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix)
|
174 |
|
|
extern int mmix_force_relocation (struct fix *);
|
175 |
|
|
|
176 |
|
|
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
|
177 |
|
|
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
|
178 |
|
|
extern long md_pcrel_from_section (struct fix *, segT);
|
179 |
|
|
|
180 |
|
|
#define md_section_align(seg, size) (size)
|
181 |
|
|
|
182 |
|
|
#define LISTING_HEADER "GAS for MMIX"
|
183 |
|
|
|
184 |
|
|
/* The default of 4 means Bcc expansion looks like it's missing a line. */
|
185 |
|
|
#define LISTING_LHS_CONT_LINES 5
|
186 |
|
|
|
187 |
|
|
extern fragS *mmix_opcode_frag;
|
188 |
|
|
#define TC_FRAG_TYPE fragS *
|
189 |
|
|
#define TC_FRAG_INIT(frag) (frag)->tc_frag_data = mmix_opcode_frag
|
190 |
|
|
|
191 |
|
|
/* We need to associate each section symbol with a list of GREGs defined
|
192 |
|
|
for that section/segment and sorted on offset, between the point where
|
193 |
|
|
all symbols have been evaluated and all frags mapped, and when the
|
194 |
|
|
fixups are done and relocs are output. Similarly for each unknown
|
195 |
|
|
symbol. */
|
196 |
|
|
extern void mmix_frob_file (void);
|
197 |
|
|
#define tc_frob_file_before_fix mmix_frob_file
|
198 |
|
|
|
199 |
|
|
/* Used by mmix_frob_file. Hangs on section symbols and unknown symbols. */
|
200 |
|
|
struct mmix_symbol_gregs;
|
201 |
|
|
#define TC_SYMFIELD_TYPE struct mmix_symbol_gregs *
|
202 |
|
|
|
203 |
|
|
/* Used by relaxation, counting maximum needed PUSHJ stubs for a section. */
|
204 |
|
|
struct mmix_segment_info_type
|
205 |
|
|
{
|
206 |
|
|
/* We only need to keep track of the last stubbable frag because
|
207 |
|
|
there's no less hackish way to keep track of different relaxation
|
208 |
|
|
rounds. */
|
209 |
|
|
fragS *last_stubfrag;
|
210 |
|
|
bfd_size_type nstubs;
|
211 |
|
|
};
|
212 |
|
|
#define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type
|
213 |
|
|
|
214 |
|
|
extern void mmix_md_elf_section_change_hook (void);
|
215 |
|
|
#define md_elf_section_change_hook mmix_md_elf_section_change_hook
|
216 |
|
|
|
217 |
|
|
extern void mmix_md_do_align (int, char *, int, int);
|
218 |
|
|
#define md_do_align(n, fill, len, max, label) \
|
219 |
|
|
mmix_md_do_align (n, fill, len, max)
|
220 |
|
|
|
221 |
|
|
/* Each insn is a tetrabyte (4 bytes) long, but if there are BYTE
|
222 |
|
|
sequences sprinkled in, we can get unaligned DWARF2 offsets, so let's
|
223 |
|
|
explicitly say one byte. */
|
224 |
|
|
#define DWARF2_LINE_MIN_INSN_LENGTH 1
|
225 |
|
|
|
226 |
|
|
/* This target is buggy, and sets fix size too large. */
|
227 |
|
|
#define TC_FX_SIZE_SLACK(FIX) 6
|
228 |
|
|
|
229 |
|
|
/* MMIX has global register symbols. */
|
230 |
|
|
#define TC_GLOBAL_REGISTER_SYMBOL_OK
|