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/axm.h>
4#include <mim/plugin.h>
5
6/// @namespace mim::plug::ord @ref ord
7namespace mim {
8namespace plug::ord {
9
10static constexpr plugin_t Plugin_Id = 0x4131400000000000;
11
12/// @name %%ord.Set
13///@{
14enum class Set : flags_t {
15};
16
17///@}
18
19/// @name %%ord.Map
20///@{
21enum class Map : flags_t {
22};
23
24///@}
25
26/// @name %%ord.init
27///@{
28enum class init : flags_t {
29 set = 0x4131400000000200,
30 map = 0x4131400000000201,
31};
32
33template<init>
34const Def* normalize_init(const Def*, const Def*, const Def*);
35
36///@}
37
38/// @name %%ord.create_set
39///@{
40enum class create_set : flags_t {
41};
42
43///@}
44
45/// @name %%ord.create_map
46///@{
47enum class create_map : flags_t {
48};
49
50///@}
51
52/// @name %%ord.size
53///@{
54enum class size : flags_t {
55 set = 0x4131400000000500,
56 map = 0x4131400000000501,
57};
58
59template<size>
60const Def* normalize_size(const Def*, const Def*, const Def*);
61
62///@}
63
64/// @name %%ord.is_empty_set
65///@{
66enum class is_empty_set : flags_t {
67};
68
69///@}
70
71/// @name %%ord.is_empty_map
72///@{
73enum class is_empty_map : flags_t {
74};
75
76///@}
77
78/// @name %%ord.get
79///@{
80enum class get : flags_t {
81};
82
83const Def* normalize_get(const Def*, const Def*, const Def*);
84///@}
85
86/// @name %%ord.mem
87///@{
88enum class mem : flags_t {
89 set = 0x4131400000000900,
90 map = 0x4131400000000901,
91};
92
93template<mem>
94const Def* normalize_mem(const Def*, const Def*, const Def*);
95
96///@}
97
98/// @name %%ord.insert
99///@{
100enum class insert : flags_t {
101 set = 0x4131400000000a00,
102 map = 0x4131400000000a01,
103};
104
105template<insert>
106const Def* normalize_insert(const Def*, const Def*, const Def*);
107
108///@}
109
111
112#define MIM_ord_NORMALIZER_IMPL \
113 void register_normalizers(Normalizers& normalizers) {\
114 normalizers[flags_t(init::set)] = &normalize_init<init::set>; \
115 normalizers[flags_t(init::map)] = &normalize_init<init::map>; \
116 normalizers[flags_t(size::set)] = &normalize_size<size::set>; \
117 normalizers[flags_t(size::map)] = &normalize_size<size::map>; \
118 normalizers[flags_t(Annex::Base<get>)] = &normalize_get; \
119 normalizers[flags_t(mem::set)] = &normalize_mem<mem::set>; \
120 normalizers[flags_t(mem::map)] = &normalize_mem<mem::map>; \
121 normalizers[flags_t(insert::set)] = &normalize_insert<insert::set>; \
122 normalizers[flags_t(insert::map)] = &normalize_insert<insert::map>; \
123 }
124} // namespace plug::ord
125
126#ifndef DOXYGEN // don't include in Doxygen documentation
127
128template<> constexpr flags_t Annex::Base<plug::ord::Set> = 0x4131400000000000;
129template<> constexpr size_t Annex::Num<plug::ord::Set> = 0;
130template<> constexpr flags_t Annex::Base<plug::ord::Map> = 0x4131400000000100;
131template<> constexpr size_t Annex::Num<plug::ord::Map> = 0;
132template<> constexpr flags_t Annex::Base<plug::ord::init> = 0x4131400000000200;
133template<> constexpr size_t Annex::Num<plug::ord::init> = 2;
134template<> constexpr flags_t Annex::Base<plug::ord::create_set> = 0x4131400000000300;
135template<> constexpr size_t Annex::Num<plug::ord::create_set> = 0;
136template<> constexpr flags_t Annex::Base<plug::ord::create_map> = 0x4131400000000400;
137template<> constexpr size_t Annex::Num<plug::ord::create_map> = 0;
138template<> constexpr flags_t Annex::Base<plug::ord::size> = 0x4131400000000500;
139template<> constexpr size_t Annex::Num<plug::ord::size> = 2;
140template<> constexpr flags_t Annex::Base<plug::ord::is_empty_set> = 0x4131400000000600;
141template<> constexpr size_t Annex::Num<plug::ord::is_empty_set> = 0;
142template<> constexpr flags_t Annex::Base<plug::ord::is_empty_map> = 0x4131400000000700;
143template<> constexpr size_t Annex::Num<plug::ord::is_empty_map> = 0;
144template<> constexpr flags_t Annex::Base<plug::ord::get> = 0x4131400000000800;
145template<> constexpr size_t Annex::Num<plug::ord::get> = 0;
146template<> constexpr flags_t Annex::Base<plug::ord::mem> = 0x4131400000000900;
147template<> constexpr size_t Annex::Num<plug::ord::mem> = 2;
148template<> constexpr flags_t Annex::Base<plug::ord::insert> = 0x4131400000000a00;
149template<> constexpr size_t Annex::Num<plug::ord::insert> = 2;
150
151template<> struct Axm::IsANode<plug::ord::create_set> { using type = Axm; };
152template<> struct Axm::IsANode<plug::ord::create_map> { using type = Axm; };
153template<> struct Axm::IsANode<plug::ord::is_empty_set> { using type = Axm; };
154template<> struct Axm::IsANode<plug::ord::is_empty_map> { using type = Axm; };
155
156#endif
157} // namespace mim
158
159#ifndef DOXYGEN // don't include in Doxygen documentation
160
161template<> struct fe::is_bit_enum<mim::plug::ord::init> : std::true_type {};
162template<> struct fe::is_bit_enum<mim::plug::ord::size> : std::true_type {};
163template<> struct fe::is_bit_enum<mim::plug::ord::mem> : std::true_type {};
164template<> struct fe::is_bit_enum<mim::plug::ord::insert> : std::true_type {};
165
166#endif
Base class for all Defs.
Definition def.h:198
The ord Plugin
const Def * normalize_insert(const Def *, const Def *, const Def *)
void register_normalizers(Normalizers &normalizers)
const Def * normalize_size(const Def *, const Def *, const Def *arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
const Def * normalize_mem(const Def *, const Def *, const Def *arg)
const Def * normalize_get(const Def *, const Def *, const Def *arg)
const Def * normalize_init(const Def *type, const Def *callee, const Def *arg)
Definition ast.h:14
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
@ Axm
Definition def.h:85
static constexpr size_t Num
Definition plugin.h:115
static constexpr flags_t Base
Definition plugin.h:118