MimIR 0.1
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/axiom.h>
4#include <mim/plugin.h>
5
6/// @namespace mim::plug::core @ref core
7namespace mim {
8namespace plug::core {
9
10static constexpr plugin_t Plugin_Id = 0x1104c60000000000;
11
12/// @name %%core.nat
13///@{
14enum class nat : flags_t {
15 add = 0x1104c60000000000,
16 sub = 0x1104c60000000001,
17 mul = 0x1104c60000000002,
18};
19
20template<nat>
22
23///@}
24
25/// @name %%core.ncmp
26///@{
27enum class ncmp : flags_t {
28 gle = 0x1104c60000000100,
29 f = gle,
30 glE = 0x1104c60000000101,
31 e = glE,
32 gLe = 0x1104c60000000102,
33 l = gLe,
34 gLE = 0x1104c60000000103,
35 le = gLE,
36 Gle = 0x1104c60000000104,
37 g = Gle,
38 GlE = 0x1104c60000000105,
39 ge = GlE,
40 GLe = 0x1104c60000000106,
41 ne = GLe,
42 GLE = 0x1104c60000000107,
43 t = GLE,
44};
45
46template<ncmp>
48
49///@}
50
51/// @name %%core.mode
52///@{
53enum class mode : flags_t {
54 us = 0x1104c60000000200,
55 uS = 0x1104c60000000201,
56 Us = 0x1104c60000000202,
57 US = 0x1104c60000000203,
58 nuw = 0x1104c60000000204,
59 nsw = 0x1104c60000000205,
60 nusw = 0x1104c60000000206,
61};
62
63///@}
64
65/// @name %%core.idx
66///@{
67enum class idx : flags_t {
68};
69
71///@}
72
73/// @name %%core.bit1
74///@{
75enum class bit1 : flags_t {
76 f = 0x1104c60000000400,
77 neg = 0x1104c60000000401,
78 id = 0x1104c60000000402,
79 t = 0x1104c60000000403,
80};
81
82template<bit1>
84
85///@}
86
87/// @name %%core.bit2
88///@{
89enum class bit2 : flags_t {
90 f = 0x1104c60000000500,
91 nor = 0x1104c60000000501,
92 nciff = 0x1104c60000000502,
93 nfst = 0x1104c60000000503,
94 niff = 0x1104c60000000504,
95 nsnd = 0x1104c60000000505,
96 xor_ = 0x1104c60000000506,
97 nand = 0x1104c60000000507,
98 and_ = 0x1104c60000000508,
99 nxor = 0x1104c60000000509,
100 snd = 0x1104c6000000050a,
101 iff = 0x1104c6000000050b,
102 fst = 0x1104c6000000050c,
103 ciff = 0x1104c6000000050d,
104 or_ = 0x1104c6000000050e,
105 t = 0x1104c6000000050f,
106};
107
108template<bit2>
110
111///@}
112
113/// @name %%core.shr
114///@{
115enum class shr : flags_t {
116 a = 0x1104c60000000600,
117 l = 0x1104c60000000601,
118};
119
120template<shr>
122
123///@}
124
125/// @name %%core.wrap
126///@{
127enum class wrap : flags_t {
128 add = 0x1104c60000000700,
129 sub = 0x1104c60000000701,
130 mul = 0x1104c60000000702,
131 shl = 0x1104c60000000703,
132};
133
134template<wrap>
136
137///@}
138
139/// @name %%core.minus
140///@{
141enum class minus : flags_t {
142};
143
144///@}
145
146/// @name %%core.div
147///@{
148enum class div : flags_t {
149 sdiv = 0x1104c60000000900,
150 udiv = 0x1104c60000000901,
151 srem = 0x1104c60000000902,
152 urem = 0x1104c60000000903,
153};
154
155template<div>
157
158///@}
159
160/// @name %%core.icmp
161///@{
162enum class icmp : flags_t {
163 xygle = 0x1104c60000000a00,
164 f = xygle,
165 xyglE = 0x1104c60000000a01,
166 e = xyglE,
167 xygLe = 0x1104c60000000a02,
168 xygLE = 0x1104c60000000a03,
169 xyGle = 0x1104c60000000a04,
170 xyGlE = 0x1104c60000000a05,
171 xyGLe = 0x1104c60000000a06,
172 xyGLE = 0x1104c60000000a07,
173 xYgle = 0x1104c60000000a08,
174 xYglE = 0x1104c60000000a09,
175 xYgLe = 0x1104c60000000a0a,
176 sl = xYgLe,
177 xYgLE = 0x1104c60000000a0b,
178 sle = xYgLE,
179 xYGle = 0x1104c60000000a0c,
180 ug = xYGle,
181 xYGlE = 0x1104c60000000a0d,
182 uge = xYGlE,
183 xYGLe = 0x1104c60000000a0e,
184 xYGLE = 0x1104c60000000a0f,
185 Xygle = 0x1104c60000000a10,
186 XyglE = 0x1104c60000000a11,
187 XygLe = 0x1104c60000000a12,
188 ul = XygLe,
189 XygLE = 0x1104c60000000a13,
190 ule = XygLE,
191 XyGle = 0x1104c60000000a14,
192 sg = XyGle,
193 XyGlE = 0x1104c60000000a15,
194 sge = XyGlE,
195 XyGLe = 0x1104c60000000a16,
196 XyGLE = 0x1104c60000000a17,
197 XYgle = 0x1104c60000000a18,
198 XYglE = 0x1104c60000000a19,
199 XYgLe = 0x1104c60000000a1a,
200 XYgLE = 0x1104c60000000a1b,
201 XYGle = 0x1104c60000000a1c,
202 XYGlE = 0x1104c60000000a1d,
203 XYGLe = 0x1104c60000000a1e,
204 ne = XYGLe,
205 XYGLE = 0x1104c60000000a1f,
206 t = XYGLE,
207};
208
209template<icmp>
211
212///@}
213
214/// @name %%core.extrema
215///@{
216enum class extrema : flags_t {
217 sm = 0x1104c60000000b00,
218 umin = sm,
219 sM = 0x1104c60000000b01,
220 umax = sM,
221 Sm = 0x1104c60000000b02,
222 smin = Sm,
223 SM = 0x1104c60000000b03,
224 smax = SM,
225};
226
227template<extrema>
229
230///@}
231
232/// @name %%core.abs
233///@{
234enum class abs : flags_t {
235};
236
238///@}
239
240/// @name %%core.conv
241///@{
242enum class conv : flags_t {
243 s = 0x1104c60000000d00,
244 u = 0x1104c60000000d01,
245};
246
247template<conv>
249
250///@}
251
252/// @name %%core.bitcast
253///@{
254enum class bitcast : flags_t {
255};
256
258///@}
259
260/// @name %%core.trait
261///@{
262enum class trait : flags_t {
263 size = 0x1104c60000000f00,
264 align = 0x1104c60000000f01,
265};
266
267template<trait>
269
270///@}
271
272/// @name %%core.pe
273///@{
274enum class pe : flags_t {
275 hlt = 0x1104c60000001000,
276 run = 0x1104c60000001001,
277 known = 0x1104c60000001002,
278};
279
280template<pe>
282
283///@}
284
285/// @name %%core.zip
286///@{
287enum class zip : flags_t {
288};
289
291///@}
292
294
295#define MIM_core_NORMALIZER_IMPL \
296 void register_normalizers(Normalizers& normalizers) {\
297 normalizers[flags_t(nat::add)] = &normalize_nat<nat::add>; \
298 normalizers[flags_t(nat::sub)] = &normalize_nat<nat::sub>; \
299 normalizers[flags_t(nat::mul)] = &normalize_nat<nat::mul>; \
300 normalizers[flags_t(ncmp::gle)] = &normalize_ncmp<ncmp::gle>; \
301 normalizers[flags_t(ncmp::glE)] = &normalize_ncmp<ncmp::glE>; \
302 normalizers[flags_t(ncmp::gLe)] = &normalize_ncmp<ncmp::gLe>; \
303 normalizers[flags_t(ncmp::gLE)] = &normalize_ncmp<ncmp::gLE>; \
304 normalizers[flags_t(ncmp::Gle)] = &normalize_ncmp<ncmp::Gle>; \
305 normalizers[flags_t(ncmp::GlE)] = &normalize_ncmp<ncmp::GlE>; \
306 normalizers[flags_t(ncmp::GLe)] = &normalize_ncmp<ncmp::GLe>; \
307 normalizers[flags_t(ncmp::GLE)] = &normalize_ncmp<ncmp::GLE>; \
308 normalizers[flags_t(Annex::Base<idx>)] = &normalize_idx; \
309 normalizers[flags_t(bit1::f)] = &normalize_bit1<bit1::f>; \
310 normalizers[flags_t(bit1::neg)] = &normalize_bit1<bit1::neg>; \
311 normalizers[flags_t(bit1::id)] = &normalize_bit1<bit1::id>; \
312 normalizers[flags_t(bit1::t)] = &normalize_bit1<bit1::t>; \
313 normalizers[flags_t(bit2::f)] = &normalize_bit2<bit2::f>; \
314 normalizers[flags_t(bit2::nor)] = &normalize_bit2<bit2::nor>; \
315 normalizers[flags_t(bit2::nciff)] = &normalize_bit2<bit2::nciff>; \
316 normalizers[flags_t(bit2::nfst)] = &normalize_bit2<bit2::nfst>; \
317 normalizers[flags_t(bit2::niff)] = &normalize_bit2<bit2::niff>; \
318 normalizers[flags_t(bit2::nsnd)] = &normalize_bit2<bit2::nsnd>; \
319 normalizers[flags_t(bit2::xor_)] = &normalize_bit2<bit2::xor_>; \
320 normalizers[flags_t(bit2::nand)] = &normalize_bit2<bit2::nand>; \
321 normalizers[flags_t(bit2::and_)] = &normalize_bit2<bit2::and_>; \
322 normalizers[flags_t(bit2::nxor)] = &normalize_bit2<bit2::nxor>; \
323 normalizers[flags_t(bit2::snd)] = &normalize_bit2<bit2::snd>; \
324 normalizers[flags_t(bit2::iff)] = &normalize_bit2<bit2::iff>; \
325 normalizers[flags_t(bit2::fst)] = &normalize_bit2<bit2::fst>; \
326 normalizers[flags_t(bit2::ciff)] = &normalize_bit2<bit2::ciff>; \
327 normalizers[flags_t(bit2::or_)] = &normalize_bit2<bit2::or_>; \
328 normalizers[flags_t(bit2::t)] = &normalize_bit2<bit2::t>; \
329 normalizers[flags_t(shr::a)] = &normalize_shr<shr::a>; \
330 normalizers[flags_t(shr::l)] = &normalize_shr<shr::l>; \
331 normalizers[flags_t(wrap::add)] = &normalize_wrap<wrap::add>; \
332 normalizers[flags_t(wrap::sub)] = &normalize_wrap<wrap::sub>; \
333 normalizers[flags_t(wrap::mul)] = &normalize_wrap<wrap::mul>; \
334 normalizers[flags_t(wrap::shl)] = &normalize_wrap<wrap::shl>; \
335 normalizers[flags_t(div::sdiv)] = &normalize_div<div::sdiv>; \
336 normalizers[flags_t(div::udiv)] = &normalize_div<div::udiv>; \
337 normalizers[flags_t(div::srem)] = &normalize_div<div::srem>; \
338 normalizers[flags_t(div::urem)] = &normalize_div<div::urem>; \
339 normalizers[flags_t(icmp::xygle)] = &normalize_icmp<icmp::xygle>; \
340 normalizers[flags_t(icmp::xyglE)] = &normalize_icmp<icmp::xyglE>; \
341 normalizers[flags_t(icmp::xygLe)] = &normalize_icmp<icmp::xygLe>; \
342 normalizers[flags_t(icmp::xygLE)] = &normalize_icmp<icmp::xygLE>; \
343 normalizers[flags_t(icmp::xyGle)] = &normalize_icmp<icmp::xyGle>; \
344 normalizers[flags_t(icmp::xyGlE)] = &normalize_icmp<icmp::xyGlE>; \
345 normalizers[flags_t(icmp::xyGLe)] = &normalize_icmp<icmp::xyGLe>; \
346 normalizers[flags_t(icmp::xyGLE)] = &normalize_icmp<icmp::xyGLE>; \
347 normalizers[flags_t(icmp::xYgle)] = &normalize_icmp<icmp::xYgle>; \
348 normalizers[flags_t(icmp::xYglE)] = &normalize_icmp<icmp::xYglE>; \
349 normalizers[flags_t(icmp::xYgLe)] = &normalize_icmp<icmp::xYgLe>; \
350 normalizers[flags_t(icmp::xYgLE)] = &normalize_icmp<icmp::xYgLE>; \
351 normalizers[flags_t(icmp::xYGle)] = &normalize_icmp<icmp::xYGle>; \
352 normalizers[flags_t(icmp::xYGlE)] = &normalize_icmp<icmp::xYGlE>; \
353 normalizers[flags_t(icmp::xYGLe)] = &normalize_icmp<icmp::xYGLe>; \
354 normalizers[flags_t(icmp::xYGLE)] = &normalize_icmp<icmp::xYGLE>; \
355 normalizers[flags_t(icmp::Xygle)] = &normalize_icmp<icmp::Xygle>; \
356 normalizers[flags_t(icmp::XyglE)] = &normalize_icmp<icmp::XyglE>; \
357 normalizers[flags_t(icmp::XygLe)] = &normalize_icmp<icmp::XygLe>; \
358 normalizers[flags_t(icmp::XygLE)] = &normalize_icmp<icmp::XygLE>; \
359 normalizers[flags_t(icmp::XyGle)] = &normalize_icmp<icmp::XyGle>; \
360 normalizers[flags_t(icmp::XyGlE)] = &normalize_icmp<icmp::XyGlE>; \
361 normalizers[flags_t(icmp::XyGLe)] = &normalize_icmp<icmp::XyGLe>; \
362 normalizers[flags_t(icmp::XyGLE)] = &normalize_icmp<icmp::XyGLE>; \
363 normalizers[flags_t(icmp::XYgle)] = &normalize_icmp<icmp::XYgle>; \
364 normalizers[flags_t(icmp::XYglE)] = &normalize_icmp<icmp::XYglE>; \
365 normalizers[flags_t(icmp::XYgLe)] = &normalize_icmp<icmp::XYgLe>; \
366 normalizers[flags_t(icmp::XYgLE)] = &normalize_icmp<icmp::XYgLE>; \
367 normalizers[flags_t(icmp::XYGle)] = &normalize_icmp<icmp::XYGle>; \
368 normalizers[flags_t(icmp::XYGlE)] = &normalize_icmp<icmp::XYGlE>; \
369 normalizers[flags_t(icmp::XYGLe)] = &normalize_icmp<icmp::XYGLe>; \
370 normalizers[flags_t(icmp::XYGLE)] = &normalize_icmp<icmp::XYGLE>; \
371 normalizers[flags_t(extrema::sm)] = &normalize_extrema<extrema::sm>; \
372 normalizers[flags_t(extrema::sM)] = &normalize_extrema<extrema::sM>; \
373 normalizers[flags_t(extrema::Sm)] = &normalize_extrema<extrema::Sm>; \
374 normalizers[flags_t(extrema::SM)] = &normalize_extrema<extrema::SM>; \
375 normalizers[flags_t(Annex::Base<abs>)] = &normalize_abs; \
376 normalizers[flags_t(conv::s)] = &normalize_conv<conv::s>; \
377 normalizers[flags_t(conv::u)] = &normalize_conv<conv::u>; \
378 normalizers[flags_t(Annex::Base<bitcast>)] = &normalize_bitcast; \
379 normalizers[flags_t(trait::size)] = &normalize_trait<trait::size>; \
380 normalizers[flags_t(trait::align)] = &normalize_trait<trait::align>; \
381 normalizers[flags_t(pe::hlt)] = &normalize_pe<pe::hlt>; \
382 normalizers[flags_t(pe::run)] = &normalize_pe<pe::run>; \
383 normalizers[flags_t(pe::known)] = &normalize_pe<pe::known>; \
384 normalizers[flags_t(Annex::Base<zip>)] = &normalize_zip; \
385 }
386} // namespace plug::core
387
388#ifndef DOXYGEN // don't include in Doxygen documentation
389
390template<> constexpr flags_t Annex::Base<plug::core::nat> = 0x1104c60000000000;
391template<> constexpr size_t Annex::Num<plug::core::nat> = 3;
392template<> constexpr flags_t Annex::Base<plug::core::ncmp> = 0x1104c60000000100;
393template<> constexpr size_t Annex::Num<plug::core::ncmp> = 8;
394template<> constexpr flags_t Annex::Base<plug::core::mode> = 0x1104c60000000200;
395template<> constexpr size_t Annex::Num<plug::core::mode> = 7;
396template<> constexpr flags_t Annex::Base<plug::core::idx> = 0x1104c60000000300;
397template<> constexpr size_t Annex::Num<plug::core::idx> = 0;
398template<> constexpr flags_t Annex::Base<plug::core::bit1> = 0x1104c60000000400;
399template<> constexpr size_t Annex::Num<plug::core::bit1> = 4;
400template<> constexpr flags_t Annex::Base<plug::core::bit2> = 0x1104c60000000500;
401template<> constexpr size_t Annex::Num<plug::core::bit2> = 16;
402template<> constexpr flags_t Annex::Base<plug::core::shr> = 0x1104c60000000600;
403template<> constexpr size_t Annex::Num<plug::core::shr> = 2;
404template<> constexpr flags_t Annex::Base<plug::core::wrap> = 0x1104c60000000700;
405template<> constexpr size_t Annex::Num<plug::core::wrap> = 4;
406template<> constexpr flags_t Annex::Base<plug::core::minus> = 0x1104c60000000800;
407template<> constexpr size_t Annex::Num<plug::core::minus> = 0;
408template<> constexpr flags_t Annex::Base<plug::core::div> = 0x1104c60000000900;
409template<> constexpr size_t Annex::Num<plug::core::div> = 4;
410template<> constexpr flags_t Annex::Base<plug::core::icmp> = 0x1104c60000000a00;
411template<> constexpr size_t Annex::Num<plug::core::icmp> = 32;
412template<> constexpr flags_t Annex::Base<plug::core::extrema> = 0x1104c60000000b00;
413template<> constexpr size_t Annex::Num<plug::core::extrema> = 4;
414template<> constexpr flags_t Annex::Base<plug::core::abs> = 0x1104c60000000c00;
415template<> constexpr size_t Annex::Num<plug::core::abs> = 0;
416template<> constexpr flags_t Annex::Base<plug::core::conv> = 0x1104c60000000d00;
417template<> constexpr size_t Annex::Num<plug::core::conv> = 2;
418template<> constexpr flags_t Annex::Base<plug::core::bitcast> = 0x1104c60000000e00;
419template<> constexpr size_t Annex::Num<plug::core::bitcast> = 0;
420template<> constexpr flags_t Annex::Base<plug::core::trait> = 0x1104c60000000f00;
421template<> constexpr size_t Annex::Num<plug::core::trait> = 2;
422template<> constexpr flags_t Annex::Base<plug::core::pe> = 0x1104c60000001000;
423template<> constexpr size_t Annex::Num<plug::core::pe> = 3;
424template<> constexpr flags_t Annex::Base<plug::core::zip> = 0x1104c60000001100;
425template<> constexpr size_t Annex::Num<plug::core::zip> = 0;
426
427template<> struct Axiom::Match<plug::core::mode> { using type = Axiom; };
428template<> struct Axiom::Match<plug::core::minus> { using type = Axiom; };
429
430#endif
431} // namespace mim
432
433#ifndef DOXYGEN // don't include in Doxygen documentation
434
435template<> struct fe::is_bit_enum<mim::plug::core::nat> : std::true_type {};
436template<> struct fe::is_bit_enum<mim::plug::core::ncmp> : std::true_type {};
437template<> struct fe::is_bit_enum<mim::plug::core::mode> : std::true_type {};
438template<> struct fe::is_bit_enum<mim::plug::core::bit1> : std::true_type {};
439template<> struct fe::is_bit_enum<mim::plug::core::bit2> : std::true_type {};
440template<> struct fe::is_bit_enum<mim::plug::core::shr> : std::true_type {};
441template<> struct fe::is_bit_enum<mim::plug::core::wrap> : std::true_type {};
442template<> struct fe::is_bit_enum<mim::plug::core::div> : std::true_type {};
443template<> struct fe::is_bit_enum<mim::plug::core::icmp> : std::true_type {};
444template<> struct fe::is_bit_enum<mim::plug::core::extrema> : std::true_type {};
445template<> struct fe::is_bit_enum<mim::plug::core::conv> : std::true_type {};
446template<> struct fe::is_bit_enum<mim::plug::core::trait> : std::true_type {};
447template<> struct fe::is_bit_enum<mim::plug::core::pe> : std::true_type {};
448
449#endif
Helper class to retrieve Infer::arg if present.
Definition def.h:86
Ref normalize_extrema(Ref type, Ref c, Ref arg)
Ref normalize_bit1(Ref type, Ref c, Ref a)
Ref normalize_bitcast(Ref dst_t, Ref callee, Ref src)
Ref normalize_ncmp(Ref type, Ref callee, Ref arg)
Ref normalize_div(Ref full_type, Ref c, Ref arg)
Ref normalize_nat(Ref type, Ref callee, Ref arg)
Ref normalize_conv(Ref dst_t, Ref c, Ref x)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
Ref normalize_trait(Ref nat, Ref callee, Ref type)
Ref normalize_icmp(Ref type, Ref c, Ref arg)
Ref normalize_bit2(Ref type, Ref c, Ref arg)
Ref normalize_wrap(Ref type, Ref c, Ref arg)
Ref normalize_pe(Ref type, Ref callee, Ref arg)
void register_normalizers(Normalizers &normalizers)
Ref normalize_abs(Ref type, Ref c, Ref arg)
Ref normalize_zip(Ref type, Ref c, Ref arg)
Ref normalize_shr(Ref type, Ref c, Ref arg)
@ nuw
No Unsigned Wrap around.
@ nsw
No Signed Wrap around.
Ref normalize_idx(Ref type, Ref c, Ref arg)
Definition cfg.h:11
u64 flags_t
Definition types.h:45
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:19
u64 plugin_t
Definition types.h:46
static constexpr size_t Num
Definition plugin.h:115
static constexpr flags_t Base
Definition plugin.h:118