1 /* tc-mmix.h -- Header file for tc-mmix.c.
2 Copyright (C) 2001-2024 Free Software Foundation, Inc.
3 Written by Hans-Peter Nilsson (hp@bitrange.com).
5 This file is part of GAS, the GNU Assembler.
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)
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.
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
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
29 extern const char mmix_symbol_chars
[];
30 #define tc_symbol_chars mmix_symbol_chars
32 /* "@" is a synonym for ".". */
33 #define LEX_AT (LEX_BEGIN_NAME)
35 extern int mmix_label_without_colon_this_line (void);
36 #define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line ()
38 extern int mmix_next_semicolon_is_eoln
;
39 #define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln)
41 /* This is one direction we can get mmixal compatibility. */
42 extern void mmix_handle_mmixal (void);
43 #define md_start_line_hook mmix_handle_mmixal
45 extern void mmix_md_begin (void);
46 #define md_begin mmix_md_begin
48 extern void mmix_md_finish (void);
49 #define md_finish mmix_md_finish
51 extern int mmix_parse_predefined_name (char *, expressionS
*);
53 extern char *mmix_current_prefix
;
55 /* Besides the special casing of "@" we also strip off a leading ':' in an
58 The [DVWIOUZX]_Handler symbols are provided when-used. */
60 extern int mmix_gnu_syntax
;
61 #define md_parse_name(name, exp, mode, cpos) \
64 ? (! is_part_of_name (name[1]) \
65 && (current_location (exp, mode), 1)) \
66 : ((name[0] == ':' || ISUPPER (name[0])) \
67 && mmix_parse_predefined_name (name, exp))))
69 extern char *mmix_prefix_name (char *);
71 /* We implement when *creating* a symbol, we also need to strip a ':' or
73 #define tc_canonicalize_symbol_name(x) \
74 (mmix_current_prefix == NULL && (x)[0] != ':' ? (x) : mmix_prefix_name (x))
76 #define md_undefined_symbol(x) NULL
78 extern void mmix_fb_label (expressionS
*);
80 /* Since integer_constant is local to expr.c, we have to make this a
81 macro. FIXME: Do it cleaner. */
82 #define md_operand(exp) \
85 if (input_line_pointer[0] == '#') \
87 input_line_pointer++; \
88 integer_constant (16, (exp)); \
90 else if (input_line_pointer[0] == '&' \
91 && input_line_pointer[1] != '&') \
92 as_bad (_("`&' serial number operator is not supported")); \
94 mmix_fb_label (exp); \
98 /* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in
99 the error-recovery loop. Hopefully there are no significant
100 differences. Also, space on a line isn't gracefully handled. */
101 extern int mmix_assemble_return_nonzero (char *);
102 #define tc_unrecognized_line(c) \
104 || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8') \
105 && mmix_assemble_return_nonzero (input_line_pointer - 1)))
107 #define md_number_to_chars number_to_chars_bigendian
109 #define WORKING_DOT_WORD
111 extern const struct relax_type mmix_relax_table
[];
112 #define TC_GENERIC_RELAX_TABLE mmix_relax_table
114 /* We use the relax table for everything except the GREG frags and PUSHJ. */
115 extern long mmix_md_relax_frag (segT
, fragS
*, long);
116 #define md_relax_frag mmix_md_relax_frag
118 #define tc_fix_adjustable(FIX) \
119 (((FIX)->fx_addsy == NULL \
120 || S_GET_SEGMENT ((FIX)->fx_addsy) != reg_section) \
121 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT \
122 && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY \
123 && (FIX)->fx_r_type != BFD_RELOC_MMIX_LOCAL)
125 /* Adjust symbols which are registers. */
126 #define tc_adjust_symtab() mmix_adjust_symtab ()
127 extern void mmix_adjust_symtab (void);
129 /* Here's where we make all symbols global, when so requested.
130 We must avoid doing that for expression symbols or section symbols,
132 extern int mmix_globalize_symbols
;
133 #define tc_frob_symbol(sym, punt) \
136 if (S_GET_SEGMENT (sym) == reg_section) \
138 if (S_GET_NAME (sym)[0] != '$' \
139 && S_GET_VALUE (sym) < 256) \
141 if (mmix_globalize_symbols) \
142 S_SET_EXTERNAL (sym); \
144 symbol_mark_used_in_reloc (sym); \
147 else if (mmix_globalize_symbols \
148 && ! symbol_section_p (sym) \
149 && sym != section_symbol (absolute_section) \
150 && ! S_IS_LOCAL (sym)) \
151 S_SET_EXTERNAL (sym); \
155 /* No shared lib support, so we don't need to ensure externally
156 visible symbols can be overridden. */
157 #define EXTERN_FORCE_RELOC 0
159 /* When relaxing, we need to emit various relocs we otherwise wouldn't. */
160 #define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix)
161 extern int mmix_force_relocation (struct fix
*);
163 /* Call md_pcrel_from_section(), not md_pcrel_from(). */
164 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
166 #define md_section_align(seg, size) (size)
168 #define LISTING_HEADER "GAS for MMIX"
170 /* The default of 4 means Bcc expansion looks like it's missing a line. */
171 #define LISTING_LHS_CONT_LINES 5
173 extern fragS
*mmix_opcode_frag
;
174 #define TC_FRAG_TYPE fragS *
175 #define TC_FRAG_INIT(frag, max_bytes) (frag)->tc_frag_data = mmix_opcode_frag
177 /* We need to associate each section symbol with a list of GREGs defined
178 for that section/segment and sorted on offset, between the point where
179 all symbols have been evaluated and all frags mapped, and when the
180 fixups are done and relocs are output. Similarly for each unknown
182 extern void mmix_frob_file (void);
183 #define tc_frob_file_before_fix() \
188 /* It's likely mmix_frob_file changed (removed) sections, so make \
189 sure sections are correctly numbered as per renumber_sections, \
190 (static to write.c where this macro is called). */ \
192 bfd_map_over_sections (stdoutput, renumber_sections, &i); \
196 /* Used by mmix_frob_file. Hangs on section symbols and unknown symbols. */
197 struct mmix_symbol_gregs
;
198 #define TC_SYMFIELD_TYPE struct mmix_symbol_gregs *
200 /* Used by relaxation, counting maximum needed PUSHJ stubs for a section. */
201 struct mmix_segment_info_type
203 /* We only need to keep track of the last stubbable frag because
204 there's no less hackish way to keep track of different relaxation
206 fragS
*last_stubfrag
;
207 bfd_size_type nstubs
;
209 #define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type
211 extern void mmix_md_elf_section_change_hook (void);
212 #define md_elf_section_change_hook mmix_md_elf_section_change_hook
214 extern void mmix_md_do_align (int, char *, int, int);
215 #define md_do_align(n, fill, len, max, label) \
216 mmix_md_do_align (n, fill, len, max)
218 /* Each insn is a tetrabyte (4 bytes) long, but if there are BYTE
219 sequences sprinkled in, we can get unaligned DWARF2 offsets, so let's
220 explicitly say one byte. */
221 #define DWARF2_LINE_MIN_INSN_LENGTH 1
223 /* MMIX has global register symbols. */
224 #define TC_GLOBAL_REGISTER_SYMBOL_OK
226 #define md_single_noop_insn "swym 0"