Back to index

cell-binutils  2.17cvs20070401
tc-mmix.h
Go to the documentation of this file.
00001 /* tc-mmix.h -- Header file for tc-mmix.c.
00002    Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
00003    Written by Hans-Peter Nilsson (hp@bitrange.com).
00004 
00005    This file is part of GAS, the GNU Assembler.
00006 
00007    GAS is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2, or (at your option)
00010    any later version.
00011 
00012    GAS is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with GAS; see the file COPYING.  If not, write to the Free
00019    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #define TC_MMIX
00023 
00024 /* See gas/doc/internals.texi for explanation of these macros.  */
00025 #define TARGET_FORMAT "elf64-mmix"
00026 #define TARGET_ARCH bfd_arch_mmix
00027 #define TARGET_BYTES_BIG_ENDIAN 1
00028 
00029 extern const char mmix_comment_chars[];
00030 #define tc_comment_chars mmix_comment_chars
00031 
00032 extern const char mmix_symbol_chars[];
00033 #define tc_symbol_chars mmix_symbol_chars
00034 
00035 extern const char mmix_exp_chars[];
00036 #define EXP_CHARS mmix_exp_chars
00037 
00038 extern const char mmix_flt_chars[];
00039 #define FLT_CHARS mmix_flt_chars
00040 
00041 /* "@" is a synonym for ".".  */
00042 #define LEX_AT (LEX_BEGIN_NAME)
00043 
00044 extern int mmix_label_without_colon_this_line (void);
00045 #define LABELS_WITHOUT_COLONS mmix_label_without_colon_this_line ()
00046 
00047 extern int mmix_next_semicolon_is_eoln;
00048 #define TC_EOL_IN_INSN(p) (*(p) == ';' && ! mmix_next_semicolon_is_eoln)
00049 
00050 /* This is one direction we can get mmixal compatibility.  */
00051 extern void mmix_handle_mmixal (void);
00052 #define md_start_line_hook mmix_handle_mmixal
00053 
00054 extern void mmix_md_begin (void);
00055 #define md_begin mmix_md_begin
00056 
00057 extern void mmix_md_end (void);
00058 #define md_end mmix_md_end
00059 
00060 extern int mmix_current_location \
00061   (void (*fn) (expressionS *), expressionS *);
00062 extern int mmix_parse_predefined_name (char *, expressionS *);
00063 
00064 extern char *mmix_current_prefix;
00065 
00066 /* A bit ugly, since we "know" that there's a static function
00067    current_location that does what we want.  We also strip off a leading
00068    ':' in another ugly way.
00069 
00070    The [DVWIOUZX]_Handler symbols are provided when-used.  */
00071 
00072 extern int mmix_gnu_syntax;
00073 #define md_parse_name(name, exp, mode, cpos)                   \
00074  (! mmix_gnu_syntax                                     \
00075   && (name[0] == '@'                                    \
00076       ? (! is_part_of_name (name[1])                           \
00077         && mmix_current_location (current_location, exp))      \
00078       : ((name[0] == ':' || ISUPPER (name[0]))                 \
00079         && mmix_parse_predefined_name (name, exp))))
00080 
00081 extern char *mmix_prefix_name (char *);
00082 
00083 /* We implement when *creating* a symbol, we also need to strip a ':' or
00084    prepend a prefix.  */
00085 #define tc_canonicalize_symbol_name(x) \
00086  (mmix_current_prefix == NULL && (x)[0] != ':' ? (x) : mmix_prefix_name (x))
00087 
00088 #define md_undefined_symbol(x) NULL
00089 
00090 extern void mmix_fb_label (expressionS *);
00091 
00092 /* Since integer_constant is local to expr.c, we have to make this a
00093    macro.  FIXME: Do it cleaner.  */
00094 #define md_operand(exp)                                               \
00095   do                                                           \
00096     {                                                          \
00097       if (input_line_pointer[0] == '#')                               \
00098        {                                                       \
00099          input_line_pointer++;                                        \
00100          integer_constant (16, (exp));                                \
00101        }                                                       \
00102       else if (input_line_pointer[0] == '&'                           \
00103               && input_line_pointer[1] != '&')                        \
00104        as_bad (_("`&' serial number operator is not supported"));     \
00105       else                                                     \
00106        mmix_fb_label (exp);                                    \
00107     }                                                          \
00108   while (0)
00109 
00110 /* Gas dislikes the 2ADD, 8ADD etc. insns, so we have to assemble them in
00111    the error-recovery loop.  Hopefully there are no significant
00112    differences.  Also, space on a line isn't gracefully handled.  */
00113 extern int mmix_assemble_return_nonzero (char *);
00114 #define tc_unrecognized_line(c)                                       \
00115  ((c) == ' '                                                   \
00116   || (((c) == '1' || (c) == '2' || (c) == '4' || (c) == '8')          \
00117       && mmix_assemble_return_nonzero (input_line_pointer - 1)))
00118 
00119 #define md_number_to_chars number_to_chars_bigendian
00120 
00121 #define WORKING_DOT_WORD
00122 
00123 extern const struct relax_type mmix_relax_table[];
00124 #define TC_GENERIC_RELAX_TABLE mmix_relax_table
00125 
00126 /* We use the relax table for everything except the GREG frags and PUSHJ.  */
00127 extern long mmix_md_relax_frag (segT, fragS *, long);
00128 #define md_relax_frag mmix_md_relax_frag
00129 
00130 #define tc_fix_adjustable(FIX)                                 \
00131  (((FIX)->fx_addsy == NULL                              \
00132    || S_GET_SEGMENT ((FIX)->fx_addsy) != reg_section)          \
00133   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT              \
00134   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY                \
00135   && (FIX)->fx_r_type != BFD_RELOC_MMIX_LOCAL)
00136 
00137 /* Adjust symbols which are registers.  */
00138 #define tc_adjust_symtab() mmix_adjust_symtab ()
00139 extern void mmix_adjust_symtab (void);
00140 
00141 /* Here's where we make all symbols global, when so requested.
00142    We must avoid doing that for expression symbols or section symbols,
00143    though.  */
00144 extern int mmix_globalize_symbols;
00145 #define tc_frob_symbol(sym, punt)                       \
00146   do                                                    \
00147     {                                                   \
00148       if (S_GET_SEGMENT (sym) == reg_section)                  \
00149        {                                                \
00150          if (S_GET_NAME (sym)[0] != '$'                 \
00151              && S_GET_VALUE (sym) < 256)                \
00152            {                                            \
00153              if (mmix_globalize_symbols)                \
00154               S_SET_EXTERNAL (sym);                            \
00155              else                                       \
00156               symbol_mark_used_in_reloc (sym);          \
00157            }                                            \
00158        }                                                \
00159       else if (mmix_globalize_symbols                          \
00160               && ! symbol_section_p (sym)               \
00161               && sym != section_symbol (absolute_section)      \
00162               && ! S_IS_LOCAL (sym))                           \
00163        S_SET_EXTERNAL (sym);                                   \
00164     }                                                   \
00165   while (0)
00166 
00167 /* No shared lib support, so we don't need to ensure externally
00168    visible symbols can be overridden.  */
00169 #define EXTERN_FORCE_RELOC 0
00170 
00171 /* When relaxing, we need to emit various relocs we otherwise wouldn't.  */
00172 #define TC_FORCE_RELOCATION(fix) mmix_force_relocation (fix)
00173 extern int mmix_force_relocation (struct fix *);
00174 
00175 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
00176 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
00177 extern long md_pcrel_from_section (struct fix *, segT);
00178 
00179 #define md_section_align(seg, size) (size)
00180 
00181 #define LISTING_HEADER "GAS for MMIX"
00182 
00183 /* The default of 4 means Bcc expansion looks like it's missing a line.  */
00184 #define LISTING_LHS_CONT_LINES 5
00185 
00186 extern fragS *mmix_opcode_frag;
00187 #define TC_FRAG_TYPE fragS *
00188 #define TC_FRAG_INIT(frag) (frag)->tc_frag_data = mmix_opcode_frag
00189 
00190 /* We need to associate each section symbol with a list of GREGs defined
00191    for that section/segment and sorted on offset, between the point where
00192    all symbols have been evaluated and all frags mapped, and when the
00193    fixups are done and relocs are output.  Similarly for each unknown
00194    symbol.  */
00195 extern void mmix_frob_file (void);
00196 #define tc_frob_file_before_fix mmix_frob_file
00197 
00198 /* Used by mmix_frob_file.  Hangs on section symbols and unknown symbols.  */
00199 struct mmix_symbol_gregs;
00200 #define TC_SYMFIELD_TYPE struct mmix_symbol_gregs *
00201 
00202 /* Used by relaxation, counting maximum needed PUSHJ stubs for a section.  */
00203 struct mmix_segment_info_type
00204  {
00205    /* We only need to keep track of the last stubbable frag because
00206       there's no less hackish way to keep track of different relaxation
00207       rounds.  */
00208    fragS *last_stubfrag;
00209    bfd_size_type nstubs;
00210  };
00211 #define TC_SEGMENT_INFO_TYPE struct mmix_segment_info_type
00212 
00213 extern void mmix_md_elf_section_change_hook (void);
00214 #define md_elf_section_change_hook mmix_md_elf_section_change_hook
00215 
00216 extern void mmix_md_do_align (int, char *, int, int);
00217 #define md_do_align(n, fill, len, max, label) \
00218  mmix_md_do_align (n, fill, len, max)
00219 
00220 /* Each insn is a tetrabyte (4 bytes) long, but if there are BYTE
00221    sequences sprinkled in, we can get unaligned DWARF2 offsets, so let's
00222    explicitly say one byte.  */
00223 #define DWARF2_LINE_MIN_INSN_LENGTH 1
00224 
00225 /* This target is buggy, and sets fix size too large.  */
00226 #define TC_FX_SIZE_SLACK(FIX) 6