]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gas/config/tc-mmix.h
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / gas / config / tc-mmix.h
CommitLineData
3c3bdf30 1/* tc-mmix.h -- Header file for tc-mmix.c.
250d07de 2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3c3bdf30
NC
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
ec2655a6 9 the Free Software Foundation; either version 3, or (at your option)
3c3bdf30
NC
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
4b4da160
NC
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
3c3bdf30
NC
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
29extern const char mmix_comment_chars[];
30#define tc_comment_chars mmix_comment_chars
31
32extern const char mmix_symbol_chars[];
33#define tc_symbol_chars mmix_symbol_chars
34
3c3bdf30
NC
35/* "@" is a synonym for ".". */
36#define LEX_AT (LEX_BEGIN_NAME)
37
ff1e783f 38extern int mmix_label_without_colon_this_line (void);
3c3bdf30
NC
39#define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line ()
40
41extern int mmix_next_semicolon_is_eoln;
42#define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln)
43
44/* This is one direction we can get mmixal compatibility. */
ff1e783f 45extern void mmix_handle_mmixal (void);
3c3bdf30
NC
46#define md_start_line_hook mmix_handle_mmixal
47
ff1e783f 48extern void mmix_md_begin (void);
3c3bdf30
NC
49#define md_begin mmix_md_begin
50
ff1e783f 51extern void mmix_md_end (void);
3c3bdf30
NC
52#define md_end mmix_md_end
53
54extern int mmix_current_location \
ff1e783f
HPN
55 (void (*fn) (expressionS *), expressionS *);
56extern int mmix_parse_predefined_name (char *, expressionS *);
3c3bdf30
NC
57
58extern char *mmix_current_prefix;
59
60/* A bit ugly, since we "know" that there's a static function
61 current_location that does what we want. We also strip off a leading
62 ':' in another ugly way.
63
64 The [DVWIOUZX]_Handler symbols are provided when-used. */
65
66extern int mmix_gnu_syntax;
9497f5ac 67#define md_parse_name(name, exp, mode, cpos) \
3c3bdf30
NC
68 (! mmix_gnu_syntax \
69 && (name[0] == '@' \
70 ? (! is_part_of_name (name[1]) \
71 && mmix_current_location (current_location, exp)) \
973eb340 72 : ((name[0] == ':' || ISUPPER (name[0])) \
3c3bdf30
NC
73 && mmix_parse_predefined_name (name, exp))))
74
ff1e783f 75extern char *mmix_prefix_name (char *);
3c3bdf30
NC
76
77/* We implement when *creating* a symbol, we also need to strip a ':' or
78 prepend a prefix. */
79#define tc_canonicalize_symbol_name(x) \
80 (mmix_current_prefix == NULL && (x)[0] != ':' ? (x) : mmix_prefix_name (x))
81
82#define md_undefined_symbol(x) NULL
83
ff1e783f 84extern void mmix_fb_label (expressionS *);
3c3bdf30
NC
85
86/* Since integer_constant is local to expr.c, we have to make this a
87 macro. FIXME: Do it cleaner. */
88#define md_operand(exp) \
a1b6236b 89 do \
3c3bdf30 90 { \
a1b6236b
KH
91 if (input_line_pointer[0] == '#') \
92 { \
93 input_line_pointer++; \
94 integer_constant (16, (exp)); \
95 } \
96 else if (input_line_pointer[0] == '&' \
97 && input_line_pointer[1] != '&') \
98 as_bad (_("`&' serial number operator is not supported")); \
99 else \
100 mmix_fb_label (exp); \
3c3bdf30 101 } \
a1b6236b 102 while (0)
3c3bdf30
NC
103
104/* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in
105 the error-recovery loop. Hopefully there are no significant
106 differences. Also, space on a line isn't gracefully handled. */
ff1e783f 107extern int mmix_assemble_return_nonzero (char *);
3c3bdf30
NC
108#define tc_unrecognized_line(c) \
109 ((c) == ' ' \
110 || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8') \
111 && mmix_assemble_return_nonzero (input_line_pointer - 1)))
112
113#define md_number_to_chars number_to_chars_bigendian
114
115#define WORKING_DOT_WORD
116
117extern const struct relax_type mmix_relax_table[];
118#define TC_GENERIC_RELAX_TABLE mmix_relax_table
119
88fc725d 120/* We use the relax table for everything except the GREG frags and PUSHJ. */
ff1e783f 121extern long mmix_md_relax_frag (segT, fragS *, long);
3c3bdf30
NC
122#define md_relax_frag mmix_md_relax_frag
123
a161fe53
AM
124#define tc_fix_adjustable(FIX) \
125 (((FIX)->fx_addsy == NULL \
126 || S_GET_SEGMENT ((FIX)->fx_addsy) != reg_section) \
127 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
128 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
129 && (FIX)->fx_r_type != BFD_RELOC_MMIX_LOCAL)
3c3bdf30
NC
130
131/* Adjust symbols which are registers. */
132#define tc_adjust_symtab() mmix_adjust_symtab ()
ff1e783f 133extern void mmix_adjust_symtab (void);
3c3bdf30 134
a161fe53 135/* Here's where we make all symbols global, when so requested.
3c3bdf30
NC
136 We must avoid doing that for expression symbols or section symbols,
137 though. */
138extern int mmix_globalize_symbols;
a1b6236b
KH
139#define tc_frob_symbol(sym, punt) \
140 do \
141 { \
a161fe53
AM
142 if (S_GET_SEGMENT (sym) == reg_section) \
143 { \
144 if (S_GET_NAME (sym)[0] != '$' \
145 && S_GET_VALUE (sym) < 256) \
146 { \
147 if (mmix_globalize_symbols) \
148 S_SET_EXTERNAL (sym); \
149 else \
150 symbol_mark_used_in_reloc (sym); \
151 } \
152 } \
153 else if (mmix_globalize_symbols \
154 && ! symbol_section_p (sym) \
155 && sym != section_symbol (absolute_section) \
156 && ! S_IS_LOCAL (sym)) \
a1b6236b
KH
157 S_SET_EXTERNAL (sym); \
158 } \
159 while (0)
3c3bdf30 160
a161fe53
AM
161/* No shared lib support, so we don't need to ensure externally
162 visible symbols can be overridden. */
163#define EXTERN_FORCE_RELOC 0
164
3c3bdf30
NC
165/* When relaxing, we need to emit various relocs we otherwise wouldn't. */
166#define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix)
ff1e783f 167extern int mmix_force_relocation (struct fix *);
3c3bdf30
NC
168
169/* Call md_pcrel_from_section(), not md_pcrel_from(). */
a161fe53 170#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
3c3bdf30 171
3c3bdf30
NC
172#define md_section_align(seg, size) (size)
173
174#define LISTING_HEADER "GAS for MMIX"
175
176/* The default of 4 means Bcc expansion looks like it's missing a line. */
177#define LISTING_LHS_CONT_LINES 5
178
179extern fragS *mmix_opcode_frag;
180#define TC_FRAG_TYPE fragS *
db222310 181#define TC_FRAG_INIT(frag, max_bytes) (frag)->tc_frag_data = mmix_opcode_frag
3c3bdf30
NC
182
183/* We need to associate each section symbol with a list of GREGs defined
184 for that section/segment and sorted on offset, between the point where
185 all symbols have been evaluated and all frags mapped, and when the
186 fixups are done and relocs are output. Similarly for each unknown
187 symbol. */
ff1e783f 188extern void mmix_frob_file (void);
6c106515
HPN
189#define tc_frob_file_before_fix() \
190 do \
191 { \
192 int i = 0; \
193 \
194 /* It's likely mmix_frob_file changed (removed) sections, so make \
195 sure sections are correctly numbered as per renumber_sections, \
196 (static to write.c where this macro is called). */ \
197 mmix_frob_file (); \
198 bfd_map_over_sections (stdoutput, renumber_sections, &i); \
199 } \
200 while (0)
3c3bdf30
NC
201
202/* Used by mmix_frob_file. Hangs on section symbols and unknown symbols. */
203struct mmix_symbol_gregs;
204#define TC_SYMFIELD_TYPE struct mmix_symbol_gregs *
205
88fc725d
HPN
206/* Used by relaxation, counting maximum needed PUSHJ stubs for a section. */
207struct mmix_segment_info_type
208 {
209 /* We only need to keep track of the last stubbable frag because
210 there's no less hackish way to keep track of different relaxation
211 rounds. */
212 fragS *last_stubfrag;
213 bfd_size_type nstubs;
214 };
215#define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type
216
ff1e783f 217extern void mmix_md_elf_section_change_hook (void);
3c3bdf30
NC
218#define md_elf_section_change_hook mmix_md_elf_section_change_hook
219
ff1e783f 220extern void mmix_md_do_align (int, char *, int, int);
3c3bdf30
NC
221#define md_do_align(n, fill, len, max, label) \
222 mmix_md_do_align (n, fill, len, max)
223
224/* Each insn is a tetrabyte (4 bytes) long, but if there are BYTE
225 sequences sprinkled in, we can get unaligned DWARF2 offsets, so let's
226 explicitly say one byte. */
227#define DWARF2_LINE_MIN_INSN_LENGTH 1
d31f0f6d 228
97c4f2d9
L
229/* MMIX has global register symbols. */
230#define TC_GLOBAL_REGISTER_SYMBOL_OK
b1766e7c 231
64d05a43 232#define md_single_noop_insn "swym 0"