198b9484cSchristos /* ia64.h -- Header file for ia64 opcode table 2*02f41505Schristos Copyright (C) 1998-2024 Free Software Foundation, Inc. 398b9484cSchristos Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 498b9484cSchristos 598b9484cSchristos This file is part of BFD, the Binary File Descriptor library. 698b9484cSchristos 798b9484cSchristos This program is free software; you can redistribute it and/or modify 898b9484cSchristos it under the terms of the GNU General Public License as published by 998b9484cSchristos the Free Software Foundation; either version 3 of the License, or 1098b9484cSchristos (at your option) any later version. 1198b9484cSchristos 1298b9484cSchristos This program is distributed in the hope that it will be useful, 1398b9484cSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of 1498b9484cSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1598b9484cSchristos GNU General Public License for more details. 1698b9484cSchristos 1798b9484cSchristos You should have received a copy of the GNU General Public License 1898b9484cSchristos along with this program; if not, write to the Free Software Foundation, 1998b9484cSchristos Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2098b9484cSchristos 2198b9484cSchristos #ifndef opcode_ia64_h 2298b9484cSchristos #define opcode_ia64_h 2398b9484cSchristos 2498b9484cSchristos #include <sys/types.h> 2598b9484cSchristos 2698b9484cSchristos #include "bfd.h" 2798b9484cSchristos 28ba340e45Schristos #ifdef __cplusplus 29ba340e45Schristos extern "C" { 30ba340e45Schristos #endif 3198b9484cSchristos 324b169a6bSchristos typedef uint64_t ia64_insn; 3398b9484cSchristos 3498b9484cSchristos enum ia64_insn_type 3598b9484cSchristos { 3698b9484cSchristos IA64_TYPE_NIL = 0, /* illegal type */ 3798b9484cSchristos IA64_TYPE_A, /* integer alu (I- or M-unit) */ 3898b9484cSchristos IA64_TYPE_I, /* non-alu integer (I-unit) */ 3998b9484cSchristos IA64_TYPE_M, /* memory (M-unit) */ 4098b9484cSchristos IA64_TYPE_B, /* branch (B-unit) */ 4198b9484cSchristos IA64_TYPE_F, /* floating-point (F-unit) */ 4298b9484cSchristos IA64_TYPE_X, /* long encoding (X-unit) */ 4398b9484cSchristos IA64_TYPE_DYN, /* Dynamic opcode */ 4498b9484cSchristos IA64_NUM_TYPES 4598b9484cSchristos }; 4698b9484cSchristos 4798b9484cSchristos enum ia64_unit 4898b9484cSchristos { 4998b9484cSchristos IA64_UNIT_NIL = 0, /* illegal unit */ 5098b9484cSchristos IA64_UNIT_I, /* integer unit */ 5198b9484cSchristos IA64_UNIT_M, /* memory unit */ 5298b9484cSchristos IA64_UNIT_B, /* branching unit */ 5398b9484cSchristos IA64_UNIT_F, /* floating-point unit */ 5498b9484cSchristos IA64_UNIT_L, /* long "unit" */ 5598b9484cSchristos IA64_UNIT_X, /* may be integer or branch unit */ 5698b9484cSchristos IA64_NUM_UNITS 5798b9484cSchristos }; 5898b9484cSchristos 5998b9484cSchristos /* Changes to this enumeration must be propagated to the operand table in 6098b9484cSchristos bfd/cpu-ia64-opc.c 6198b9484cSchristos */ 6298b9484cSchristos enum ia64_opnd 6398b9484cSchristos { 6498b9484cSchristos IA64_OPND_NIL, /* no operand---MUST BE FIRST!*/ 6598b9484cSchristos 6698b9484cSchristos /* constants */ 6798b9484cSchristos IA64_OPND_AR_CSD, /* application register csd (ar.csd) */ 6898b9484cSchristos IA64_OPND_AR_CCV, /* application register ccv (ar.ccv) */ 6998b9484cSchristos IA64_OPND_AR_PFS, /* application register pfs (ar.pfs) */ 7098b9484cSchristos IA64_OPND_C1, /* the constant 1 */ 7198b9484cSchristos IA64_OPND_C8, /* the constant 8 */ 7298b9484cSchristos IA64_OPND_C16, /* the constant 16 */ 7398b9484cSchristos IA64_OPND_GR0, /* gr0 */ 7498b9484cSchristos IA64_OPND_IP, /* instruction pointer (ip) */ 7598b9484cSchristos IA64_OPND_PR, /* predicate register (pr) */ 7698b9484cSchristos IA64_OPND_PR_ROT, /* rotating predicate register (pr.rot) */ 7798b9484cSchristos IA64_OPND_PSR, /* processor status register (psr) */ 7898b9484cSchristos IA64_OPND_PSR_L, /* processor status register L (psr.l) */ 7998b9484cSchristos IA64_OPND_PSR_UM, /* processor status register UM (psr.um) */ 8098b9484cSchristos 8198b9484cSchristos /* register operands: */ 8298b9484cSchristos IA64_OPND_AR3, /* third application register # (bits 20-26) */ 8398b9484cSchristos IA64_OPND_B1, /* branch register # (bits 6-8) */ 8498b9484cSchristos IA64_OPND_B2, /* branch register # (bits 13-15) */ 8598b9484cSchristos IA64_OPND_CR3, /* third control register # (bits 20-26) */ 8698b9484cSchristos IA64_OPND_F1, /* first floating-point register # */ 8798b9484cSchristos IA64_OPND_F2, /* second floating-point register # */ 8898b9484cSchristos IA64_OPND_F3, /* third floating-point register # */ 8998b9484cSchristos IA64_OPND_F4, /* fourth floating-point register # */ 9098b9484cSchristos IA64_OPND_P1, /* first predicate # */ 9198b9484cSchristos IA64_OPND_P2, /* second predicate # */ 9298b9484cSchristos IA64_OPND_R1, /* first register # */ 9398b9484cSchristos IA64_OPND_R2, /* second register # */ 9498b9484cSchristos IA64_OPND_R3, /* third register # */ 9598b9484cSchristos IA64_OPND_R3_2, /* third register # (limited to gr0-gr3) */ 96a2e2270fSchristos IA64_OPND_DAHR3, /* dahr reg # ( bits 23-25) */ 9798b9484cSchristos 9898b9484cSchristos /* memory operands: */ 9998b9484cSchristos IA64_OPND_MR3, /* memory at addr of third register # */ 10098b9484cSchristos 10198b9484cSchristos /* indirect operands: */ 10298b9484cSchristos IA64_OPND_CPUID_R3, /* cpuid[reg] */ 10398b9484cSchristos IA64_OPND_DBR_R3, /* dbr[reg] */ 10498b9484cSchristos IA64_OPND_DTR_R3, /* dtr[reg] */ 10598b9484cSchristos IA64_OPND_ITR_R3, /* itr[reg] */ 10698b9484cSchristos IA64_OPND_IBR_R3, /* ibr[reg] */ 10798b9484cSchristos IA64_OPND_MSR_R3, /* msr[reg] */ 10898b9484cSchristos IA64_OPND_PKR_R3, /* pkr[reg] */ 10998b9484cSchristos IA64_OPND_PMC_R3, /* pmc[reg] */ 11098b9484cSchristos IA64_OPND_PMD_R3, /* pmd[reg] */ 111a2e2270fSchristos IA64_OPND_DAHR_R3, /* dahr[reg] */ 11298b9484cSchristos IA64_OPND_RR_R3, /* rr[reg] */ 11398b9484cSchristos 11498b9484cSchristos /* immediate operands: */ 11598b9484cSchristos IA64_OPND_CCNT5, /* 5-bit count (31 - bits 20-24) */ 11698b9484cSchristos IA64_OPND_CNT2a, /* 2-bit count (1 + bits 27-28) */ 11798b9484cSchristos IA64_OPND_CNT2b, /* 2-bit count (bits 27-28): 1, 2, 3 */ 11898b9484cSchristos IA64_OPND_CNT2c, /* 2-bit count (bits 30-31): 0, 7, 15, or 16 */ 11998b9484cSchristos IA64_OPND_CNT5, /* 5-bit count (bits 14-18) */ 12098b9484cSchristos IA64_OPND_CNT6, /* 6-bit count (bits 27-32) */ 12198b9484cSchristos IA64_OPND_CPOS6a, /* 6-bit count (63 - bits 20-25) */ 12298b9484cSchristos IA64_OPND_CPOS6b, /* 6-bit count (63 - bits 14-19) */ 12398b9484cSchristos IA64_OPND_CPOS6c, /* 6-bit count (63 - bits 31-36) */ 12498b9484cSchristos IA64_OPND_IMM1, /* signed 1-bit immediate (bit 36) */ 12598b9484cSchristos IA64_OPND_IMMU2, /* unsigned 2-bit immediate (bits 13-14) */ 12698b9484cSchristos IA64_OPND_IMMU5b, /* unsigned 5-bit immediate (32 + bits 14-18) */ 12798b9484cSchristos IA64_OPND_IMMU7a, /* unsigned 7-bit immediate (bits 13-19) */ 12898b9484cSchristos IA64_OPND_IMMU7b, /* unsigned 7-bit immediate (bits 20-26) */ 12998b9484cSchristos IA64_OPND_SOF, /* 8-bit stack frame size */ 13098b9484cSchristos IA64_OPND_SOL, /* 8-bit size of locals */ 13198b9484cSchristos IA64_OPND_SOR, /* 6-bit number of rotating registers (scaled by 8) */ 13298b9484cSchristos IA64_OPND_IMM8, /* signed 8-bit immediate (bits 13-19 & 36) */ 13398b9484cSchristos IA64_OPND_IMM8U4, /* cmp4*u signed 8-bit immediate (bits 13-19 & 36) */ 13498b9484cSchristos IA64_OPND_IMM8M1, /* signed 8-bit immediate -1 (bits 13-19 & 36) */ 13598b9484cSchristos IA64_OPND_IMM8M1U4, /* cmp4*u signed 8-bit immediate -1 (bits 13-19 & 36)*/ 13698b9484cSchristos IA64_OPND_IMM8M1U8, /* cmp*u signed 8-bit immediate -1 (bits 13-19 & 36) */ 13798b9484cSchristos IA64_OPND_IMMU9, /* unsigned 9-bit immediate (bits 33-34, 20-26) */ 13898b9484cSchristos IA64_OPND_IMM9a, /* signed 9-bit immediate (bits 6-12, 27, 36) */ 13998b9484cSchristos IA64_OPND_IMM9b, /* signed 9-bit immediate (bits 13-19, 27, 36) */ 14098b9484cSchristos IA64_OPND_IMM14, /* signed 14-bit immediate (bits 13-19, 27-32, 36) */ 141a2e2270fSchristos IA64_OPND_IMMU16, /* unsigned 16-bit immediate (bits 6-9, 12-22, 36) */ 14298b9484cSchristos IA64_OPND_IMM17, /* signed 17-bit immediate (2*bits 6-12, 24-31, 36) */ 143a2e2270fSchristos IA64_OPND_IMMU19, /* unsigned 19-bit immediate (bits 6-9, 12-25, 36) */ 14498b9484cSchristos IA64_OPND_IMMU21, /* unsigned 21-bit immediate (bits 6-25, 36) */ 14598b9484cSchristos IA64_OPND_IMM22, /* signed 22-bit immediate (bits 13-19, 22-36) */ 14698b9484cSchristos IA64_OPND_IMMU24, /* unsigned 24-bit immediate (bits 6-26, 31-32, 36) */ 14798b9484cSchristos IA64_OPND_IMM44, /* signed 44-bit immediate (2^16*bits 6-32, 36) */ 14898b9484cSchristos IA64_OPND_IMMU62, /* unsigned 62-bit immediate */ 14998b9484cSchristos IA64_OPND_IMMU64, /* unsigned 64-bit immediate (lotsa bits...) */ 15098b9484cSchristos IA64_OPND_INC3, /* signed 3-bit (bits 13-15): +/-1, 4, 8, 16 */ 15198b9484cSchristos IA64_OPND_LEN4, /* 4-bit count (bits 27-30 + 1) */ 15298b9484cSchristos IA64_OPND_LEN6, /* 6-bit count (bits 27-32 + 1) */ 15398b9484cSchristos IA64_OPND_MBTYPE4, /* 4-bit mux type (bits 20-23) */ 15498b9484cSchristos IA64_OPND_MHTYPE8, /* 8-bit mux type (bits 20-27) */ 15598b9484cSchristos IA64_OPND_POS6, /* 6-bit count (bits 14-19) */ 15698b9484cSchristos IA64_OPND_TAG13, /* signed 13-bit tag (ip + 16*bits 6-12, 33-34) */ 15798b9484cSchristos IA64_OPND_TAG13b, /* signed 13-bit tag (ip + 16*bits 24-32) */ 15898b9484cSchristos IA64_OPND_TGT25, /* signed 25-bit (ip + 16*bits 6-25, 36) */ 15998b9484cSchristos IA64_OPND_TGT25b, /* signed 25-bit (ip + 16*bits 6-12, 20-32, 36) */ 16098b9484cSchristos IA64_OPND_TGT25c, /* signed 25-bit (ip + 16*bits 13-32, 36) */ 16198b9484cSchristos IA64_OPND_TGT64, /* 64-bit (ip + 16*bits 13-32, 36, 2-40(L)) */ 16298b9484cSchristos IA64_OPND_LDXMOV, /* any symbol, generates R_IA64_LDXMOV. */ 16398b9484cSchristos 164a2e2270fSchristos IA64_OPND_CNT6a, /* 6-bit count (bits 6-11) */ 165a2e2270fSchristos IA64_OPND_STRD5b, /* 5-bit stride (bits 13-17) */ 166a2e2270fSchristos 16798b9484cSchristos IA64_OPND_COUNT /* # of operand types (MUST BE LAST!) */ 16898b9484cSchristos }; 16998b9484cSchristos 17098b9484cSchristos enum ia64_dependency_mode 17198b9484cSchristos { 17298b9484cSchristos IA64_DV_RAW, 17398b9484cSchristos IA64_DV_WAW, 17498b9484cSchristos IA64_DV_WAR, 17598b9484cSchristos }; 17698b9484cSchristos 17798b9484cSchristos enum ia64_dependency_semantics 17898b9484cSchristos { 17998b9484cSchristos IA64_DVS_NONE, 18098b9484cSchristos IA64_DVS_IMPLIED, 18198b9484cSchristos IA64_DVS_IMPLIEDF, 18298b9484cSchristos IA64_DVS_DATA, 18398b9484cSchristos IA64_DVS_INSTR, 18498b9484cSchristos IA64_DVS_SPECIFIC, 18598b9484cSchristos IA64_DVS_STOP, 18698b9484cSchristos IA64_DVS_OTHER, 18798b9484cSchristos }; 18898b9484cSchristos 18998b9484cSchristos enum ia64_resource_specifier 19098b9484cSchristos { 19198b9484cSchristos IA64_RS_ANY, 19298b9484cSchristos IA64_RS_AR_K, 19398b9484cSchristos IA64_RS_AR_UNAT, 19498b9484cSchristos IA64_RS_AR, /* 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111 */ 19598b9484cSchristos IA64_RS_ARb, /* 48-63, 112-127 */ 19698b9484cSchristos IA64_RS_BR, 19798b9484cSchristos IA64_RS_CFM, 19898b9484cSchristos IA64_RS_CPUID, 19998b9484cSchristos IA64_RS_CR_IIB, 20098b9484cSchristos IA64_RS_CR_IRR, 20198b9484cSchristos IA64_RS_CR_LRR, 20298b9484cSchristos IA64_RS_CR, /* 3-7,10-15,18,28-63,75-79,82-127 */ 203a2e2270fSchristos IA64_RS_DAHR, 20498b9484cSchristos IA64_RS_DBR, 20598b9484cSchristos IA64_RS_FR, 20698b9484cSchristos IA64_RS_FRb, 20798b9484cSchristos IA64_RS_GR0, 20898b9484cSchristos IA64_RS_GR, 20998b9484cSchristos IA64_RS_IBR, 21098b9484cSchristos IA64_RS_INSERVICE, /* CR[EOI] or CR[IVR] */ 21198b9484cSchristos IA64_RS_MSR, 21298b9484cSchristos IA64_RS_PKR, 21398b9484cSchristos IA64_RS_PMC, 21498b9484cSchristos IA64_RS_PMD, 21598b9484cSchristos IA64_RS_PR, /* non-rotating, 1-15 */ 21698b9484cSchristos IA64_RS_PRr, /* rotating, 16-62 */ 21798b9484cSchristos IA64_RS_PR63, 21898b9484cSchristos IA64_RS_RR, 21998b9484cSchristos 22098b9484cSchristos IA64_RS_ARX, /* ARs not in RS_AR or RS_ARb */ 22198b9484cSchristos IA64_RS_CRX, /* CRs not in RS_CR */ 22298b9484cSchristos IA64_RS_PSR, /* PSR bits */ 22398b9484cSchristos IA64_RS_RSE, /* implementation-specific RSE resources */ 22498b9484cSchristos IA64_RS_AR_FPSR, 225a2e2270fSchristos 22698b9484cSchristos }; 22798b9484cSchristos 22898b9484cSchristos enum ia64_rse_resource 22998b9484cSchristos { 23098b9484cSchristos IA64_RSE_N_STACKED_PHYS, 23198b9484cSchristos IA64_RSE_BOF, 23298b9484cSchristos IA64_RSE_STORE_REG, 23398b9484cSchristos IA64_RSE_LOAD_REG, 23498b9484cSchristos IA64_RSE_BSPLOAD, 23598b9484cSchristos IA64_RSE_RNATBITINDEX, 23698b9484cSchristos IA64_RSE_CFLE, 23798b9484cSchristos IA64_RSE_NDIRTY, 23898b9484cSchristos }; 23998b9484cSchristos 24098b9484cSchristos /* Information about a given resource dependency */ 24198b9484cSchristos struct ia64_dependency 24298b9484cSchristos { 24398b9484cSchristos /* Name of the resource */ 24498b9484cSchristos const char *name; 24598b9484cSchristos /* Does this dependency need further specification? */ 24698b9484cSchristos enum ia64_resource_specifier specifier; 24798b9484cSchristos /* Mode of dependency */ 24898b9484cSchristos enum ia64_dependency_mode mode; 24998b9484cSchristos /* Dependency semantics */ 25098b9484cSchristos enum ia64_dependency_semantics semantics; 25198b9484cSchristos /* Register index, if applicable (distinguishes AR, CR, and PSR deps) */ 25298b9484cSchristos #define REG_NONE (-1) 25398b9484cSchristos int regindex; 25498b9484cSchristos /* Special info on semantics */ 25598b9484cSchristos const char *info; 25698b9484cSchristos }; 25798b9484cSchristos 25898b9484cSchristos /* Two arrays of indexes into the ia64_dependency table. 25998b9484cSchristos chks are dependencies to check for conflicts when an opcode is 26098b9484cSchristos encountered; regs are dependencies to register (mark as used) when an 26198b9484cSchristos opcode is used. chks correspond to readers (RAW) or writers (WAW or 26298b9484cSchristos WAR) of a resource, while regs correspond to writers (RAW or WAW) and 26398b9484cSchristos readers (WAR) of a resource. */ 26498b9484cSchristos struct ia64_opcode_dependency 26598b9484cSchristos { 26698b9484cSchristos int nchks; 26798b9484cSchristos const unsigned short *chks; 26898b9484cSchristos int nregs; 26998b9484cSchristos const unsigned short *regs; 27098b9484cSchristos }; 27198b9484cSchristos 27298b9484cSchristos /* encode/extract the note/index for a dependency */ 27398b9484cSchristos #define RDEP(N,X) (((N)<<11)|(X)) 27498b9484cSchristos #define NOTE(X) (((X)>>11)&0x1F) 27598b9484cSchristos #define DEP(X) ((X)&0x7FF) 27698b9484cSchristos 27798b9484cSchristos /* A template descriptor describes the execution units that are active 27898b9484cSchristos for each of the three slots. It also specifies the location of 27998b9484cSchristos instruction group boundaries that may be present between two slots. */ 28098b9484cSchristos struct ia64_templ_desc 28198b9484cSchristos { 28298b9484cSchristos int group_boundary; /* 0=no boundary, 1=between slot 0 & 1, etc. */ 28398b9484cSchristos enum ia64_unit exec_unit[3]; 28498b9484cSchristos const char *name; 28598b9484cSchristos }; 28698b9484cSchristos 28798b9484cSchristos /* The opcode table is an array of struct ia64_opcode. */ 28898b9484cSchristos 28998b9484cSchristos struct ia64_opcode 29098b9484cSchristos { 29198b9484cSchristos /* The opcode name. */ 29298b9484cSchristos const char *name; 29398b9484cSchristos 29498b9484cSchristos /* The type of the instruction: */ 29598b9484cSchristos enum ia64_insn_type type; 29698b9484cSchristos 29798b9484cSchristos /* Number of output operands: */ 29898b9484cSchristos int num_outputs; 29998b9484cSchristos 30098b9484cSchristos /* The opcode itself. Those bits which will be filled in with 30198b9484cSchristos operands are zeroes. */ 30298b9484cSchristos ia64_insn opcode; 30398b9484cSchristos 30498b9484cSchristos /* The opcode mask. This is used by the disassembler. This is a 30598b9484cSchristos mask containing ones indicating those bits which must match the 30698b9484cSchristos opcode field, and zeroes indicating those bits which need not 30798b9484cSchristos match (and are presumably filled in by operands). */ 30898b9484cSchristos ia64_insn mask; 30998b9484cSchristos 31098b9484cSchristos /* An array of operand codes. Each code is an index into the 31198b9484cSchristos operand table. They appear in the order which the operands must 31298b9484cSchristos appear in assembly code, and are terminated by a zero. */ 31398b9484cSchristos enum ia64_opnd operands[5]; 31498b9484cSchristos 31598b9484cSchristos /* One bit flags for the opcode. These are primarily used to 31698b9484cSchristos indicate specific processors and environments support the 31798b9484cSchristos instructions. The defined values are listed below. */ 31898b9484cSchristos unsigned int flags; 31998b9484cSchristos 32098b9484cSchristos /* Used by ia64_find_next_opcode (). */ 32198b9484cSchristos short ent_index; 32298b9484cSchristos 32398b9484cSchristos /* Opcode dependencies. */ 32498b9484cSchristos const struct ia64_opcode_dependency *dependencies; 32598b9484cSchristos }; 32698b9484cSchristos 32798b9484cSchristos /* Values defined for the flags field of a struct ia64_opcode. */ 32898b9484cSchristos 32998b9484cSchristos #define IA64_OPCODE_FIRST (1<<0) /* must be first in an insn group */ 33098b9484cSchristos #define IA64_OPCODE_X_IN_MLX (1<<1) /* insn is allowed in X slot of MLX */ 33198b9484cSchristos #define IA64_OPCODE_LAST (1<<2) /* must be last in an insn group */ 33298b9484cSchristos #define IA64_OPCODE_PRIV (1<<3) /* privileged instruct */ 33398b9484cSchristos #define IA64_OPCODE_SLOT2 (1<<4) /* insn allowed in slot 2 only */ 33498b9484cSchristos #define IA64_OPCODE_NO_PRED (1<<5) /* insn cannot be predicated */ 33598b9484cSchristos #define IA64_OPCODE_PSEUDO (1<<6) /* insn is a pseudo-op */ 33698b9484cSchristos #define IA64_OPCODE_F2_EQ_F3 (1<<7) /* constraint: F2 == F3 */ 33798b9484cSchristos #define IA64_OPCODE_LEN_EQ_64MCNT (1<<8) /* constraint: LEN == 64-CNT */ 33898b9484cSchristos #define IA64_OPCODE_MOD_RRBS (1<<9) /* modifies all rrbs in CFM */ 33998b9484cSchristos #define IA64_OPCODE_POSTINC (1<<10) /* postincrement MR3 operand */ 34098b9484cSchristos 34198b9484cSchristos /* A macro to extract the major opcode from an instruction. */ 34298b9484cSchristos #define IA64_OP(i) (((i) >> 37) & 0xf) 34398b9484cSchristos 34498b9484cSchristos enum ia64_operand_class 34598b9484cSchristos { 34698b9484cSchristos IA64_OPND_CLASS_CST, /* constant */ 34798b9484cSchristos IA64_OPND_CLASS_REG, /* register */ 34898b9484cSchristos IA64_OPND_CLASS_IND, /* indirect register */ 34998b9484cSchristos IA64_OPND_CLASS_ABS, /* absolute value */ 35098b9484cSchristos IA64_OPND_CLASS_REL, /* IP-relative value */ 35198b9484cSchristos }; 35298b9484cSchristos 35398b9484cSchristos /* The operands table is an array of struct ia64_operand. */ 35498b9484cSchristos 35598b9484cSchristos struct ia64_operand 35698b9484cSchristos { 35798b9484cSchristos enum ia64_operand_class op_class; 35898b9484cSchristos 35998b9484cSchristos /* Set VALUE as the operand bits for the operand of type SELF in the 36098b9484cSchristos instruction pointed to by CODE. If an error occurs, *CODE is not 36198b9484cSchristos modified and the returned string describes the cause of the 36298b9484cSchristos error. If no error occurs, NULL is returned. */ 36398b9484cSchristos const char *(*insert) (const struct ia64_operand *self, ia64_insn value, 36498b9484cSchristos ia64_insn *code); 36598b9484cSchristos 36698b9484cSchristos /* Extract the operand bits for an operand of type SELF from 36798b9484cSchristos instruction CODE store them in *VALUE. If an error occurs, the 36898b9484cSchristos cause of the error is described by the string returned. If no 36998b9484cSchristos error occurs, NULL is returned. */ 37098b9484cSchristos const char *(*extract) (const struct ia64_operand *self, ia64_insn code, 37198b9484cSchristos ia64_insn *value); 37298b9484cSchristos 37398b9484cSchristos /* A string whose meaning depends on the operand class. */ 37498b9484cSchristos 37598b9484cSchristos const char *str; 37698b9484cSchristos 37798b9484cSchristos struct bit_field 37898b9484cSchristos { 37998b9484cSchristos /* The number of bits in the operand. */ 38098b9484cSchristos int bits; 38198b9484cSchristos 38298b9484cSchristos /* How far the operand is left shifted in the instruction. */ 38398b9484cSchristos int shift; 38498b9484cSchristos } 38598b9484cSchristos field[4]; /* no operand has more than this many bit-fields */ 38698b9484cSchristos 38798b9484cSchristos unsigned int flags; 38898b9484cSchristos 38998b9484cSchristos const char *desc; /* brief description */ 39098b9484cSchristos }; 39198b9484cSchristos 39298b9484cSchristos /* Values defined for the flags field of a struct ia64_operand. */ 39398b9484cSchristos 39498b9484cSchristos /* Disassemble as signed decimal (instead of hex): */ 39598b9484cSchristos #define IA64_OPND_FLAG_DECIMAL_SIGNED (1<<0) 39698b9484cSchristos /* Disassemble as unsigned decimal (instead of hex): */ 39798b9484cSchristos #define IA64_OPND_FLAG_DECIMAL_UNSIGNED (1<<1) 39898b9484cSchristos 39998b9484cSchristos extern const struct ia64_templ_desc ia64_templ_desc[16]; 40098b9484cSchristos 40198b9484cSchristos /* The tables are sorted by major opcode number and are otherwise in 40298b9484cSchristos the order in which the disassembler should consider instructions. */ 40398b9484cSchristos extern struct ia64_opcode ia64_opcodes_a[]; 40498b9484cSchristos extern struct ia64_opcode ia64_opcodes_i[]; 40598b9484cSchristos extern struct ia64_opcode ia64_opcodes_m[]; 40698b9484cSchristos extern struct ia64_opcode ia64_opcodes_b[]; 40798b9484cSchristos extern struct ia64_opcode ia64_opcodes_f[]; 40898b9484cSchristos extern struct ia64_opcode ia64_opcodes_d[]; 40998b9484cSchristos 41098b9484cSchristos 41198b9484cSchristos extern struct ia64_opcode *ia64_find_opcode (const char *); 41298b9484cSchristos extern struct ia64_opcode *ia64_find_next_opcode (struct ia64_opcode *); 41398b9484cSchristos 41498b9484cSchristos extern struct ia64_opcode *ia64_dis_opcode (ia64_insn, 41598b9484cSchristos enum ia64_insn_type); 41698b9484cSchristos 41798b9484cSchristos extern void ia64_free_opcode (struct ia64_opcode *); 41898b9484cSchristos extern const struct ia64_dependency *ia64_find_dependency (int); 41998b9484cSchristos 42098b9484cSchristos /* To avoid circular library dependencies, this array is implemented 42198b9484cSchristos in bfd/cpu-ia64-opc.c: */ 42298b9484cSchristos extern const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT]; 42398b9484cSchristos 424ba340e45Schristos #ifdef __cplusplus 425ba340e45Schristos } 426ba340e45Schristos #endif 427ba340e45Schristos 42898b9484cSchristos #endif /* opcode_ia64_h */ 429