OLD | NEW |
1 //===- subzero/src/IceInstX8632.def - X-macros for x86-32 insts -*- C++ -*-===// | 1 //===- subzero/src/IceInstX8632.def - X-macros for x86-32 insts -*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines properties of lowered x86-32 instructions in the | 10 // This file defines properties of lowered x86-32 instructions in the |
11 // form of x-macros. | 11 // form of x-macros. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef SUBZERO_SRC_ICEINSTX8632_DEF | 15 #ifndef SUBZERO_SRC_ICEINSTX8632_DEF |
16 #define SUBZERO_SRC_ICEINSTX8632_DEF | 16 #define SUBZERO_SRC_ICEINSTX8632_DEF |
17 | 17 |
18 // NOTE: esp is not considered isInt, to avoid register allocating it. | 18 // NOTE: esp is not considered isInt, to avoid register allocating it. |
19 #define REGX8632_TABLE \ | 19 #define REGX8632_GPR_TABLE \ |
20 /* val, init, name, name16, name8, scratch, preserved, stackptr, \ | 20 /* val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
21 frameptr, isI8, isInt, isFP */ \ | 21 frameptr, isI8, isInt, isFP */ \ |
22 X(Reg_eax, = 0, "eax", "ax", "al", 1, 0, 0, 0, 1, 1, 0) \ | 22 X(Reg_eax, = 0, "eax", "ax", "al", 1, 0, 0, 0, 1, 1, 0) \ |
23 X(Reg_ecx, = Reg_eax + 1, "ecx", "cx", "cl", 1, 0, 0, 0, 1, 1, 0) \ | 23 X(Reg_ecx, = Reg_eax + 1, "ecx", "cx", "cl", 1, 0, 0, 0, 1, 1, 0) \ |
24 X(Reg_edx, = Reg_eax + 2, "edx", "dx", "dl", 1, 0, 0, 0, 1, 1, 0) \ | 24 X(Reg_edx, = Reg_eax + 2, "edx", "dx", "dl", 1, 0, 0, 0, 1, 1, 0) \ |
25 X(Reg_ebx, = Reg_eax + 3, "ebx", "bx", "bl", 0, 1, 0, 0, 1, 1, 0) \ | 25 X(Reg_ebx, = Reg_eax + 3, "ebx", "bx", "bl", 0, 1, 0, 0, 1, 1, 0) \ |
26 X(Reg_esp, = Reg_eax + 4, "esp", "sp", "" , 0, 0, 1, 0, 0, 0, 0) \ | 26 X(Reg_esp, = Reg_eax + 4, "esp", "sp", "" , 0, 0, 1, 0, 0, 0, 0) \ |
27 X(Reg_ebp, = Reg_eax + 5, "ebp", "bp", "" , 0, 1, 0, 1, 0, 1, 0) \ | 27 X(Reg_ebp, = Reg_eax + 5, "ebp", "bp", "" , 0, 1, 0, 1, 0, 1, 0) \ |
28 X(Reg_esi, = Reg_eax + 6, "esi", "si", "" , 0, 1, 0, 0, 0, 1, 0) \ | 28 X(Reg_esi, = Reg_eax + 6, "esi", "si", "" , 0, 1, 0, 0, 0, 1, 0) \ |
29 X(Reg_edi, = Reg_eax + 7, "edi", "di", "" , 0, 1, 0, 0, 0, 1, 0) \ | 29 X(Reg_edi, = Reg_eax + 7, "edi", "di", "" , 0, 1, 0, 0, 0, 1, 0) |
30 X(Reg_ah, = Reg_edi + 1, "???", "" , "ah", 0, 0, 0, 0, 1, 0, 0) \ | 30 |
31 X(Reg_xmm0, = Reg_ah + 1, "xmm0", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 31 #define REGX8632_XMM_TABLE \ |
| 32 X(Reg_xmm0, = 0, "xmm0", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
32 X(Reg_xmm1, = Reg_xmm0 + 1, "xmm1", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 33 X(Reg_xmm1, = Reg_xmm0 + 1, "xmm1", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
33 X(Reg_xmm2, = Reg_xmm0 + 2, "xmm2", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 34 X(Reg_xmm2, = Reg_xmm0 + 2, "xmm2", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
34 X(Reg_xmm3, = Reg_xmm0 + 3, "xmm3", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 35 X(Reg_xmm3, = Reg_xmm0 + 3, "xmm3", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
35 X(Reg_xmm4, = Reg_xmm0 + 4, "xmm4", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 36 X(Reg_xmm4, = Reg_xmm0 + 4, "xmm4", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
36 X(Reg_xmm5, = Reg_xmm0 + 5, "xmm5", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 37 X(Reg_xmm5, = Reg_xmm0 + 5, "xmm5", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
37 X(Reg_xmm6, = Reg_xmm0 + 6, "xmm6", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 38 X(Reg_xmm6, = Reg_xmm0 + 6, "xmm6", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
38 X(Reg_xmm7, = Reg_xmm0 + 7, "xmm7", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ | 39 X(Reg_xmm7, = Reg_xmm0 + 7, "xmm7", "" , "" , 1, 0, 0, 0, 0, 0, 1) \ |
39 //#define X(val, init, name, name16, name8, scratch, preserved, stackptr, | 40 //#define X(val, encode, name, name16, name8, scratch, preserved, stackptr, |
40 // frameptr, isI8, isInt, isFP) | 41 // frameptr, isI8, isInt, isFP) |
41 | 42 |
| 43 // We also provide a combined table, so that there is a namespace where |
| 44 // all of the registers are considered and have distinct numberings. |
| 45 // This is in contrast to the above, where the "encode" is based on how |
| 46 // the register numbers will be encoded in binaries and values can overlap. |
| 47 #define REGX8632_TABLE \ |
| 48 /* val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
| 49 frameptr, isI8, isInt, isFP */ \ |
| 50 REGX8632_GPR_TABLE \ |
| 51 X(Reg_ah, = Reg_eax + 4, "???", "" , "ah", 0, 0, 0, 0, 1, 0, 0) \ |
| 52 REGX8632_XMM_TABLE |
| 53 //#define X(val, encode, name, name16, name8, scratch, preserved, stackptr, |
| 54 // frameptr, isI8, isInt, isFP) |
| 55 |
| 56 #define REGX8632_TABLE_BOUNDS \ |
| 57 /* val, init */ \ |
| 58 X(Reg_GPR_First, = Reg_eax) \ |
| 59 X(Reg_GPR_Last, = Reg_edi) \ |
| 60 X(Reg_XMM_First, = Reg_xmm0) \ |
| 61 X(Reg_XMM_Last, = Reg_xmm7) \ |
| 62 //define X(val, init) |
| 63 |
| 64 // We also need the encodings for the Byte registers (other info overlaps |
| 65 // what is in the REGX8632_GPR_TABLE). |
| 66 #define REGX8632_BYTEREG_TABLE \ |
| 67 /* val, encode */ \ |
| 68 X(Reg_al, = 0) \ |
| 69 X(Reg_cl, = 1) \ |
| 70 X(Reg_dl, = 2) \ |
| 71 X(Reg_bl, = 3) \ |
| 72 X(Reg_ah, = 4) |
| 73 //#define X(val, encode) |
| 74 |
42 // X86 segment registers. | 75 // X86 segment registers. |
43 #define SEG_REGX8632_TABLE \ | 76 #define SEG_REGX8632_TABLE \ |
44 /* enum value, name */ \ | 77 /* enum value, name */ \ |
45 X(SegReg_CS, "cs") \ | 78 X(SegReg_CS, "cs") \ |
46 X(SegReg_DS, "ds") \ | 79 X(SegReg_DS, "ds") \ |
47 X(SegReg_ES, "es") \ | 80 X(SegReg_ES, "es") \ |
48 X(SegReg_SS, "ss") \ | 81 X(SegReg_SS, "ss") \ |
49 X(SegReg_FS, "fs") \ | 82 X(SegReg_FS, "fs") \ |
50 X(SegReg_GS, "gs") \ | 83 X(SegReg_GS, "gs") \ |
51 //#define X(val, name) | 84 //#define X(val, name) |
52 | 85 |
53 #define ICEINSTX8632BR_TABLE \ | 86 #define ICEINSTX8632BR_TABLE \ |
54 /* enum value, opposite, dump, emit */ \ | 87 /* enum value, encode, opposite, dump, emit */ \ |
55 X(Br_a, Br_be, "a", "ja") \ | 88 X(Br_o, = 0, Br_no, "o", "jo") \ |
56 X(Br_ae, Br_b, "ae", "jae") \ | 89 X(Br_no, = 1, Br_o, "no", "jno") \ |
57 X(Br_b, Br_ae, "b", "jb") \ | 90 X(Br_b, = 2, Br_ae, "b", "jb") \ |
58 X(Br_be, Br_a, "be", "jbe") \ | 91 X(Br_ae, = 3, Br_b, "ae", "jae") \ |
59 X(Br_e, Br_ne, "e", "je") \ | 92 X(Br_e, = 4, Br_ne, "e", "je") \ |
60 X(Br_g, Br_le, "g", "jg") \ | 93 X(Br_ne, = 5, Br_e, "ne", "jne") \ |
61 X(Br_ge, Br_l, "ge", "jge") \ | 94 X(Br_be, = 6, Br_a, "be", "jbe") \ |
62 X(Br_l, Br_ge, "l", "jl") \ | 95 X(Br_a, = 7, Br_be, "a", "ja") \ |
63 X(Br_le, Br_g, "le", "jle") \ | 96 X(Br_s, = 8, Br_ns, "s", "js") \ |
64 X(Br_ne, Br_e, "ne", "jne") \ | 97 X(Br_ns, = 9, Br_s, "ns", "jns") \ |
65 X(Br_np, Br_p, "np", "jnp") \ | 98 X(Br_p, = 10, Br_np, "p", "jp") \ |
66 X(Br_p, Br_np, "p", "jp") \ | 99 X(Br_np, = 11, Br_p, "np", "jnp") \ |
67 //#define X(tag, opp, dump, emit) | 100 X(Br_l, = 12, Br_ge, "l", "jl") \ |
| 101 X(Br_ge, = 13, Br_l, "ge", "jge") \ |
| 102 X(Br_le, = 14, Br_g, "le", "jle") \ |
| 103 X(Br_g, = 15, Br_le, "g", "jg") \ |
| 104 //#define X(tag, encode, opp, dump, emit) |
68 | 105 |
69 #define ICEINSTX8632CMPPS_TABLE \ | 106 #define ICEINSTX8632CMPPS_TABLE \ |
70 /* enum value, emit */ \ | 107 /* enum value, emit */ \ |
71 X(Cmpps_eq, "eq") \ | 108 X(Cmpps_eq, "eq") \ |
72 X(Cmpps_lt, "lt") \ | 109 X(Cmpps_lt, "lt") \ |
73 X(Cmpps_le, "le") \ | 110 X(Cmpps_le, "le") \ |
74 X(Cmpps_unord, "unord") \ | 111 X(Cmpps_unord, "unord") \ |
75 X(Cmpps_neq, "neq") \ | 112 X(Cmpps_neq, "neq") \ |
76 X(Cmpps_nlt, "nlt") \ | 113 X(Cmpps_nlt, "nlt") \ |
77 X(Cmpps_nle, "nle") \ | 114 X(Cmpps_nle, "nle") \ |
(...skipping 13 matching lines...) Expand all Loading... |
91 X(IceType_v4i1, IceType_i32 , "?" , "" , "d", "xmmword ptr") \ | 128 X(IceType_v4i1, IceType_i32 , "?" , "" , "d", "xmmword ptr") \ |
92 X(IceType_v8i1, IceType_i16 , "?" , "" , "w", "xmmword ptr") \ | 129 X(IceType_v8i1, IceType_i16 , "?" , "" , "w", "xmmword ptr") \ |
93 X(IceType_v16i1, IceType_i8 , "?" , "" , "b", "xmmword ptr") \ | 130 X(IceType_v16i1, IceType_i8 , "?" , "" , "b", "xmmword ptr") \ |
94 X(IceType_v16i8, IceType_i8 , "?" , "" , "b", "xmmword ptr") \ | 131 X(IceType_v16i8, IceType_i8 , "?" , "" , "b", "xmmword ptr") \ |
95 X(IceType_v8i16, IceType_i16 , "?" , "" , "w", "xmmword ptr") \ | 132 X(IceType_v8i16, IceType_i16 , "?" , "" , "w", "xmmword ptr") \ |
96 X(IceType_v4i32, IceType_i32 , "dq", "" , "d", "xmmword ptr") \ | 133 X(IceType_v4i32, IceType_i32 , "dq", "" , "d", "xmmword ptr") \ |
97 X(IceType_v4f32, IceType_f32 , "ps", "" , "" , "xmmword ptr") \ | 134 X(IceType_v4f32, IceType_f32 , "ps", "" , "" , "xmmword ptr") \ |
98 //#define X(tag, elementty, cvt, sdss, width) | 135 //#define X(tag, elementty, cvt, sdss, width) |
99 | 136 |
100 #endif // SUBZERO_SRC_ICEINSTX8632_DEF | 137 #endif // SUBZERO_SRC_ICEINSTX8632_DEF |
OLD | NEW |