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