Commit | Line | Data |
---|---|---|
3c3bdf30 NC |
1 | /* tc-mmix.h -- Header file for tc-mmix.c. |
2 | Copyright (C) 2001 Free Software Foundation, Inc. | |
3 | Written by Hans-Peter Nilsson (hp@bitrange.com). | |
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 2, 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, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #define TC_MMIX | |
23 | ||
24 | /* See gas/doc/internals.texi for explanation of these macros. */ | |
25 | #define TARGET_FORMAT "elf64-mmix" | |
26 | #define TARGET_ARCH bfd_arch_mmix | |
27 | #define TARGET_BYTES_BIG_ENDIAN 1 | |
28 | ||
29 | extern const char mmix_comment_chars[]; | |
30 | #define tc_comment_chars mmix_comment_chars | |
31 | ||
32 | extern const char mmix_symbol_chars[]; | |
33 | #define tc_symbol_chars mmix_symbol_chars | |
34 | ||
35 | extern const char mmix_exp_chars[]; | |
36 | #define EXP_CHARS mmix_exp_chars | |
37 | ||
38 | extern const char mmix_flt_chars[]; | |
39 | #define FLT_CHARS mmix_flt_chars | |
40 | ||
41 | /* "@" is a synonym for ".". */ | |
42 | #define LEX_AT (LEX_BEGIN_NAME) | |
43 | ||
44 | extern int mmix_label_without_colon_this_line PARAMS ((void)); | |
45 | #define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line () | |
46 | ||
47 | extern int mmix_next_semicolon_is_eoln; | |
48 | #define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln) | |
49 | ||
50 | /* This is one direction we can get mmixal compatibility. */ | |
51 | extern void mmix_handle_mmixal PARAMS ((void)); | |
52 | #define md_start_line_hook mmix_handle_mmixal | |
53 | ||
54 | extern void mmix_md_begin PARAMS ((void)); | |
55 | #define md_begin mmix_md_begin | |
56 | ||
57 | extern void mmix_md_end PARAMS ((void)); | |
58 | #define md_end mmix_md_end | |
59 | ||
60 | extern int mmix_current_location \ | |
61 | PARAMS ((void (*fn) (expressionS *), expressionS *)); | |
62 | extern int mmix_parse_predefined_name PARAMS ((char *, expressionS *)); | |
63 | ||
64 | extern char *mmix_current_prefix; | |
65 | ||
66 | /* A bit ugly, since we "know" that there's a static function | |
67 | current_location that does what we want. We also strip off a leading | |
68 | ':' in another ugly way. | |
69 | ||
70 | The [DVWIOUZX]_Handler symbols are provided when-used. */ | |
71 | ||
72 | extern int mmix_gnu_syntax; | |
73 | #define md_parse_name(name, exp, cpos) \ | |
74 | (! mmix_gnu_syntax \ | |
75 | && (name[0] == '@' \ | |
76 | ? (! is_part_of_name (name[1]) \ | |
77 | && mmix_current_location (current_location, exp)) \ | |
78 | : ((name[0] == ':' || isupper (name[0])) \ | |
79 | && mmix_parse_predefined_name (name, exp)))) | |
80 | ||
81 | extern char *mmix_prefix_name PARAMS ((char *)); | |
82 | ||
83 | /* We implement when *creating* a symbol, we also need to strip a ':' or | |
84 | prepend a prefix. */ | |
85 | #define tc_canonicalize_symbol_name(x) \ | |
86 | (mmix_current_prefix == NULL && (x)[0] != ':' ? (x) : mmix_prefix_name (x)) | |
87 | ||
88 | #define md_undefined_symbol(x) NULL | |
89 | ||
90 | extern void mmix_fb_label PARAMS ((expressionS *)); | |
91 | ||
92 | /* Since integer_constant is local to expr.c, we have to make this a | |
93 | macro. FIXME: Do it cleaner. */ | |
94 | #define md_operand(exp) \ | |
95 | do { \ | |
96 | if (input_line_pointer[0] == '#') \ | |
97 | { \ | |
98 | input_line_pointer++; \ | |
99 | integer_constant (16, (exp)); \ | |
100 | } \ | |
101 | else if (input_line_pointer[0] == '&' \ | |
102 | && input_line_pointer[1] != '&') \ | |
103 | as_bad (_("`&' serial number operator is not supported")); \ | |
104 | else \ | |
105 | mmix_fb_label (exp); \ | |
106 | } while (0) | |
107 | ||
108 | ||
109 | /* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in | |
110 | the error-recovery loop. Hopefully there are no significant | |
111 | differences. Also, space on a line isn't gracefully handled. */ | |
112 | extern int mmix_assemble_return_nonzero PARAMS ((char *)); | |
113 | #define tc_unrecognized_line(c) \ | |
114 | ((c) == ' ' \ | |
115 | || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8') \ | |
116 | && mmix_assemble_return_nonzero (input_line_pointer - 1))) | |
117 | ||
118 | #define md_number_to_chars number_to_chars_bigendian | |
119 | ||
120 | #define WORKING_DOT_WORD | |
121 | ||
122 | extern const struct relax_type mmix_relax_table[]; | |
123 | #define TC_GENERIC_RELAX_TABLE mmix_relax_table | |
124 | ||
125 | /* We use the relax table for everything except the GREG frags. */ | |
126 | extern long mmix_md_relax_frag PARAMS ((segT, fragS *, long)); | |
127 | #define md_relax_frag mmix_md_relax_frag | |
128 | ||
129 | #define tc_fix_adjustable(X) \ | |
130 | ((! (X)->fx_addsy \ | |
131 | || (! S_IS_WEAK ((X)->fx_addsy) \ | |
132 | && S_GET_SEGMENT ((X)->fx_addsy) != reg_section)) \ | |
133 | && (X)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \ | |
134 | && (X)->fx_r_type != BFD_RELOC_VTABLE_ENTRY) | |
135 | ||
136 | /* Adjust symbols which are registers. */ | |
137 | #define tc_adjust_symtab() mmix_adjust_symtab () | |
138 | extern void mmix_adjust_symtab PARAMS ((void)); | |
139 | ||
140 | /* Avoid outputting GAS register section symbols. This happens when the | |
141 | assembly had errors, and will propagate to an assert in BFD. FIXME: | |
142 | It seems the symbol output when-errors is a bug in GAS. Fix that | |
143 | some time. See also tc_gen_reloc. | |
144 | ||
145 | Here's where we make all symbols global, when so requested. | |
146 | We must avoid doing that for expression symbols or section symbols, | |
147 | though. */ | |
148 | extern int mmix_globalize_symbols; | |
149 | #define tc_frob_symbol(sym, punt) \ | |
150 | do { \ | |
151 | if (S_GET_SEGMENT (sym) == reg_section \ | |
152 | || (symp) == section_symbol (absolute_section)) \ | |
153 | (punt) = 1; \ | |
154 | \ | |
155 | if (mmix_globalize_symbols \ | |
156 | && ! symbol_section_p (sym) \ | |
157 | && symp != section_symbol (absolute_section) \ | |
158 | && (! S_IS_LOCAL (sym) \ | |
159 | || S_GET_SEGMENT (sym) == reg_section) \ | |
160 | && (S_GET_SEGMENT (sym) != reg_section \ | |
161 | || (S_GET_NAME (sym)[0] != '$' \ | |
162 | && S_GET_VALUE (sym) < 256))) \ | |
163 | S_SET_EXTERNAL (sym); \ | |
164 | } while (0) | |
165 | ||
166 | /* When relaxing, we need to emit various relocs we otherwise wouldn't. */ | |
167 | #define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix) | |
168 | extern int mmix_force_relocation PARAMS ((struct fix *)); | |
169 | ||
170 | /* Call md_pcrel_from_section(), not md_pcrel_from(). */ | |
171 | #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) | |
172 | extern long md_pcrel_from_section PARAMS ((struct fix *, segT)); | |
173 | ||
3c3bdf30 NC |
174 | #define md_section_align(seg, size) (size) |
175 | ||
176 | #define LISTING_HEADER "GAS for MMIX" | |
177 | ||
178 | /* The default of 4 means Bcc expansion looks like it's missing a line. */ | |
179 | #define LISTING_LHS_CONT_LINES 5 | |
180 | ||
181 | extern fragS *mmix_opcode_frag; | |
182 | #define TC_FRAG_TYPE fragS * | |
183 | #define TC_FRAG_INIT(frag) (frag)->tc_frag_data = mmix_opcode_frag | |
184 | ||
185 | /* We need to associate each section symbol with a list of GREGs defined | |
186 | for that section/segment and sorted on offset, between the point where | |
187 | all symbols have been evaluated and all frags mapped, and when the | |
188 | fixups are done and relocs are output. Similarly for each unknown | |
189 | symbol. */ | |
190 | extern void mmix_frob_file PARAMS ((void)); | |
191 | #define tc_frob_file mmix_frob_file | |
192 | ||
193 | /* Used by mmix_frob_file. Hangs on section symbols and unknown symbols. */ | |
194 | struct mmix_symbol_gregs; | |
195 | #define TC_SYMFIELD_TYPE struct mmix_symbol_gregs * | |
196 | ||
197 | extern void mmix_frob_file_before_adjust PARAMS ((void)); | |
198 | #define tc_frob_file_before_adjust mmix_frob_file_before_adjust | |
199 | ||
200 | extern void mmix_md_elf_section_change_hook PARAMS ((void)); | |
201 | #define md_elf_section_change_hook mmix_md_elf_section_change_hook | |
202 | ||
203 | extern void mmix_md_do_align PARAMS ((int, char *, int, int)); | |
204 | #define md_do_align(n, fill, len, max, label) \ | |
205 | mmix_md_do_align (n, fill, len, max) | |
206 | ||
207 | /* Each insn is a tetrabyte (4 bytes) long, but if there are BYTE | |
208 | sequences sprinkled in, we can get unaligned DWARF2 offsets, so let's | |
209 | explicitly say one byte. */ | |
210 | #define DWARF2_LINE_MIN_INSN_LENGTH 1 |