opcodes/
[external/binutils.git] / gas / config / tc-ns32k.h
1 /* tc-ns32k.h -- Opcode table for National Semi 32k processor
2    Copyright 1987, 1992, 1993, 1994, 1995, 1997, 2000, 2002
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 published by
9    the Free Software Foundation; either version 2, or (at your option)
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
19    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20    02111-1307, USA.  */
21
22 #define TC_NS32K
23
24 #define TARGET_BYTES_BIG_ENDIAN 0
25
26 #define TC_PCREL_ADJUST(F) md_pcrel_adjust(F)
27 extern int md_pcrel_adjust PARAMS((fragS *fragP));
28
29 #ifdef BFD_ASSEMBLER
30 #define NO_RELOC BFD_RELOC_NONE
31
32 #define TARGET_ARCH             bfd_arch_ns32k
33
34 #ifndef TARGET_FORMAT           /* Maybe defined in te-*.h */
35 #define TARGET_FORMAT           "a.out-pc532-mach"
36 #endif
37 #else
38 #define NO_RELOC 0
39 #endif
40
41 #define LOCAL_LABELS_FB 1
42
43 #include "bit_fix.h"
44
45 #define tc_aout_pre_write_hook(x)       {;}     /* not used */
46 #define tc_crawl_symbol_chain(a)        {;}     /* not used */
47 #define tc_headers_hook(a)              {;}     /* not used */
48
49 #ifdef SEQUENT_COMPATABILITY
50 #define DEF_MODEC 20
51 #define DEF_MODEL 21
52 #endif
53
54 #ifndef DEF_MODEC
55 #define DEF_MODEC 20
56 #endif
57
58 #ifndef DEF_MODEL
59 #define DEF_MODEL 20
60 #endif
61
62 #define MAX_ARGS 4
63 #define ARG_LEN 50
64
65 #define TC_CONS_FIX_NEW cons_fix_new_ns32k
66 extern void fix_new_ns32k_exp PARAMS ((fragS *, int, int, expressionS *,
67                                        int, int, bit_fixS *, int, fragS *,
68                                        unsigned int));
69
70 extern void fix_new_ns32k PARAMS ((fragS *, int, int, symbolS *, long,
71                                    int, int, bit_fixS *, int, fragS *,
72                                    unsigned int));
73
74 extern void cons_fix_new_ns32k PARAMS ((fragS *, int, int, expressionS *));
75
76 /* The NS32x32 has a non 0 nop instruction which should be used in aligns.  */
77 #define NOP_OPCODE 0xa2
78
79 #define md_operand(x)
80
81 extern const struct relax_type md_relax_table[];
82 #define TC_GENERIC_RELAX_TABLE md_relax_table
83
84 #define TC_FRAG_TYPE                            \
85   struct                                        \
86     {                                           \
87       fragS *      fr_opcode_fragP;             \
88       unsigned int fr_opcode_offset;            \
89       char         fr_bsr;                      \
90     }
91
92 #define TC_FRAG_INIT(X)                         \
93   do                                            \
94      {                                          \
95        frag_opcode_frag (X) = NULL;             \
96        frag_opcode_offset (X) = 0;              \
97        frag_bsr (X) = 0;                        \
98      }                                          \
99   while (0)
100
101 /* Accessor macros for things which may move around.  */
102 #define frag_opcode_frag(X)   (X)->tc_frag_data.fr_opcode_fragP
103 #define frag_opcode_offset(X) (X)->tc_frag_data.fr_opcode_offset
104 #define frag_bsr(X)           (X)->tc_frag_data.fr_bsr
105
106 #define TC_FIX_TYPE                             \
107   struct                                        \
108     {                                           \
109       fragS *      opcode_fragP;                \
110       unsigned int opcode_offset;               \
111       unsigned int bsr : 1;                     \
112     }
113
114 /* Accessor macros for things which may move around.
115    See comments in write.h.  */
116 #define fix_im_disp(X)       (X)->fx_im_disp
117 #define fix_bit_fixP(X)      (X)->fx_bit_fixP
118 #define fix_opcode_frag(X)   (X)->tc_fix_data.opcode_fragP
119 #define fix_opcode_offset(X) (X)->tc_fix_data.opcode_offset
120 #define fix_bsr(X)           (X)->tc_fix_data.bsr
121
122 #define TC_INIT_FIX_DATA(X)                     \
123   do                                            \
124      {                                          \
125        fix_opcode_frag(X) = NULL;               \
126        fix_opcode_offset(X) = 0;                \
127        fix_bsr(X) = 0;                          \
128      }                                          \
129   while (0)
130
131 #define TC_FIX_DATA_PRINT(FILE, FIX)                                    \
132   do                                                                    \
133     {                                                                   \
134       fprintf ((FILE), "opcode_frag=%ld, operand offset=%d, bsr=%d\n",  \
135               (unsigned long) fix_opcode_frag (FIX),                    \
136               fix_opcode_offset (FIX),                                  \
137               fix_bsr (FIX));                                           \
138     }                                                                   \
139   while (0)