home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / gas / config / tc-i960.h < prev    next >
C/C++ Source or Header  |  1996-09-28  |  6KB  |  163 lines

  1. /* tc-i960.h - Basic 80960 instruction formats.
  2.    Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996
  3.    Free Software Foundation, Inc.
  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
  9.    published by the Free Software Foundation; either version 2,
  10.    or (at your option) any later version.
  11.  
  12.    GAS is distributed in the hope that it will be useful, but
  13.    WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  15.    the GNU General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU General Public
  18.    License along with GAS; see the file COPYING.  If not, write
  19.    to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  20.  
  21. #ifndef TC_I960
  22. #define TC_I960 1
  23.  
  24. /*
  25.  * The 'COJ' instructions are actually COBR instructions with the 'b' in
  26.  * the mnemonic replaced by a 'j';  they are ALWAYS "de-optimized" if necessary:
  27.  * if the displacement will not fit in 13 bits, the assembler will replace them
  28.  * with the corresponding compare and branch instructions.
  29.  *
  30.  * All of the 'MEMn' instructions are the same format; the 'n' in the name
  31.  * indicates the default index scale factor (the size of the datum operated on).
  32.  *
  33.  * The FBRA formats are not actually an instruction format.  They are the
  34.  * "convenience directives" for branching on floating-point comparisons,
  35.  * each of which generates 2 instructions (a 'bno' and one other branch).
  36.  *
  37.  * The CALLJ format is not actually an instruction format.  It indicates that
  38.  * the instruction generated (a CTRL-format 'call') should have its relocation
  39.  * specially flagged for link-time replacement with a 'bal' or 'calls' if
  40.  * appropriate.
  41.  */
  42.  
  43. /* tailor gas */
  44. #define SYMBOLS_NEED_BACKPOINTERS
  45. #define LOCAL_LABELS_FB 1
  46. #define BITFIELD_CONS_EXPRESSIONS
  47.  
  48. /* tailor the coff format */
  49. #define BFD_ARCH                bfd_arch_i960
  50. #define COFF_FLAGS                F_AR32WR
  51. #define COFF_MAGIC                I960ROMAGIC
  52. #define OBJ_COFF_SECTION_HEADER_HAS_ALIGNMENT
  53. #define OBJ_COFF_MAX_AUXENTRIES            (2)
  54. #define TC_COUNT_RELOC(FIXP)            (!(FIXP)->fx_done)
  55. #define TC_COFF_FIX2RTYPE(FIXP)            tc_coff_fix2rtype(FIXP)
  56. #define TC_COFF_SIZEMACHDEP(FRAGP)        tc_coff_sizemachdep(FRAGP)
  57. #define TC_COFF_SET_MACHINE(HDRS)        tc_headers_hook (HDRS)
  58. extern void tc_headers_hook ();
  59. extern short tc_coff_fix2rtype ();
  60. extern int tc_coff_sizemachdep ();
  61.  
  62. /* MEANING OF 'n_other' in the symbol record.
  63.  *
  64.  * If non-zero, the 'n_other' fields indicates either a leaf procedure or
  65.  * a system procedure, as follows:
  66.  *
  67.  *    1 <= n_other <= 32 :
  68.  *        The symbol is the entry point to a system procedure.
  69.  *        'n_value' is the address of the entry, as for any other
  70.  *        procedure.  The system procedure number (which can be used in
  71.  *        a 'calls' instruction) is (n_other-1).  These entries come from
  72.  *        '.sysproc' directives.
  73.  *
  74.  *    n_other == N_CALLNAME
  75.  *        the symbol is the 'call' entry point to a leaf procedure.
  76.  *        The *next* symbol in the symbol table must be the corresponding
  77.  *        'bal' entry point to the procedure (see following).  These
  78.  *        entries come from '.leafproc' directives in which two different
  79.  *        symbols are specified (the first one is represented here).
  80.  *
  81.  *
  82.  *    n_other == N_BALNAME
  83.  *        the symbol is the 'bal' entry point to a leaf procedure.
  84.  *        These entries result from '.leafproc' directives in which only
  85.  *        one symbol is specified, or in which the same symbol is
  86.  *        specified twice.
  87.  *
  88.  * Note that an N_CALLNAME entry *must* have a corresponding N_BALNAME entry,
  89.  * but not every N_BALNAME entry must have an N_CALLNAME entry.
  90.  */
  91. #define    N_CALLNAME    ((char)-1)
  92. #define    N_BALNAME    ((char)-2)
  93.  
  94. /* i960 uses a custom relocation record. */
  95.  
  96. /* let obj-aout.h know */
  97. #define CUSTOM_RELOC_FORMAT 1
  98. /* let aout_gnu.h know */
  99. #define N_RELOCATION_INFO_DECLARED 1
  100. struct relocation_info
  101.   {
  102.     int r_address;        /* File address of item to be relocated    */
  103.     unsigned
  104.       r_index:24,        /* Index of symbol on which relocation is based*/
  105.       r_pcrel:1,        /* 1 => relocate PC-relative; else absolute
  106.                  *    On i960, pc-relative implies 24-bit
  107.                  *    address, absolute implies 32-bit.
  108.                  */
  109.       r_length:2,        /* Number of bytes to relocate:
  110.                  *    0 => 1 byte
  111.                  *    1 => 2 bytes
  112.                  *    2 => 4 bytes -- only value used for i960
  113.                  */
  114.       r_extern:1, r_bsr:1,    /* Something for the GNU NS32K assembler */
  115.       r_disp:1,            /* Something for the GNU NS32K assembler */
  116.       r_callj:1,        /* 1 if relocation target is an i960 'callj' */
  117.       nuthin:1;            /* Unused                */
  118.   };
  119.  
  120. #ifdef OBJ_COFF
  121. #define TC_ADJUST_RELOC_COUNT(FIXP,COUNT) \
  122.   { fixS *tcfixp = (FIXP); \
  123.     for (;tcfixp;tcfixp=tcfixp->fx_next) \
  124.       if (tcfixp->fx_tcbit && tcfixp->fx_addsy != 0) \
  125.         ++(COUNT); \
  126.   }
  127. #endif
  128.  
  129. extern int i960_validate_fix PARAMS ((struct fix *, segT, struct symbol **));
  130. #define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
  131.     if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
  132.  
  133. #define tc_fix_adjustable(FIXP)        ((FIXP)->fx_bsr == 0)
  134.  
  135. void brtab_emit PARAMS ((void));
  136. #define md_end()    brtab_emit ()
  137.  
  138. void reloc_callj ();        /* this is really reloc_callj(fixS *fixP) but I don't want to change header inclusion order. */
  139. void tc_set_bal_of_call ();    /* this is really tc_set_bal_of_call(symbolS *callP, symbolS *balP) */
  140.  
  141. char *_tc_get_bal_of_call ();    /* this is really symbolS *tc_get_bal_of_call(symbolS *callP). */
  142. #define tc_get_bal_of_call(c)    ((symbolS *) _tc_get_bal_of_call(c))
  143.  
  144. void i960_handle_align ();
  145. #define HANDLE_ALIGN(FRAG)    i960_handle_align (FRAG)
  146. #define NEED_FX_R_TYPE
  147. #define NO_RELOC -1
  148.  
  149. #define md_operand(x)
  150.  
  151. extern const struct relax_type md_relax_table[];
  152. #define TC_GENERIC_RELAX_TABLE md_relax_table
  153.  
  154. #define LINKER_RELAXING_SHRINKS_ONLY
  155.  
  156. #define TC_FIX_TYPE struct { unsigned bsr : 1; }
  157. #define fx_bsr tc_fix_data.bsr
  158. #define TC_INIT_FIX_DATA(F)    ((F)->tc_fix_data.bsr = 0)
  159.  
  160. #endif
  161.  
  162. /* end of tc-i960.h */
  163.