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