MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
autogen.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/axm.h>
4#include <mim/plugin.h>
5
6/// @namespace mim::plug::arm @ref arm
7namespace mim {
8namespace plug::arm {
9
10static constexpr plugin_t Plugin_Id = 0x933800000000000;
11
12/// @name `arm.reg`
13///@{
14enum class reg : flags_t {
15 x0 = 0x933800000000000,
16 x1 = 0x933800000000001,
17 x2 = 0x933800000000002,
18 x3 = 0x933800000000003,
19 x4 = 0x933800000000004,
20 x5 = 0x933800000000005,
21 x6 = 0x933800000000006,
22 x7 = 0x933800000000007,
23 x8 = 0x933800000000008,
24 x9 = 0x933800000000009,
25 x10 = 0x93380000000000a,
26 x11 = 0x93380000000000b,
27 x12 = 0x93380000000000c,
28 x13 = 0x93380000000000d,
29 x14 = 0x93380000000000e,
30 x15 = 0x93380000000000f,
31 x16 = 0x933800000000010,
32 x17 = 0x933800000000011,
33 x18 = 0x933800000000012,
34 x19 = 0x933800000000013,
35 x20 = 0x933800000000014,
36 x21 = 0x933800000000015,
37 x22 = 0x933800000000016,
38 x23 = 0x933800000000017,
39 x24 = 0x933800000000018,
40 x25 = 0x933800000000019,
41 x26 = 0x93380000000001a,
42 x27 = 0x93380000000001b,
43 x28 = 0x93380000000001c,
44 x29 = 0x93380000000001d,
45 x30 = 0x93380000000001e,
46};
47
48///@}
49
50/// @name `arm.fpr`
51///@{
52enum class fpr : flags_t {
53 d0 = 0x933800000000100,
54 d1 = 0x933800000000101,
55 d2 = 0x933800000000102,
56 d3 = 0x933800000000103,
57 d4 = 0x933800000000104,
58 d5 = 0x933800000000105,
59 d6 = 0x933800000000106,
60 d7 = 0x933800000000107,
61 d8 = 0x933800000000108,
62 d9 = 0x933800000000109,
63 d10 = 0x93380000000010a,
64 d11 = 0x93380000000010b,
65 d12 = 0x93380000000010c,
66 d13 = 0x93380000000010d,
67 d14 = 0x93380000000010e,
68 d15 = 0x93380000000010f,
69 d16 = 0x933800000000110,
70 d17 = 0x933800000000111,
71 d18 = 0x933800000000112,
72 d19 = 0x933800000000113,
73 d20 = 0x933800000000114,
74 d21 = 0x933800000000115,
75 d22 = 0x933800000000116,
76 d23 = 0x933800000000117,
77 d24 = 0x933800000000118,
78 d25 = 0x933800000000119,
79 d26 = 0x93380000000011a,
80 d27 = 0x93380000000011b,
81 d28 = 0x93380000000011c,
82 d29 = 0x93380000000011d,
83 d30 = 0x93380000000011e,
84 d31 = 0x93380000000011f,
85};
86
87///@}
88
89/// @name `arm.load`
90///@{
91enum class load : flags_t {
92};
93
94///@}
95
96/// @name `arm.store`
97///@{
98enum class store : flags_t {
99};
100
101///@}
102
103/// @name `arm.add`
104///@{
105enum class add : flags_t {
106};
107
108///@}
109
110/// @name `arm.sub`
111///@{
112enum class sub : flags_t {
113};
114
115///@}
116
117/// @name `arm.and`
118///@{
119enum class and_ : flags_t {
120};
121
122///@}
123
124/// @name `arm.or`
125///@{
126enum class or_ : flags_t {
127};
128
129///@}
130
131/// @name `arm.xor`
132///@{
133enum class xor_ : flags_t {
134};
135
136///@}
137
138/// @name `arm.mul`
139///@{
140enum class mul : flags_t {
141};
142
143///@}
144
145/// @name `arm.madd`
146///@{
147enum class madd : flags_t {
148};
149
150///@}
151
152/// @name `arm.shl`
153///@{
154enum class shl : flags_t {
155};
156
157///@}
158
159/// @name `arm.shr`
160///@{
161enum class shr : flags_t {
162};
163
164///@}
165
166/// @name `arm.sar`
167///@{
168enum class sar : flags_t {
169};
170
171///@}
172
173/// @name `arm.udiv`
174///@{
175enum class udiv : flags_t {
176};
177
178///@}
179
180/// @name `arm.sdiv`
181///@{
182enum class sdiv : flags_t {
183};
184
185///@}
186
187/// @name `arm.sext`
188///@{
189enum class sext : flags_t {
190};
191
192const Def* normalize_sext(const Def*, const Def*, const Def*);
193///@}
194
195/// @name `arm.trunc`
196///@{
197enum class trunc : flags_t {
198};
199
200const Def* normalize_trunc(const Def*, const Def*, const Def*);
201///@}
202
203/// @name `arm.zero`
204///@{
205enum class zero : flags_t {
206};
207
208const Def* normalize_zero(const Def*, const Def*, const Def*);
209///@}
210
211/// @name `arm.cmp`
212///@{
213enum class cmp : flags_t {
214};
215
216///@}
217
218/// @name `arm.csel`
219///@{
220enum class csel : flags_t {
221 eq = 0x933800000001400,
222 ne = 0x933800000001401,
223 cs = 0x933800000001402,
224 cc = 0x933800000001403,
225 mi = 0x933800000001404,
226 pl = 0x933800000001405,
227 vs = 0x933800000001406,
228 vc = 0x933800000001407,
229 hi = 0x933800000001408,
230 ls = 0x933800000001409,
231 ge = 0x93380000000140a,
232 lt = 0x93380000000140b,
233 gt = 0x93380000000140c,
234 le = 0x93380000000140d,
235 al = 0x93380000000140e,
236 nv = 0x93380000000140f,
237};
238
239template<csel>
240const Def* normalize_csel(const Def*, const Def*, const Def*);
241
242///@}
243
244/// @name `arm.fcsel`
245///@{
246enum class fcsel : flags_t {
247 eq = 0x933800000001500,
248 ne = 0x933800000001501,
249 cs = 0x933800000001502,
250 cc = 0x933800000001503,
251 mi = 0x933800000001504,
252 pl = 0x933800000001505,
253 vs = 0x933800000001506,
254 vc = 0x933800000001507,
255 hi = 0x933800000001508,
256 ls = 0x933800000001509,
257 ge = 0x93380000000150a,
258 lt = 0x93380000000150b,
259 gt = 0x93380000000150c,
260 le = 0x93380000000150d,
261 al = 0x93380000000150e,
262 nv = 0x93380000000150f,
263};
264
265template<fcsel>
266const Def* normalize_fcsel(const Def*, const Def*, const Def*);
267
268///@}
269
270/// @name `arm.cc`
271///@{
272enum class cc : flags_t {
273 eq = 0x933800000001600,
274 ne = 0x933800000001601,
275 cs = 0x933800000001602,
276 cc = 0x933800000001603,
277 mi = 0x933800000001604,
278 pl = 0x933800000001605,
279 vs = 0x933800000001606,
280 vc = 0x933800000001607,
281 hi = 0x933800000001608,
282 ls = 0x933800000001609,
283 ge = 0x93380000000160a,
284 lt = 0x93380000000160b,
285 gt = 0x93380000000160c,
286 le = 0x93380000000160d,
287 al = 0x93380000000160e,
288 nv = 0x93380000000160f,
289};
290
291///@}
292
293/// @name `arm.fmov`
294///@{
295enum class fmov : flags_t {
296};
297
298///@}
299
300/// @name `arm.fload`
301///@{
302enum class fload : flags_t {
303};
304
305///@}
306
307/// @name `arm.fstore`
308///@{
309enum class fstore : flags_t {
310};
311
312///@}
313
314/// @name `arm.fadd`
315///@{
316enum class fadd : flags_t {
317};
318
319///@}
320
321/// @name `arm.fsub`
322///@{
323enum class fsub : flags_t {
324};
325
326///@}
327
328/// @name `arm.fmul`
329///@{
330enum class fmul : flags_t {
331};
332
333///@}
334
335/// @name `arm.fdiv`
336///@{
337enum class fdiv : flags_t {
338};
339
340///@}
341
342/// @name `arm.fsqrt`
343///@{
344enum class fsqrt : flags_t {
345};
346
347///@}
348
349/// @name `arm.fabs`
350///@{
351enum class fabs : flags_t {
352};
353
354///@}
355
356/// @name `arm.fcmp`
357///@{
358enum class fcmp : flags_t {
359};
360
361///@}
362
363/// @name `arm.i2f`
364///@{
365enum class i2f : flags_t {
366};
367
368///@}
369
370/// @name `arm.u2f`
371///@{
372enum class u2f : flags_t {
373};
374
375///@}
376
377/// @name `arm.f2i`
378///@{
379enum class f2i : flags_t {
380};
381
382///@}
383
384/// @name `arm.f2u`
385///@{
386enum class f2u : flags_t {
387};
388
389///@}
390
391/// @name `arm.f2f`
392///@{
393enum class f2f : flags_t {
394};
395
396///@}
397
398/// @name `arm.isel`
399///@{
400enum class isel : flags_t {
401};
402
403///@}
404
405/// @name `arm.emit`
406///@{
407enum class emit : flags_t {
408};
409
410///@}
411
413
414#define MIM_arm_NORMALIZER_IMPL \
415 void register_normalizers(Normalizers& normalizers) {\
416 normalizers[flags_t(Annex::Base<sext>)] = &normalize_sext; \
417 normalizers[flags_t(Annex::Base<trunc>)] = &normalize_trunc; \
418 normalizers[flags_t(Annex::Base<zero>)] = &normalize_zero; \
419 normalizers[flags_t(csel::eq)] = &normalize_csel<csel::eq>; \
420 normalizers[flags_t(csel::ne)] = &normalize_csel<csel::ne>; \
421 normalizers[flags_t(csel::cs)] = &normalize_csel<csel::cs>; \
422 normalizers[flags_t(csel::cc)] = &normalize_csel<csel::cc>; \
423 normalizers[flags_t(csel::mi)] = &normalize_csel<csel::mi>; \
424 normalizers[flags_t(csel::pl)] = &normalize_csel<csel::pl>; \
425 normalizers[flags_t(csel::vs)] = &normalize_csel<csel::vs>; \
426 normalizers[flags_t(csel::vc)] = &normalize_csel<csel::vc>; \
427 normalizers[flags_t(csel::hi)] = &normalize_csel<csel::hi>; \
428 normalizers[flags_t(csel::ls)] = &normalize_csel<csel::ls>; \
429 normalizers[flags_t(csel::ge)] = &normalize_csel<csel::ge>; \
430 normalizers[flags_t(csel::lt)] = &normalize_csel<csel::lt>; \
431 normalizers[flags_t(csel::gt)] = &normalize_csel<csel::gt>; \
432 normalizers[flags_t(csel::le)] = &normalize_csel<csel::le>; \
433 normalizers[flags_t(csel::al)] = &normalize_csel<csel::al>; \
434 normalizers[flags_t(csel::nv)] = &normalize_csel<csel::nv>; \
435 normalizers[flags_t(fcsel::eq)] = &normalize_fcsel<fcsel::eq>; \
436 normalizers[flags_t(fcsel::ne)] = &normalize_fcsel<fcsel::ne>; \
437 normalizers[flags_t(fcsel::cs)] = &normalize_fcsel<fcsel::cs>; \
438 normalizers[flags_t(fcsel::cc)] = &normalize_fcsel<fcsel::cc>; \
439 normalizers[flags_t(fcsel::mi)] = &normalize_fcsel<fcsel::mi>; \
440 normalizers[flags_t(fcsel::pl)] = &normalize_fcsel<fcsel::pl>; \
441 normalizers[flags_t(fcsel::vs)] = &normalize_fcsel<fcsel::vs>; \
442 normalizers[flags_t(fcsel::vc)] = &normalize_fcsel<fcsel::vc>; \
443 normalizers[flags_t(fcsel::hi)] = &normalize_fcsel<fcsel::hi>; \
444 normalizers[flags_t(fcsel::ls)] = &normalize_fcsel<fcsel::ls>; \
445 normalizers[flags_t(fcsel::ge)] = &normalize_fcsel<fcsel::ge>; \
446 normalizers[flags_t(fcsel::lt)] = &normalize_fcsel<fcsel::lt>; \
447 normalizers[flags_t(fcsel::gt)] = &normalize_fcsel<fcsel::gt>; \
448 normalizers[flags_t(fcsel::le)] = &normalize_fcsel<fcsel::le>; \
449 normalizers[flags_t(fcsel::al)] = &normalize_fcsel<fcsel::al>; \
450 normalizers[flags_t(fcsel::nv)] = &normalize_fcsel<fcsel::nv>; \
451 }
452} // namespace plug::arm
453
454#ifndef DOXYGEN // don't include in Doxygen documentation
455
456template<> constexpr flags_t Annex::Base<plug::arm::reg> = 0x933800000000000;
457template<> constexpr size_t Annex::Num<plug::arm::reg> = 31;
458template<> constexpr flags_t Annex::Base<plug::arm::fpr> = 0x933800000000100;
459template<> constexpr size_t Annex::Num<plug::arm::fpr> = 32;
460template<> constexpr flags_t Annex::Base<plug::arm::load> = 0x933800000000200;
461template<> constexpr size_t Annex::Num<plug::arm::load> = 0;
462template<> constexpr flags_t Annex::Base<plug::arm::store> = 0x933800000000300;
463template<> constexpr size_t Annex::Num<plug::arm::store> = 0;
464template<> constexpr flags_t Annex::Base<plug::arm::add> = 0x933800000000400;
465template<> constexpr size_t Annex::Num<plug::arm::add> = 0;
466template<> constexpr flags_t Annex::Base<plug::arm::sub> = 0x933800000000500;
467template<> constexpr size_t Annex::Num<plug::arm::sub> = 0;
468template<> constexpr flags_t Annex::Base<plug::arm::and_> = 0x933800000000600;
469template<> constexpr size_t Annex::Num<plug::arm::and_> = 0;
470template<> constexpr flags_t Annex::Base<plug::arm::or_> = 0x933800000000700;
471template<> constexpr size_t Annex::Num<plug::arm::or_> = 0;
472template<> constexpr flags_t Annex::Base<plug::arm::xor_> = 0x933800000000800;
473template<> constexpr size_t Annex::Num<plug::arm::xor_> = 0;
474template<> constexpr flags_t Annex::Base<plug::arm::mul> = 0x933800000000900;
475template<> constexpr size_t Annex::Num<plug::arm::mul> = 0;
476template<> constexpr flags_t Annex::Base<plug::arm::madd> = 0x933800000000a00;
477template<> constexpr size_t Annex::Num<plug::arm::madd> = 0;
478template<> constexpr flags_t Annex::Base<plug::arm::shl> = 0x933800000000b00;
479template<> constexpr size_t Annex::Num<plug::arm::shl> = 0;
480template<> constexpr flags_t Annex::Base<plug::arm::shr> = 0x933800000000c00;
481template<> constexpr size_t Annex::Num<plug::arm::shr> = 0;
482template<> constexpr flags_t Annex::Base<plug::arm::sar> = 0x933800000000d00;
483template<> constexpr size_t Annex::Num<plug::arm::sar> = 0;
484template<> constexpr flags_t Annex::Base<plug::arm::udiv> = 0x933800000000e00;
485template<> constexpr size_t Annex::Num<plug::arm::udiv> = 0;
486template<> constexpr flags_t Annex::Base<plug::arm::sdiv> = 0x933800000000f00;
487template<> constexpr size_t Annex::Num<plug::arm::sdiv> = 0;
488template<> constexpr flags_t Annex::Base<plug::arm::sext> = 0x933800000001000;
489template<> constexpr size_t Annex::Num<plug::arm::sext> = 0;
490template<> constexpr flags_t Annex::Base<plug::arm::trunc> = 0x933800000001100;
491template<> constexpr size_t Annex::Num<plug::arm::trunc> = 0;
492template<> constexpr flags_t Annex::Base<plug::arm::zero> = 0x933800000001200;
493template<> constexpr size_t Annex::Num<plug::arm::zero> = 0;
494template<> constexpr flags_t Annex::Base<plug::arm::cmp> = 0x933800000001300;
495template<> constexpr size_t Annex::Num<plug::arm::cmp> = 0;
496template<> constexpr flags_t Annex::Base<plug::arm::csel> = 0x933800000001400;
497template<> constexpr size_t Annex::Num<plug::arm::csel> = 16;
498template<> constexpr flags_t Annex::Base<plug::arm::fcsel> = 0x933800000001500;
499template<> constexpr size_t Annex::Num<plug::arm::fcsel> = 16;
500template<> constexpr flags_t Annex::Base<plug::arm::cc> = 0x933800000001600;
501template<> constexpr size_t Annex::Num<plug::arm::cc> = 16;
502template<> constexpr flags_t Annex::Base<plug::arm::fmov> = 0x933800000001700;
503template<> constexpr size_t Annex::Num<plug::arm::fmov> = 0;
504template<> constexpr flags_t Annex::Base<plug::arm::fload> = 0x933800000001800;
505template<> constexpr size_t Annex::Num<plug::arm::fload> = 0;
506template<> constexpr flags_t Annex::Base<plug::arm::fstore> = 0x933800000001900;
507template<> constexpr size_t Annex::Num<plug::arm::fstore> = 0;
508template<> constexpr flags_t Annex::Base<plug::arm::fadd> = 0x933800000001a00;
509template<> constexpr size_t Annex::Num<plug::arm::fadd> = 0;
510template<> constexpr flags_t Annex::Base<plug::arm::fsub> = 0x933800000001b00;
511template<> constexpr size_t Annex::Num<plug::arm::fsub> = 0;
512template<> constexpr flags_t Annex::Base<plug::arm::fmul> = 0x933800000001c00;
513template<> constexpr size_t Annex::Num<plug::arm::fmul> = 0;
514template<> constexpr flags_t Annex::Base<plug::arm::fdiv> = 0x933800000001d00;
515template<> constexpr size_t Annex::Num<plug::arm::fdiv> = 0;
516template<> constexpr flags_t Annex::Base<plug::arm::fsqrt> = 0x933800000001e00;
517template<> constexpr size_t Annex::Num<plug::arm::fsqrt> = 0;
518template<> constexpr flags_t Annex::Base<plug::arm::fabs> = 0x933800000001f00;
519template<> constexpr size_t Annex::Num<plug::arm::fabs> = 0;
520template<> constexpr flags_t Annex::Base<plug::arm::fcmp> = 0x933800000002000;
521template<> constexpr size_t Annex::Num<plug::arm::fcmp> = 0;
522template<> constexpr flags_t Annex::Base<plug::arm::i2f> = 0x933800000002100;
523template<> constexpr size_t Annex::Num<plug::arm::i2f> = 0;
524template<> constexpr flags_t Annex::Base<plug::arm::u2f> = 0x933800000002200;
525template<> constexpr size_t Annex::Num<plug::arm::u2f> = 0;
526template<> constexpr flags_t Annex::Base<plug::arm::f2i> = 0x933800000002300;
527template<> constexpr size_t Annex::Num<plug::arm::f2i> = 0;
528template<> constexpr flags_t Annex::Base<plug::arm::f2u> = 0x933800000002400;
529template<> constexpr size_t Annex::Num<plug::arm::f2u> = 0;
530template<> constexpr flags_t Annex::Base<plug::arm::f2f> = 0x933800000002500;
531template<> constexpr size_t Annex::Num<plug::arm::f2f> = 0;
532template<> constexpr flags_t Annex::Base<plug::arm::isel> = 0x933800000002600;
533template<> constexpr size_t Annex::Num<plug::arm::isel> = 0;
534template<> constexpr flags_t Annex::Base<plug::arm::emit> = 0x933800000002700;
535template<> constexpr size_t Annex::Num<plug::arm::emit> = 0;
536
537template<> struct Axm::IsANode<plug::arm::reg> { using type = Axm; };
538template<> struct Axm::IsANode<plug::arm::fpr> { using type = Axm; };
539template<> struct Axm::IsANode<plug::arm::isel> { using type = Axm; };
540template<> struct Axm::IsANode<plug::arm::emit> { using type = Axm; };
541
542#endif
543} // namespace mim
544
545#ifndef DOXYGEN // don't include in Doxygen documentation
546
547template<> struct fe::is_bit_enum<mim::plug::arm::reg> : std::true_type {};
548template<> struct fe::is_bit_enum<mim::plug::arm::fpr> : std::true_type {};
549template<> struct fe::is_bit_enum<mim::plug::arm::csel> : std::true_type {};
550template<> struct fe::is_bit_enum<mim::plug::arm::fcsel> : std::true_type {};
551template<> struct fe::is_bit_enum<mim::plug::arm::cc> : std::true_type {};
552
553#endif
Base class for all Defs.
Definition def.h:285
The ARM Plugin
Definition arm.h:11
const Def * normalize_zero(const Def *type, const Def *, const Def *x)
void register_normalizers(Normalizers &normalizers)
const Def * normalize_csel(const Def *type, const Def *, const Def *arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
const Def * normalize_trunc(const Def *type, const Def *, const Def *x)
const Def * normalize_sext(const Def *type, const Def *, const Def *x)
const Def * normalize_fcsel(const Def *type, const Def *, const Def *arg)
Definition ast.h:16
u64 flags_t
Definition types.h:39
ankerl::unordered_dense::map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:28
u64 plugin_t
Definition types.h:40
@ Axm
Definition def.h:123
static constexpr size_t Num
Number of Axm::subtags.
Definition plugin.h:275
static constexpr flags_t Base
Definition plugin.h:276