home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / cctools / include / mach-o / m88k / parseinst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-18  |  3.9 KB  |  200 lines

  1. /*
  2.  * This file discribes the 88k instruction parser functions and data types.
  3.  */
  4.  
  5. /*
  6.  * The instruction types.
  7.  */
  8. enum m88k_instruction_type {
  9.     M88K_NONE,
  10.     M88K_ADD,
  11.     M88K_ADDU,
  12.     M88K_AND,
  13.     M88K_BB0,
  14.     M88K_BB1,
  15.     M88K_BCND,
  16.     M88K_BR,
  17.     M88K_BSR,
  18.     M88K_CLR,
  19.     M88K_CMP,
  20.     M88K_DIVS,
  21.     M88K_DIVU,
  22.     M88K_EXT,
  23.     M88K_EXTU,
  24.     M88K_FADD,
  25.     M88K_FCMP,
  26.     M88K_FCMPU,
  27.     M88K_FCVT,
  28.     M88K_FDIV,
  29.     M88K_FF0,
  30.     M88K_FF1,
  31.     M88K_FLDCR,
  32.     M88K_FLT,
  33.     M88K_FMUL,
  34.     M88K_FSQRT,
  35.     M88K_FSTCR,
  36.     M88K_FSUB,
  37.     M88K_FXCR,
  38.     M88K_ILLOP1,
  39.     M88K_ILLOP2,
  40.     M88K_ILLOP3,
  41.     M88K_INT,
  42.     M88K_JMP,
  43.     M88K_JSR,
  44.     M88K_LD,
  45.     M88K_LDA,
  46.     M88K_LDCR,
  47.     M88K_MAK,
  48.     M88K_MASK,
  49.     M88K_MOV,
  50.     M88K_MULS,
  51.     M88K_MULU,
  52.     M88K_NINT,
  53.     M88K_OR,
  54.     M88K_PADD,
  55.     M88K_PADDS,
  56.     M88K_PCMP,
  57.     M88K_PMUL,
  58.     M88K_PPACK,
  59.     M88K_PROT,
  60.     M88K_PSUB,
  61.     M88K_PSUBS,
  62.     M88K_PUNPK,
  63.     M88K_ROT,
  64.     M88K_RTE,
  65.     M88K_SET,
  66.     M88K_ST,
  67.     M88K_STCR,
  68.     M88K_SUB,
  69.     M88K_SUBU,
  70.     M88K_TB0,
  71.     M88K_TB1,
  72.     M88K_TBND,
  73.     M88K_TCND,
  74.     M88K_TRNC,
  75.     M88K_XCR,
  76.     M88K_XMEM,
  77.     M88K_XOR
  78. };
  79.  
  80. /*
  81.  * The operand types.
  82.  */
  83. enum m88k_operand_type {
  84.     M88K_OT_NONE,
  85.     /* register operands */
  86.     M88K_OT_GREG,
  87.     M88K_OT_CREG,
  88.     M88K_OT_FCREG,
  89.     M88K_OT_XREG,
  90.     /* non-register operands */
  91.     M88K_OT_IMMED_16,
  92.     M88K_OT_DISP_16,
  93.     M88K_OT_DISP_26,
  94.     M88K_OT_BIT_FIELD, /* bit field width and bit field offset */
  95.     M88K_OT_BIT_OFFSET, /* only bit offset (rot instruction only) */
  96.     M88K_OT_BIT_NUMBER,
  97.     M88K_OT_COND_MATCH,
  98.     M88K_OT_VEC_NUMBER,
  99.     M88K_OT_PIXEL_ROTATE /* 64 bit rotate encoded in 4 bits (value times 4) */
  100. };
  101.  
  102. /*
  103.  * The operand formats.
  104.  */
  105. enum m88k_operand_format {
  106.     M88K_OF_NONE,
  107.     M88K_OF_SINGLE_WORD,
  108.     M88K_OF_DOUBLE_WORD,
  109.     M88K_OF_QUAD_WORD,
  110.  
  111.     M88K_OF_FPSINGLE,
  112.     M88K_OF_FPDOUBLE,
  113.     M88K_OF_FPEXTENDED
  114. };
  115.  
  116. /*
  117.  * The memory sizes effected by load/store/xmem.
  118.  */
  119. enum m88k_memory_size {
  120.     M88K_MS_NONE,
  121.     M88K_MS_BYTE,
  122.     M88K_MS_HALF_WORD,
  123.     M88K_MS_SINGLE_WORD,
  124.     M88K_MS_DOUBLE_WORD,
  125.     M88K_MS_QUAD_WORD
  126. };
  127.  
  128. /*
  129.  * The pixel arithmetic types.
  130.  */
  131. enum m88k_saturating {
  132.     M88K_SAT_NONE,
  133.     M88K_SAT_UNSIGNED,
  134.     M88K_SAT_MIXEDSIGNED,
  135.     M88K_SAT_SIGNED
  136. };
  137.  
  138. /*
  139.  * The pixel widths.
  140.  */
  141. enum m88k_pixel_width {
  142.     M88K_PW_NIBBLE,
  143.     M88K_PW_BYTE,
  144.     M88K_PW_HALF,
  145.     M88K_PW_WORD
  146. };
  147.  
  148. /*
  149.  * The pack shift amount for the ppack instruction.
  150.  */
  151. enum m88k_pixel_pack_shift {
  152.     M88K_PPS_NONE,
  153.     M88K_PPS_8,
  154.     M88K_PPS_16,
  155.     M88K_PPS_32
  156. };
  157.  
  158. /*
  159.  * The structure of a parsed 88k instruction.
  160.  */
  161. struct m88k_parsed_instruction {
  162.     unsigned long opcode;
  163.     enum m88k_instruction_type inst_type:8;
  164.     unsigned long
  165.     carry_in:1,            /* add, addu, sub, subu */
  166.     carry_out:1,            /* add, addu, sub, subu */
  167.     complement_src2:1,        /* and, xor, or (reg) */
  168.     upper_half:1,            /* and, mask, xor, or (immed) */
  169.     execute_next:1,            /* br, bsr, bb0, bb1, bcnd, jmp, jsr */
  170.     write_through:1,        /* st */
  171.     load_unsigned:1,        /* ld.bu, ld.hu, xmem.bu, xmem.hu */
  172.     scaled_index:1,            /* xmem, ld.u, ld, st, lda[] */
  173.     user_memory:1;            /* xmem, ld.u, ld, st */
  174.     enum m88k_memory_size ms:3;    /* xmem, ld.u, ld, st */
  175.     enum m88k_saturating sat:2;    /* padds, psubs */
  176.     enum m88k_pixel_width pw:2;    /* padd,padds,psub,psubs,ppack,punpk */
  177.     enum m88k_pixel_pack_shift pps:2; /* ppack */
  178.  
  179.     enum m88k_operand_type dest_type:4;
  180.     enum m88k_operand_format dest_format:4;
  181.  
  182.     enum m88k_operand_type src1_type:4;
  183.     enum m88k_operand_format src1_format:4;
  184.  
  185.     enum m88k_operand_type src2_type:4;
  186.     enum m88k_operand_format src2_format:4;
  187. };
  188.  
  189. /*
  190.  * m88k_parse_instruction() is passed an opcode and parses it into an 88k
  191.  * parsed instruction pointed to by inst.
  192.  */
  193. extern void
  194. m88k_parse_instruction(
  195.     unsigned long opcode,
  196.     struct m88k_parsed_instruction *inst);
  197.  
  198. /* names of the instruction types indexed by an enum m88k_instruction_type */
  199. extern const char * const m88k_instruction_names[];
  200.