xref: /openbsd-src/gnu/usr.bin/binutils-2.17/include/opcode/ia64.h (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* ia64.h -- Header file for ia64 opcode table
2*3d8817e4Smiod    Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006
3*3d8817e4Smiod    Free Software Foundation, Inc.
4*3d8817e4Smiod    Contributed by David Mosberger-Tang <davidm@hpl.hp.com> */
5*3d8817e4Smiod 
6*3d8817e4Smiod #ifndef opcode_ia64_h
7*3d8817e4Smiod #define opcode_ia64_h
8*3d8817e4Smiod 
9*3d8817e4Smiod #include <sys/types.h>
10*3d8817e4Smiod 
11*3d8817e4Smiod #include "bfd.h"
12*3d8817e4Smiod 
13*3d8817e4Smiod 
14*3d8817e4Smiod typedef BFD_HOST_U_64_BIT ia64_insn;
15*3d8817e4Smiod 
16*3d8817e4Smiod enum ia64_insn_type
17*3d8817e4Smiod   {
18*3d8817e4Smiod     IA64_TYPE_NIL = 0,	/* illegal type */
19*3d8817e4Smiod     IA64_TYPE_A,	/* integer alu (I- or M-unit) */
20*3d8817e4Smiod     IA64_TYPE_I,	/* non-alu integer (I-unit) */
21*3d8817e4Smiod     IA64_TYPE_M,	/* memory (M-unit) */
22*3d8817e4Smiod     IA64_TYPE_B,	/* branch (B-unit) */
23*3d8817e4Smiod     IA64_TYPE_F,	/* floating-point (F-unit) */
24*3d8817e4Smiod     IA64_TYPE_X,	/* long encoding (X-unit) */
25*3d8817e4Smiod     IA64_TYPE_DYN,	/* Dynamic opcode */
26*3d8817e4Smiod     IA64_NUM_TYPES
27*3d8817e4Smiod   };
28*3d8817e4Smiod 
29*3d8817e4Smiod enum ia64_unit
30*3d8817e4Smiod   {
31*3d8817e4Smiod     IA64_UNIT_NIL = 0,	/* illegal unit */
32*3d8817e4Smiod     IA64_UNIT_I,	/* integer unit */
33*3d8817e4Smiod     IA64_UNIT_M,	/* memory unit */
34*3d8817e4Smiod     IA64_UNIT_B,	/* branching unit */
35*3d8817e4Smiod     IA64_UNIT_F,	/* floating-point unit */
36*3d8817e4Smiod     IA64_UNIT_L,	/* long "unit" */
37*3d8817e4Smiod     IA64_UNIT_X,	/* may be integer or branch unit */
38*3d8817e4Smiod     IA64_NUM_UNITS
39*3d8817e4Smiod   };
40*3d8817e4Smiod 
41*3d8817e4Smiod /* Changes to this enumeration must be propagated to the operand table in
42*3d8817e4Smiod    bfd/cpu-ia64-opc.c
43*3d8817e4Smiod  */
44*3d8817e4Smiod enum ia64_opnd
45*3d8817e4Smiod   {
46*3d8817e4Smiod     IA64_OPND_NIL,	/* no operand---MUST BE FIRST!*/
47*3d8817e4Smiod 
48*3d8817e4Smiod     /* constants */
49*3d8817e4Smiod     IA64_OPND_AR_CSD,	/* application register csd (ar.csd) */
50*3d8817e4Smiod     IA64_OPND_AR_CCV,	/* application register ccv (ar.ccv) */
51*3d8817e4Smiod     IA64_OPND_AR_PFS,	/* application register pfs (ar.pfs) */
52*3d8817e4Smiod     IA64_OPND_C1,	/* the constant 1 */
53*3d8817e4Smiod     IA64_OPND_C8,	/* the constant 8 */
54*3d8817e4Smiod     IA64_OPND_C16,	/* the constant 16 */
55*3d8817e4Smiod     IA64_OPND_GR0,	/* gr0 */
56*3d8817e4Smiod     IA64_OPND_IP,	/* instruction pointer (ip) */
57*3d8817e4Smiod     IA64_OPND_PR,	/* predicate register (pr) */
58*3d8817e4Smiod     IA64_OPND_PR_ROT,	/* rotating predicate register (pr.rot) */
59*3d8817e4Smiod     IA64_OPND_PSR,	/* processor status register (psr) */
60*3d8817e4Smiod     IA64_OPND_PSR_L,	/* processor status register L (psr.l) */
61*3d8817e4Smiod     IA64_OPND_PSR_UM,	/* processor status register UM (psr.um) */
62*3d8817e4Smiod 
63*3d8817e4Smiod     /* register operands: */
64*3d8817e4Smiod     IA64_OPND_AR3,	/* third application register # (bits 20-26) */
65*3d8817e4Smiod     IA64_OPND_B1,	/* branch register # (bits 6-8) */
66*3d8817e4Smiod     IA64_OPND_B2,	/* branch register # (bits 13-15) */
67*3d8817e4Smiod     IA64_OPND_CR3,	/* third control register # (bits 20-26) */
68*3d8817e4Smiod     IA64_OPND_F1,	/* first floating-point register # */
69*3d8817e4Smiod     IA64_OPND_F2,	/* second floating-point register # */
70*3d8817e4Smiod     IA64_OPND_F3,	/* third floating-point register # */
71*3d8817e4Smiod     IA64_OPND_F4,	/* fourth floating-point register # */
72*3d8817e4Smiod     IA64_OPND_P1,	/* first predicate # */
73*3d8817e4Smiod     IA64_OPND_P2,	/* second predicate # */
74*3d8817e4Smiod     IA64_OPND_R1,	/* first register # */
75*3d8817e4Smiod     IA64_OPND_R2,	/* second register # */
76*3d8817e4Smiod     IA64_OPND_R3,	/* third register # */
77*3d8817e4Smiod     IA64_OPND_R3_2,	/* third register # (limited to gr0-gr3) */
78*3d8817e4Smiod 
79*3d8817e4Smiod     /* memory operands: */
80*3d8817e4Smiod     IA64_OPND_MR3,	/* memory at addr of third register # */
81*3d8817e4Smiod 
82*3d8817e4Smiod     /* indirect operands: */
83*3d8817e4Smiod     IA64_OPND_CPUID_R3,	/* cpuid[reg] */
84*3d8817e4Smiod     IA64_OPND_DBR_R3,	/* dbr[reg] */
85*3d8817e4Smiod     IA64_OPND_DTR_R3,	/* dtr[reg] */
86*3d8817e4Smiod     IA64_OPND_ITR_R3,	/* itr[reg] */
87*3d8817e4Smiod     IA64_OPND_IBR_R3,	/* ibr[reg] */
88*3d8817e4Smiod     IA64_OPND_MSR_R3,	/* msr[reg] */
89*3d8817e4Smiod     IA64_OPND_PKR_R3,	/* pkr[reg] */
90*3d8817e4Smiod     IA64_OPND_PMC_R3,	/* pmc[reg] */
91*3d8817e4Smiod     IA64_OPND_PMD_R3,	/* pmd[reg] */
92*3d8817e4Smiod     IA64_OPND_RR_R3,	/* rr[reg] */
93*3d8817e4Smiod 
94*3d8817e4Smiod     /* immediate operands: */
95*3d8817e4Smiod     IA64_OPND_CCNT5,	/* 5-bit count (31 - bits 20-24) */
96*3d8817e4Smiod     IA64_OPND_CNT2a,	/* 2-bit count (1 + bits 27-28) */
97*3d8817e4Smiod     IA64_OPND_CNT2b,	/* 2-bit count (bits 27-28): 1, 2, 3 */
98*3d8817e4Smiod     IA64_OPND_CNT2c,	/* 2-bit count (bits 30-31): 0, 7, 15, or 16 */
99*3d8817e4Smiod     IA64_OPND_CNT5,	/* 5-bit count (bits 14-18) */
100*3d8817e4Smiod     IA64_OPND_CNT6,	/* 6-bit count (bits 27-32) */
101*3d8817e4Smiod     IA64_OPND_CPOS6a,	/* 6-bit count (63 - bits 20-25) */
102*3d8817e4Smiod     IA64_OPND_CPOS6b,	/* 6-bit count (63 - bits 14-19) */
103*3d8817e4Smiod     IA64_OPND_CPOS6c,	/* 6-bit count (63 - bits 31-36) */
104*3d8817e4Smiod     IA64_OPND_IMM1,	/* signed 1-bit immediate (bit 36) */
105*3d8817e4Smiod     IA64_OPND_IMMU2,	/* unsigned 2-bit immediate (bits 13-14) */
106*3d8817e4Smiod     IA64_OPND_IMMU5b,	/* unsigned 5-bit immediate (32 + bits 14-18) */
107*3d8817e4Smiod     IA64_OPND_IMMU7a,	/* unsigned 7-bit immediate (bits 13-19) */
108*3d8817e4Smiod     IA64_OPND_IMMU7b,	/* unsigned 7-bit immediate (bits 20-26) */
109*3d8817e4Smiod     IA64_OPND_SOF,	/* 8-bit stack frame size */
110*3d8817e4Smiod     IA64_OPND_SOL,	/* 8-bit size of locals */
111*3d8817e4Smiod     IA64_OPND_SOR,	/* 6-bit number of rotating registers (scaled by 8) */
112*3d8817e4Smiod     IA64_OPND_IMM8,	/* signed 8-bit immediate (bits 13-19 & 36) */
113*3d8817e4Smiod     IA64_OPND_IMM8U4,	/* cmp4*u signed 8-bit immediate (bits 13-19 & 36) */
114*3d8817e4Smiod     IA64_OPND_IMM8M1,	/* signed 8-bit immediate -1 (bits 13-19 & 36) */
115*3d8817e4Smiod     IA64_OPND_IMM8M1U4,	/* cmp4*u signed 8-bit immediate -1 (bits 13-19 & 36)*/
116*3d8817e4Smiod     IA64_OPND_IMM8M1U8,	/* cmp*u signed 8-bit immediate -1 (bits 13-19 & 36) */
117*3d8817e4Smiod     IA64_OPND_IMMU9,	/* unsigned 9-bit immediate (bits 33-34, 20-26) */
118*3d8817e4Smiod     IA64_OPND_IMM9a,	/* signed 9-bit immediate (bits 6-12, 27, 36) */
119*3d8817e4Smiod     IA64_OPND_IMM9b,	/* signed 9-bit immediate (bits 13-19, 27, 36) */
120*3d8817e4Smiod     IA64_OPND_IMM14,	/* signed 14-bit immediate (bits 13-19, 27-32, 36) */
121*3d8817e4Smiod     IA64_OPND_IMM17,	/* signed 17-bit immediate (2*bits 6-12, 24-31, 36) */
122*3d8817e4Smiod     IA64_OPND_IMMU21,	/* unsigned 21-bit immediate (bits 6-25, 36) */
123*3d8817e4Smiod     IA64_OPND_IMM22,	/* signed 22-bit immediate (bits 13-19, 22-36) */
124*3d8817e4Smiod     IA64_OPND_IMMU24,	/* unsigned 24-bit immediate (bits 6-26, 31-32, 36) */
125*3d8817e4Smiod     IA64_OPND_IMM44,	/* signed 44-bit immediate (2^16*bits 6-32, 36) */
126*3d8817e4Smiod     IA64_OPND_IMMU62,	/* unsigned 62-bit immediate */
127*3d8817e4Smiod     IA64_OPND_IMMU64,	/* unsigned 64-bit immediate (lotsa bits...) */
128*3d8817e4Smiod     IA64_OPND_INC3,	/* signed 3-bit (bits 13-15): +/-1, 4, 8, 16 */
129*3d8817e4Smiod     IA64_OPND_LEN4,	/* 4-bit count (bits 27-30 + 1) */
130*3d8817e4Smiod     IA64_OPND_LEN6,	/* 6-bit count (bits 27-32 + 1) */
131*3d8817e4Smiod     IA64_OPND_MBTYPE4,	/* 4-bit mux type (bits 20-23) */
132*3d8817e4Smiod     IA64_OPND_MHTYPE8,	/* 8-bit mux type (bits 20-27) */
133*3d8817e4Smiod     IA64_OPND_POS6,	/* 6-bit count (bits 14-19) */
134*3d8817e4Smiod     IA64_OPND_TAG13,	/* signed 13-bit tag (ip + 16*bits 6-12, 33-34) */
135*3d8817e4Smiod     IA64_OPND_TAG13b,	/* signed 13-bit tag (ip + 16*bits 24-32) */
136*3d8817e4Smiod     IA64_OPND_TGT25,	/* signed 25-bit (ip + 16*bits 6-25, 36) */
137*3d8817e4Smiod     IA64_OPND_TGT25b,	/* signed 25-bit (ip + 16*bits 6-12, 20-32, 36) */
138*3d8817e4Smiod     IA64_OPND_TGT25c,	/* signed 25-bit (ip + 16*bits 13-32, 36) */
139*3d8817e4Smiod     IA64_OPND_TGT64,    /* 64-bit (ip + 16*bits 13-32, 36, 2-40(L)) */
140*3d8817e4Smiod     IA64_OPND_LDXMOV,	/* any symbol, generates R_IA64_LDXMOV.  */
141*3d8817e4Smiod 
142*3d8817e4Smiod     IA64_OPND_COUNT	/* # of operand types (MUST BE LAST!) */
143*3d8817e4Smiod   };
144*3d8817e4Smiod 
145*3d8817e4Smiod enum ia64_dependency_mode
146*3d8817e4Smiod {
147*3d8817e4Smiod   IA64_DV_RAW,
148*3d8817e4Smiod   IA64_DV_WAW,
149*3d8817e4Smiod   IA64_DV_WAR,
150*3d8817e4Smiod };
151*3d8817e4Smiod 
152*3d8817e4Smiod enum ia64_dependency_semantics
153*3d8817e4Smiod {
154*3d8817e4Smiod   IA64_DVS_NONE,
155*3d8817e4Smiod   IA64_DVS_IMPLIED,
156*3d8817e4Smiod   IA64_DVS_IMPLIEDF,
157*3d8817e4Smiod   IA64_DVS_DATA,
158*3d8817e4Smiod   IA64_DVS_INSTR,
159*3d8817e4Smiod   IA64_DVS_SPECIFIC,
160*3d8817e4Smiod   IA64_DVS_STOP,
161*3d8817e4Smiod   IA64_DVS_OTHER,
162*3d8817e4Smiod };
163*3d8817e4Smiod 
164*3d8817e4Smiod enum ia64_resource_specifier
165*3d8817e4Smiod {
166*3d8817e4Smiod   IA64_RS_ANY,
167*3d8817e4Smiod   IA64_RS_AR_K,
168*3d8817e4Smiod   IA64_RS_AR_UNAT,
169*3d8817e4Smiod   IA64_RS_AR, /* 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111 */
170*3d8817e4Smiod   IA64_RS_ARb, /* 48-63, 112-127 */
171*3d8817e4Smiod   IA64_RS_BR,
172*3d8817e4Smiod   IA64_RS_CFM,
173*3d8817e4Smiod   IA64_RS_CPUID,
174*3d8817e4Smiod   IA64_RS_CR_IRR,
175*3d8817e4Smiod   IA64_RS_CR_LRR,
176*3d8817e4Smiod   IA64_RS_CR, /* 3-7,10-15,18,26-63,75-79,82-127 */
177*3d8817e4Smiod   IA64_RS_DBR,
178*3d8817e4Smiod   IA64_RS_FR,
179*3d8817e4Smiod   IA64_RS_FRb,
180*3d8817e4Smiod   IA64_RS_GR0,
181*3d8817e4Smiod   IA64_RS_GR,
182*3d8817e4Smiod   IA64_RS_IBR,
183*3d8817e4Smiod   IA64_RS_INSERVICE, /* CR[EOI] or CR[IVR] */
184*3d8817e4Smiod   IA64_RS_MSR,
185*3d8817e4Smiod   IA64_RS_PKR,
186*3d8817e4Smiod   IA64_RS_PMC,
187*3d8817e4Smiod   IA64_RS_PMD,
188*3d8817e4Smiod   IA64_RS_PR,  /* non-rotating, 1-15 */
189*3d8817e4Smiod   IA64_RS_PRr, /* rotating, 16-62 */
190*3d8817e4Smiod   IA64_RS_PR63,
191*3d8817e4Smiod   IA64_RS_RR,
192*3d8817e4Smiod 
193*3d8817e4Smiod   IA64_RS_ARX, /* ARs not in RS_AR or RS_ARb */
194*3d8817e4Smiod   IA64_RS_CRX, /* CRs not in RS_CR */
195*3d8817e4Smiod   IA64_RS_PSR, /* PSR bits */
196*3d8817e4Smiod   IA64_RS_RSE, /* implementation-specific RSE resources */
197*3d8817e4Smiod   IA64_RS_AR_FPSR,
198*3d8817e4Smiod };
199*3d8817e4Smiod 
200*3d8817e4Smiod enum ia64_rse_resource
201*3d8817e4Smiod {
202*3d8817e4Smiod   IA64_RSE_N_STACKED_PHYS,
203*3d8817e4Smiod   IA64_RSE_BOF,
204*3d8817e4Smiod   IA64_RSE_STORE_REG,
205*3d8817e4Smiod   IA64_RSE_LOAD_REG,
206*3d8817e4Smiod   IA64_RSE_BSPLOAD,
207*3d8817e4Smiod   IA64_RSE_RNATBITINDEX,
208*3d8817e4Smiod   IA64_RSE_CFLE,
209*3d8817e4Smiod   IA64_RSE_NDIRTY,
210*3d8817e4Smiod };
211*3d8817e4Smiod 
212*3d8817e4Smiod /* Information about a given resource dependency */
213*3d8817e4Smiod struct ia64_dependency
214*3d8817e4Smiod {
215*3d8817e4Smiod   /* Name of the resource */
216*3d8817e4Smiod   const char *name;
217*3d8817e4Smiod   /* Does this dependency need further specification? */
218*3d8817e4Smiod   enum ia64_resource_specifier specifier;
219*3d8817e4Smiod   /* Mode of dependency */
220*3d8817e4Smiod   enum ia64_dependency_mode mode;
221*3d8817e4Smiod   /* Dependency semantics */
222*3d8817e4Smiod   enum ia64_dependency_semantics semantics;
223*3d8817e4Smiod   /* Register index, if applicable (distinguishes AR, CR, and PSR deps) */
224*3d8817e4Smiod #define REG_NONE (-1)
225*3d8817e4Smiod   int regindex;
226*3d8817e4Smiod   /* Special info on semantics */
227*3d8817e4Smiod   const char *info;
228*3d8817e4Smiod };
229*3d8817e4Smiod 
230*3d8817e4Smiod /* Two arrays of indexes into the ia64_dependency table.
231*3d8817e4Smiod    chks are dependencies to check for conflicts when an opcode is
232*3d8817e4Smiod    encountered; regs are dependencies to register (mark as used) when an
233*3d8817e4Smiod    opcode is used.  chks correspond to readers (RAW) or writers (WAW or
234*3d8817e4Smiod    WAR) of a resource, while regs correspond to writers (RAW or WAW) and
235*3d8817e4Smiod    readers (WAR) of a resource.  */
236*3d8817e4Smiod struct ia64_opcode_dependency
237*3d8817e4Smiod {
238*3d8817e4Smiod   int nchks;
239*3d8817e4Smiod   const unsigned short *chks;
240*3d8817e4Smiod   int nregs;
241*3d8817e4Smiod   const unsigned short *regs;
242*3d8817e4Smiod };
243*3d8817e4Smiod 
244*3d8817e4Smiod /* encode/extract the note/index for a dependency */
245*3d8817e4Smiod #define RDEP(N,X) (((N)<<11)|(X))
246*3d8817e4Smiod #define NOTE(X) (((X)>>11)&0x1F)
247*3d8817e4Smiod #define DEP(X) ((X)&0x7FF)
248*3d8817e4Smiod 
249*3d8817e4Smiod /* A template descriptor describes the execution units that are active
250*3d8817e4Smiod    for each of the three slots.  It also specifies the location of
251*3d8817e4Smiod    instruction group boundaries that may be present between two slots.  */
252*3d8817e4Smiod struct ia64_templ_desc
253*3d8817e4Smiod   {
254*3d8817e4Smiod     int group_boundary;	/* 0=no boundary, 1=between slot 0 & 1, etc. */
255*3d8817e4Smiod     enum ia64_unit exec_unit[3];
256*3d8817e4Smiod     const char *name;
257*3d8817e4Smiod   };
258*3d8817e4Smiod 
259*3d8817e4Smiod /* The opcode table is an array of struct ia64_opcode.  */
260*3d8817e4Smiod 
261*3d8817e4Smiod struct ia64_opcode
262*3d8817e4Smiod   {
263*3d8817e4Smiod     /* The opcode name.  */
264*3d8817e4Smiod     const char *name;
265*3d8817e4Smiod 
266*3d8817e4Smiod     /* The type of the instruction: */
267*3d8817e4Smiod     enum ia64_insn_type type;
268*3d8817e4Smiod 
269*3d8817e4Smiod     /* Number of output operands: */
270*3d8817e4Smiod     int num_outputs;
271*3d8817e4Smiod 
272*3d8817e4Smiod     /* The opcode itself.  Those bits which will be filled in with
273*3d8817e4Smiod        operands are zeroes.  */
274*3d8817e4Smiod     ia64_insn opcode;
275*3d8817e4Smiod 
276*3d8817e4Smiod     /* The opcode mask.  This is used by the disassembler.  This is a
277*3d8817e4Smiod        mask containing ones indicating those bits which must match the
278*3d8817e4Smiod        opcode field, and zeroes indicating those bits which need not
279*3d8817e4Smiod        match (and are presumably filled in by operands).  */
280*3d8817e4Smiod     ia64_insn mask;
281*3d8817e4Smiod 
282*3d8817e4Smiod     /* An array of operand codes.  Each code is an index into the
283*3d8817e4Smiod        operand table.  They appear in the order which the operands must
284*3d8817e4Smiod        appear in assembly code, and are terminated by a zero.  */
285*3d8817e4Smiod     enum ia64_opnd operands[5];
286*3d8817e4Smiod 
287*3d8817e4Smiod     /* One bit flags for the opcode.  These are primarily used to
288*3d8817e4Smiod        indicate specific processors and environments support the
289*3d8817e4Smiod        instructions.  The defined values are listed below. */
290*3d8817e4Smiod     unsigned int flags;
291*3d8817e4Smiod 
292*3d8817e4Smiod     /* Used by ia64_find_next_opcode (). */
293*3d8817e4Smiod     short ent_index;
294*3d8817e4Smiod 
295*3d8817e4Smiod     /* Opcode dependencies. */
296*3d8817e4Smiod     const struct ia64_opcode_dependency *dependencies;
297*3d8817e4Smiod   };
298*3d8817e4Smiod 
299*3d8817e4Smiod /* Values defined for the flags field of a struct ia64_opcode.  */
300*3d8817e4Smiod 
301*3d8817e4Smiod #define IA64_OPCODE_FIRST	(1<<0)	/* must be first in an insn group */
302*3d8817e4Smiod #define IA64_OPCODE_X_IN_MLX	(1<<1)	/* insn is allowed in X slot of MLX */
303*3d8817e4Smiod #define IA64_OPCODE_LAST	(1<<2)	/* must be last in an insn group */
304*3d8817e4Smiod #define IA64_OPCODE_PRIV	(1<<3)	/* privileged instruct */
305*3d8817e4Smiod #define IA64_OPCODE_SLOT2	(1<<4)	/* insn allowed in slot 2 only */
306*3d8817e4Smiod #define IA64_OPCODE_NO_PRED	(1<<5)	/* insn cannot be predicated */
307*3d8817e4Smiod #define IA64_OPCODE_PSEUDO	(1<<6)	/* insn is a pseudo-op */
308*3d8817e4Smiod #define IA64_OPCODE_F2_EQ_F3	(1<<7)	/* constraint: F2 == F3 */
309*3d8817e4Smiod #define IA64_OPCODE_LEN_EQ_64MCNT	(1<<8)	/* constraint: LEN == 64-CNT */
310*3d8817e4Smiod #define IA64_OPCODE_MOD_RRBS    (1<<9)	/* modifies all rrbs in CFM */
311*3d8817e4Smiod #define IA64_OPCODE_POSTINC	(1<<10)	/* postincrement MR3 operand */
312*3d8817e4Smiod 
313*3d8817e4Smiod /* A macro to extract the major opcode from an instruction.  */
314*3d8817e4Smiod #define IA64_OP(i)	(((i) >> 37) & 0xf)
315*3d8817e4Smiod 
316*3d8817e4Smiod enum ia64_operand_class
317*3d8817e4Smiod   {
318*3d8817e4Smiod     IA64_OPND_CLASS_CST,	/* constant */
319*3d8817e4Smiod     IA64_OPND_CLASS_REG,	/* register */
320*3d8817e4Smiod     IA64_OPND_CLASS_IND,	/* indirect register */
321*3d8817e4Smiod     IA64_OPND_CLASS_ABS,	/* absolute value */
322*3d8817e4Smiod     IA64_OPND_CLASS_REL,	/* IP-relative value */
323*3d8817e4Smiod   };
324*3d8817e4Smiod 
325*3d8817e4Smiod /* The operands table is an array of struct ia64_operand.  */
326*3d8817e4Smiod 
327*3d8817e4Smiod struct ia64_operand
328*3d8817e4Smiod {
329*3d8817e4Smiod   enum ia64_operand_class class;
330*3d8817e4Smiod 
331*3d8817e4Smiod   /* Set VALUE as the operand bits for the operand of type SELF in the
332*3d8817e4Smiod      instruction pointed to by CODE.  If an error occurs, *CODE is not
333*3d8817e4Smiod      modified and the returned string describes the cause of the
334*3d8817e4Smiod      error.  If no error occurs, NULL is returned.  */
335*3d8817e4Smiod   const char *(*insert) (const struct ia64_operand *self, ia64_insn value,
336*3d8817e4Smiod 			 ia64_insn *code);
337*3d8817e4Smiod 
338*3d8817e4Smiod   /* Extract the operand bits for an operand of type SELF from
339*3d8817e4Smiod      instruction CODE store them in *VALUE.  If an error occurs, the
340*3d8817e4Smiod      cause of the error is described by the string returned.  If no
341*3d8817e4Smiod      error occurs, NULL is returned.  */
342*3d8817e4Smiod   const char *(*extract) (const struct ia64_operand *self, ia64_insn code,
343*3d8817e4Smiod 			  ia64_insn *value);
344*3d8817e4Smiod 
345*3d8817e4Smiod   /* A string whose meaning depends on the operand class.  */
346*3d8817e4Smiod 
347*3d8817e4Smiod   const char *str;
348*3d8817e4Smiod 
349*3d8817e4Smiod   struct bit_field
350*3d8817e4Smiod     {
351*3d8817e4Smiod       /* The number of bits in the operand.  */
352*3d8817e4Smiod       int bits;
353*3d8817e4Smiod 
354*3d8817e4Smiod       /* How far the operand is left shifted in the instruction.  */
355*3d8817e4Smiod       int shift;
356*3d8817e4Smiod     }
357*3d8817e4Smiod   field[4];		/* no operand has more than this many bit-fields */
358*3d8817e4Smiod 
359*3d8817e4Smiod   unsigned int flags;
360*3d8817e4Smiod 
361*3d8817e4Smiod   const char *desc;	/* brief description */
362*3d8817e4Smiod };
363*3d8817e4Smiod 
364*3d8817e4Smiod /* Values defined for the flags field of a struct ia64_operand.  */
365*3d8817e4Smiod 
366*3d8817e4Smiod /* Disassemble as signed decimal (instead of hex): */
367*3d8817e4Smiod #define IA64_OPND_FLAG_DECIMAL_SIGNED	(1<<0)
368*3d8817e4Smiod /* Disassemble as unsigned decimal (instead of hex): */
369*3d8817e4Smiod #define IA64_OPND_FLAG_DECIMAL_UNSIGNED	(1<<1)
370*3d8817e4Smiod 
371*3d8817e4Smiod extern const struct ia64_templ_desc ia64_templ_desc[16];
372*3d8817e4Smiod 
373*3d8817e4Smiod /* The tables are sorted by major opcode number and are otherwise in
374*3d8817e4Smiod    the order in which the disassembler should consider instructions.  */
375*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_a[];
376*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_i[];
377*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_m[];
378*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_b[];
379*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_f[];
380*3d8817e4Smiod extern struct ia64_opcode ia64_opcodes_d[];
381*3d8817e4Smiod 
382*3d8817e4Smiod 
383*3d8817e4Smiod extern struct ia64_opcode *ia64_find_opcode (const char *name);
384*3d8817e4Smiod extern struct ia64_opcode *ia64_find_next_opcode (struct ia64_opcode *ent);
385*3d8817e4Smiod 
386*3d8817e4Smiod extern struct ia64_opcode *ia64_dis_opcode (ia64_insn insn,
387*3d8817e4Smiod 					    enum ia64_insn_type type);
388*3d8817e4Smiod 
389*3d8817e4Smiod extern void ia64_free_opcode (struct ia64_opcode *ent);
390*3d8817e4Smiod extern const struct ia64_dependency *ia64_find_dependency (int index);
391*3d8817e4Smiod 
392*3d8817e4Smiod /* To avoid circular library dependencies, this array is implemented
393*3d8817e4Smiod    in bfd/cpu-ia64-opc.c: */
394*3d8817e4Smiod extern const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT];
395*3d8817e4Smiod 
396*3d8817e4Smiod #endif /* opcode_ia64_h */
397