NASM 0.96
[platform/upstream/nasm.git] / insns.h
1 /* insns.h   header file for insns.c
2  *
3  * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4  * Julian Hall. All rights reserved. The software is
5  * redistributable under the licence given in the file "Licence"
6  * distributed in the NASM archive.
7  */
8
9 #ifndef NASM_INSNS_H
10 #define NASM_INSNS_H
11
12 struct itemplate {
13     int opcode;                        /* the token, passed from "parser.c" */
14     int operands;                      /* number of operands */
15     long opd[3];                       /* bit flags for operand types */
16     char *code;                        /* the code it assembles to */
17     int flags;                         /* some flags */
18 };
19
20 /*
21  * Instruction template flags. These specify which processor
22  * targets the instruction is eligible for, whether it is
23  * privileged or undocumented, and also specify extra error
24  * checking on the matching of the instruction.
25  *
26  * IF_SM stands for Size Match: any operand whose size is not
27  * explicitly specified by the template is `really' intended to be
28  * the same size as the first size-specified operand.
29  * Non-specification is tolerated in the input instruction, but
30  * _wrong_ specification is not.
31  *
32  * IF_SM2 invokes Size Match on only the first _two_ operands, for
33  * three-operand instructions such as SHLD: it implies that the
34  * first two operands must match in size, but that the third is
35  * required to be _unspecified_.
36  *
37  * IF_SB invokes Size Byte: operands with unspecified size in the
38  * template are really bytes, and so no non-byte specification in
39  * the input instruction will be tolerated. IF_SW similarly invokes
40  * Size Word, and IF_SD invokes Size Doubleword.
41  *
42  * (The default state if neither IF_SM nor IF_SM2 is specified is
43  * that any operand with unspecified size in the template is
44  * required to have unspecified size in the instruction too...)
45  */
46
47 #define IF_SM     0x0001               /* size match */
48 #define IF_SM2    0x0002               /* size match first two operands */
49 #define IF_SB     0x0004               /* unsized operands can't be non-byte */
50 #define IF_SW     0x0008               /* unsized operands can't be non-word */
51 #define IF_SD     0x0010               /* unsized operands can't be nondword */
52 #define IF_8086   0x0000               /* 8086 instruction */
53 #define IF_186    0x0100               /* 186+ instruction */
54 #define IF_286    0x0200               /* 286+ instruction */
55 #define IF_386    0x0300               /* 386+ instruction */
56 #define IF_486    0x0400               /* 486+ instruction */
57 #define IF_PENT   0x0500               /* Pentium instruction */
58 #define IF_P6     0x0600               /* P6 instruction */
59 #define IF_CYRIX  0x0800               /* Cyrix-specific instruction */
60 #define IF_PMASK  0x0F00               /* the mask for processor types */
61 #define IF_PRIV   0x1000               /* it's a privileged instruction */
62 #define IF_UNDOC  0x2000               /* it's an undocumented instruction */
63 #define IF_FPU    0x4000               /* it's an FPU instruction */
64 #define IF_MMX    0x8000               /* it's an MMX instruction */
65
66 #endif