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