1 |
19 |
jeremybenn |
/* def_op_t.h -- Operation-generation strucutre definitions helpers
|
2 |
|
|
Copyright (C) 2005 György `nog' Jeney, nog@sdf.lonestar.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
19 |
|
|
|
20 |
|
|
#define GPR_T(op_name, temp) \
|
21 |
|
|
{ NULL, \
|
22 |
|
|
glue(glue(op_name, 1), temp), \
|
23 |
|
|
glue(glue(op_name, 2), temp), \
|
24 |
|
|
glue(glue(op_name, 3), temp), \
|
25 |
|
|
glue(glue(op_name, 4), temp), \
|
26 |
|
|
glue(glue(op_name, 5), temp), \
|
27 |
|
|
glue(glue(op_name, 6), temp), \
|
28 |
|
|
glue(glue(op_name, 7), temp), \
|
29 |
|
|
glue(glue(op_name, 8), temp), \
|
30 |
|
|
glue(glue(op_name, 9), temp), \
|
31 |
|
|
glue(glue(op_name, 10), temp), \
|
32 |
|
|
glue(glue(op_name, 11), temp), \
|
33 |
|
|
glue(glue(op_name, 12), temp), \
|
34 |
|
|
glue(glue(op_name, 13), temp), \
|
35 |
|
|
glue(glue(op_name, 14), temp), \
|
36 |
|
|
glue(glue(op_name, 15), temp), \
|
37 |
|
|
glue(glue(op_name, 16), temp), \
|
38 |
|
|
glue(glue(op_name, 17), temp), \
|
39 |
|
|
glue(glue(op_name, 18), temp), \
|
40 |
|
|
glue(glue(op_name, 19), temp), \
|
41 |
|
|
glue(glue(op_name, 20), temp), \
|
42 |
|
|
glue(glue(op_name, 21), temp), \
|
43 |
|
|
glue(glue(op_name, 22), temp), \
|
44 |
|
|
glue(glue(op_name, 23), temp), \
|
45 |
|
|
glue(glue(op_name, 24), temp), \
|
46 |
|
|
glue(glue(op_name, 25), temp), \
|
47 |
|
|
glue(glue(op_name, 26), temp), \
|
48 |
|
|
glue(glue(op_name, 27), temp), \
|
49 |
|
|
glue(glue(op_name, 28), temp), \
|
50 |
|
|
glue(glue(op_name, 29), temp), \
|
51 |
|
|
glue(glue(op_name, 30), temp), \
|
52 |
|
|
glue(glue(op_name, 31), temp) }
|
53 |
|
|
|
54 |
|
|
#if NUM_T_REGS == 3
|
55 |
|
|
|
56 |
|
|
#define OP_ROW(op_name) \
|
57 |
|
|
{ glue(op_name, _t0), glue(op_name, _t1), glue(op_name, _t2) }
|
58 |
|
|
|
59 |
|
|
#define OP_ROW_NEQ0(op_name) \
|
60 |
|
|
{ NULL, glue(op_name, _t1), glue(op_name, _t2) }
|
61 |
|
|
|
62 |
|
|
#define OP_ROW_NEQ1(op_name) \
|
63 |
|
|
{ glue(op_name, _t0), NULL, glue(op_name, _t2) }
|
64 |
|
|
|
65 |
|
|
#define OP_ROW_NEQ2(op_name) \
|
66 |
|
|
{ glue(op_name, _t0), glue(op_name, _t1), NULL }
|
67 |
|
|
|
68 |
|
|
#define OP_ROW_COL(op_name) { \
|
69 |
|
|
OP_ROW(glue(op_name, _t0)), \
|
70 |
|
|
OP_ROW(glue(op_name, _t1)), \
|
71 |
|
|
OP_ROW(glue(op_name, _t2)), }
|
72 |
|
|
|
73 |
|
|
/* In 3D space: row, column, ??? */
|
74 |
|
|
#define OP_ROW_COL_3D(op_name) { \
|
75 |
|
|
OP_ROW_COL(glue(op_name, _t0)), \
|
76 |
|
|
OP_ROW_COL(glue(op_name, _t1)), \
|
77 |
|
|
OP_ROW_COL(glue(op_name, _t2)) }
|
78 |
|
|
|
79 |
|
|
#define OP_ROW_COL_NEQ(op_name) { \
|
80 |
|
|
OP_ROW_NEQ0(glue(op_name, _t0)), \
|
81 |
|
|
OP_ROW_NEQ1(glue(op_name, _t1)), \
|
82 |
|
|
OP_ROW_NEQ2(glue(op_name, _t2)) }
|
83 |
|
|
|
84 |
|
|
#define OP_ROW_COL_NEQ0(op_name) { \
|
85 |
|
|
OP_ROW_NEQ0(glue(op_name, _t0)), \
|
86 |
|
|
OP_ROW(glue(op_name, _t1)), \
|
87 |
|
|
OP_ROW(glue(op_name, _t2)) }
|
88 |
|
|
|
89 |
|
|
#define OP_ROW_COL_NEQ1(op_name) { \
|
90 |
|
|
OP_ROW(glue(op_name, _t0)), \
|
91 |
|
|
OP_ROW_NEQ1(glue(op_name, _t1)), \
|
92 |
|
|
OP_ROW(glue(op_name, _t2)) }
|
93 |
|
|
|
94 |
|
|
#define OP_ROW_COL_NEQ2(op_name) { \
|
95 |
|
|
OP_ROW(glue(op_name, _t0)), \
|
96 |
|
|
OP_ROW(glue(op_name, _t1)), \
|
97 |
|
|
OP_ROW_NEQ2(glue(op_name, _t2)) }
|
98 |
|
|
|
99 |
|
|
#define OP_ROW_COL_3D_NEQ(op_name) { \
|
100 |
|
|
OP_ROW_COL_NEQ0(glue(op_name, _t0)), \
|
101 |
|
|
OP_ROW_COL_NEQ1(glue(op_name, _t1)), \
|
102 |
|
|
OP_ROW_COL_NEQ2(glue(op_name, _t2)) }
|
103 |
|
|
|
104 |
|
|
#define GPR_ROW_COL(op_name) { \
|
105 |
|
|
GPR_T(op_name, _t0), \
|
106 |
|
|
GPR_T(op_name, _t1), \
|
107 |
|
|
GPR_T(op_name, _t2) }
|
108 |
|
|
|
109 |
|
|
#else
|
110 |
|
|
#error Update def_op_t.h for NUM_T_REGS temporaries
|
111 |
|
|
#endif
|
112 |
|
|
|
113 |
|
|
#define DEF_1T_OP(type, name, op_name) \
|
114 |
|
|
static const type name[NUM_T_REGS] = \
|
115 |
|
|
OP_ROW(op_name)
|
116 |
|
|
|
117 |
|
|
#define DEF_2T_OP(type, name, op_name) \
|
118 |
|
|
static const type name[NUM_T_REGS][NUM_T_REGS] = \
|
119 |
|
|
OP_ROW_COL(op_name)
|
120 |
|
|
|
121 |
|
|
#define DEF_3T_OP(type, name, op_name) \
|
122 |
|
|
static const type name[NUM_T_REGS][NUM_T_REGS][NUM_T_REGS] = \
|
123 |
|
|
OP_ROW_COL_3D(op_name)
|
124 |
|
|
|
125 |
|
|
/* Same as above but put NULL in places where T0 == T1 */
|
126 |
|
|
#define DEF_2T_OP_NEQ(type, name, op_name) \
|
127 |
|
|
static const type name[NUM_T_REGS][NUM_T_REGS] = \
|
128 |
|
|
OP_ROW_COL_NEQ(op_name)
|
129 |
|
|
|
130 |
|
|
/* Same as above but put NULL in places where T0 == T1 == T2 */
|
131 |
|
|
#define DEF_3T_OP_NEQ(type, name, op_name) \
|
132 |
|
|
static const type name[NUM_T_REGS][NUM_T_REGS][NUM_T_REGS] = \
|
133 |
|
|
OP_ROW_COL_3D_NEQ(op_name)
|
134 |
|
|
|
135 |
|
|
#define DEF_GPR_OP(type, name, op_name) \
|
136 |
|
|
static const generic_gen_op name[NUM_T_REGS][32] = \
|
137 |
|
|
GPR_ROW_COL(op_name)
|
138 |
|
|
|