1// -*- mode:c++ -*-
2
3// Copyright (c) 2011 ARM Limited
4// All rights reserved
5//
6// The license below extends only to copyright in the software and shall
7// not be construed as granting a license to any other intellectual
8// property including but not limited to intellectual property relating
9// to a hardware implementation of the functionality of the software
10// licensed hereunder.  You may use the software subject to the license
11// terms below provided that you ensure that this notice is replicated
12// unmodified and in its entirety in all distributions of the software,
13// modified or unmodified, in source code or in binary form.
14//
15// Redistribution and use in source and binary forms, with or without
16// modification, are permitted provided that the following conditions are
17// met: redistributions of source code must retain the above copyright
18// notice, this list of conditions and the following disclaimer;
19// redistributions in binary form must reproduce the above copyright
20// notice, this list of conditions and the following disclaimer in the
21// documentation and/or other materials provided with the distribution;
22// neither the name of the copyright holders nor the names of its
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Authors: Gabe Black
39
40def template DataXImmDeclare {{
41class %(class_name)s : public %(base_class)s
42{
43    public:
44        // Constructor
45        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
46                IntRegIndex _op1, uint64_t _imm);
47        Fault execute(ExecContext *, Trace::InstRecord *) const override;
48};
49}};
50
51def template DataXImmConstructor {{
52    %(class_name)s::%(class_name)s(ExtMachInst machInst,
53                                          IntRegIndex _dest,
54                                          IntRegIndex _op1,
55                                          uint64_t _imm)
56        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
57                         _dest, _op1, _imm)
58    {
59        %(constructor)s;
60    }
61}};
62
63def template DataXSRegDeclare {{
64class %(class_name)s : public %(base_class)s
65{
66    public:
67        // Constructor
68        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
69                IntRegIndex _op1, IntRegIndex _op2,
70                int32_t _shiftAmt, ArmShiftType _shiftType);
71        Fault execute(ExecContext *, Trace::InstRecord *) const override;
72};
73}};
74
75def template DataXSRegConstructor {{
76    %(class_name)s::%(class_name)s(ExtMachInst machInst,
77                                          IntRegIndex _dest,
78                                          IntRegIndex _op1,
79                                          IntRegIndex _op2,
80                                          int32_t _shiftAmt,
81                                          ArmShiftType _shiftType)
82        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
83                         _dest, _op1, _op2, _shiftAmt, _shiftType)
84    {
85        %(constructor)s;
86    }
87}};
88
89def template DataXERegDeclare {{
90class %(class_name)s : public %(base_class)s
91{
92    public:
93        // Constructor
94        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
95                IntRegIndex _op1, IntRegIndex _op2,
96                ArmExtendType _extendType, int32_t _shiftAmt);
97        Fault execute(ExecContext *, Trace::InstRecord *) const override;
98};
99}};
100
101def template DataXERegConstructor {{
102    %(class_name)s::%(class_name)s(ExtMachInst machInst,
103                                          IntRegIndex _dest,
104                                          IntRegIndex _op1,
105                                          IntRegIndex _op2,
106                                          ArmExtendType _extendType,
107                                          int32_t _shiftAmt)
108        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
109                         _dest, _op1, _op2, _extendType, _shiftAmt)
110    {
111        %(constructor)s;
112    }
113}};
114
115def template DataX1RegDeclare {{
116class %(class_name)s : public %(base_class)s
117{
118    public:
119        // Constructor
120        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
121                       IntRegIndex _op1);
122        Fault execute(ExecContext *, Trace::InstRecord *) const override;
123};
124}};
125
126def template DataX1RegConstructor {{
127    %(class_name)s::%(class_name)s(ExtMachInst machInst,
128                                          IntRegIndex _dest,
129                                          IntRegIndex _op1)
130        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _op1)
131    {
132        %(constructor)s;
133    }
134}};
135
136def template DataX2RegDeclare {{
137class %(class_name)s : public %(base_class)s
138{
139    public:
140        // Constructor
141        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
142                       IntRegIndex _op1, IntRegIndex _op2);
143        Fault execute(ExecContext *, Trace::InstRecord *) const override;
144};
145}};
146
147def template DataX2RegConstructor {{
148    %(class_name)s::%(class_name)s(ExtMachInst machInst,
149                                          IntRegIndex _dest,
150                                          IntRegIndex _op1,
151                                          IntRegIndex _op2)
152        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
153                         _dest, _op1, _op2)
154    {
155        %(constructor)s;
156    }
157}};
158
159def template DataX2RegImmDeclare {{
160class %(class_name)s : public %(base_class)s
161{
162    public:
163        // Constructor
164        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
165                       IntRegIndex _op1, IntRegIndex _op2, uint64_t _imm);
166        Fault execute(ExecContext *, Trace::InstRecord *) const override;
167};
168}};
169
170def template DataX2RegImmConstructor {{
171    %(class_name)s::%(class_name)s(ExtMachInst machInst,
172                                          IntRegIndex _dest,
173                                          IntRegIndex _op1,
174                                          IntRegIndex _op2,
175                                          uint64_t _imm)
176        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
177                         _dest, _op1, _op2, _imm)
178    {
179        %(constructor)s;
180    }
181}};
182
183def template DataX3RegDeclare {{
184class %(class_name)s : public %(base_class)s
185{
186    public:
187        // Constructor
188        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
189                       IntRegIndex _op1, IntRegIndex _op2, IntRegIndex _op3);
190        Fault execute(ExecContext *, Trace::InstRecord *) const override;
191};
192}};
193
194def template DataX3RegConstructor {{
195    %(class_name)s::%(class_name)s(ExtMachInst machInst,
196                                          IntRegIndex _dest,
197                                          IntRegIndex _op1,
198                                          IntRegIndex _op2,
199                                          IntRegIndex _op3)
200        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
201                         _dest, _op1, _op2, _op3)
202    {
203        %(constructor)s;
204    }
205}};
206
207def template DataXCondCompImmDeclare {{
208class %(class_name)s : public %(base_class)s
209{
210    public:
211        // Constructor
212        %(class_name)s(ExtMachInst machInst, IntRegIndex _op1,
213                       uint64_t _imm, ConditionCode _condCode, uint8_t _defCc);
214        Fault execute(ExecContext *, Trace::InstRecord *) const override;
215};
216}};
217
218def template DataXCondCompImmConstructor {{
219    %(class_name)s::%(class_name)s(ExtMachInst machInst,
220                                          IntRegIndex _op1,
221                                          uint64_t _imm,
222                                          ConditionCode _condCode,
223                                          uint8_t _defCc)
224        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
225                         _op1, _imm, _condCode, _defCc)
226    {
227        %(constructor)s;
228    }
229}};
230
231def template DataXCondCompRegDeclare {{
232class %(class_name)s : public %(base_class)s
233{
234    public:
235        // Constructor
236        %(class_name)s(ExtMachInst machInst, IntRegIndex _op1,
237                       IntRegIndex _op2, ConditionCode _condCode,
238                       uint8_t _defCc);
239        Fault execute(ExecContext *, Trace::InstRecord *) const override;
240};
241}};
242
243def template DataXCondCompRegConstructor {{
244    %(class_name)s::%(class_name)s(ExtMachInst machInst,
245                                          IntRegIndex _op1,
246                                          IntRegIndex _op2,
247                                          ConditionCode _condCode,
248                                          uint8_t _defCc)
249        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
250                         _op1, _op2, _condCode, _defCc)
251    {
252        %(constructor)s;
253    }
254}};
255
256def template DataXCondSelDeclare {{
257class %(class_name)s : public %(base_class)s
258{
259    public:
260        // Constructor
261        %(class_name)s(ExtMachInst machInst, IntRegIndex _dest,
262                       IntRegIndex _op1, IntRegIndex _op2,
263                       ConditionCode _condCode);
264        Fault execute(ExecContext *, Trace::InstRecord *) const override;
265};
266}};
267
268def template DataXCondSelConstructor {{
269    %(class_name)s::%(class_name)s(ExtMachInst machInst,
270                                          IntRegIndex _dest,
271                                          IntRegIndex _op1,
272                                          IntRegIndex _op2,
273                                          ConditionCode _condCode)
274        : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
275                         _dest, _op1, _op2, _condCode)
276    {
277        %(constructor)s;
278    }
279}};
280