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::vec @ref vec
7namespace mim {
8namespace plug::vec {
9
10static constexpr plugin_t Plugin_Id = 0x5c61000000000000;
11
12/// @name %%vec.fold
13///@{
14enum class fold : flags_t {
15 l = 0x5c61000000000000,
16 r = 0x5c61000000000001,
17};
18
19template<fold>
20const Def* normalize_fold(const Def*, const Def*, const Def*);
21
22///@}
23
24/// @name %%vec.zip
25///@{
26enum class zip : flags_t {
27};
28
29const Def* normalize_zip(const Def*, const Def*, const Def*);
30///@}
31
32/// @name %%vec.scan
33///@{
34enum class scan : flags_t {
35 for_all = 0x5c61000000000200,
36 exists = 0x5c61000000000201,
37};
38
39template<scan>
40const Def* normalize_scan(const Def*, const Def*, const Def*);
41
42///@}
43
44/// @name %%vec.first
45///@{
46enum class first : flags_t {
47};
48
49///@}
50
51/// @name %%vec.last
52///@{
53enum class last : flags_t {
54};
55
56///@}
57
58/// @name %%vec.len
59///@{
60enum class len : flags_t {
61};
62
63///@}
64
65/// @name %%vec.is_unique
66///@{
67enum class is_unique : flags_t {
68};
69
70const Def* normalize_is_unique(const Def*, const Def*, const Def*);
71///@}
72
73/// @name %%vec.cat
74///@{
75enum class cat : flags_t {
76};
77
78const Def* normalize_cat(const Def*, const Def*, const Def*);
79///@}
80
81/// @name %%vec.diff
82///@{
83enum class diff : flags_t {
84};
85
86const Def* normalize_diff(const Def*, const Def*, const Def*);
87///@}
88
90
91#define MIM_vec_NORMALIZER_IMPL \
92 void register_normalizers(Normalizers& normalizers) {\
93 normalizers[flags_t(fold::l)] = &normalize_fold<fold::l>; \
94 normalizers[flags_t(fold::r)] = &normalize_fold<fold::r>; \
95 normalizers[flags_t(Annex::Base<zip>)] = &normalize_zip; \
96 normalizers[flags_t(scan::for_all)] = &normalize_scan<scan::for_all>; \
97 normalizers[flags_t(scan::exists)] = &normalize_scan<scan::exists>; \
98 normalizers[flags_t(Annex::Base<is_unique>)] = &normalize_is_unique; \
99 normalizers[flags_t(Annex::Base<cat>)] = &normalize_cat; \
100 normalizers[flags_t(Annex::Base<diff>)] = &normalize_diff; \
101 }
102} // namespace plug::vec
103
104#ifndef DOXYGEN // don't include in Doxygen documentation
105
106template<> constexpr flags_t Annex::Base<plug::vec::fold> = 0x5c61000000000000;
107template<> constexpr size_t Annex::Num<plug::vec::fold> = 2;
108template<> constexpr flags_t Annex::Base<plug::vec::zip> = 0x5c61000000000100;
109template<> constexpr size_t Annex::Num<plug::vec::zip> = 0;
110template<> constexpr flags_t Annex::Base<plug::vec::scan> = 0x5c61000000000200;
111template<> constexpr size_t Annex::Num<plug::vec::scan> = 2;
112template<> constexpr flags_t Annex::Base<plug::vec::first> = 0x5c61000000000300;
113template<> constexpr size_t Annex::Num<plug::vec::first> = 0;
114template<> constexpr flags_t Annex::Base<plug::vec::last> = 0x5c61000000000400;
115template<> constexpr size_t Annex::Num<plug::vec::last> = 0;
116template<> constexpr flags_t Annex::Base<plug::vec::len> = 0x5c61000000000500;
117template<> constexpr size_t Annex::Num<plug::vec::len> = 0;
118template<> constexpr flags_t Annex::Base<plug::vec::is_unique> = 0x5c61000000000600;
119template<> constexpr size_t Annex::Num<plug::vec::is_unique> = 0;
120template<> constexpr flags_t Annex::Base<plug::vec::cat> = 0x5c61000000000700;
121template<> constexpr size_t Annex::Num<plug::vec::cat> = 0;
122template<> constexpr flags_t Annex::Base<plug::vec::diff> = 0x5c61000000000800;
123template<> constexpr size_t Annex::Num<plug::vec::diff> = 0;
124
125template<> struct Axm::IsANode<plug::vec::first> { using type = Axm; };
126template<> struct Axm::IsANode<plug::vec::last> { using type = Axm; };
127template<> struct Axm::IsANode<plug::vec::len> { using type = Axm; };
128
129#endif
130} // namespace mim
131
132#ifndef DOXYGEN // don't include in Doxygen documentation
133
134template<> struct fe::is_bit_enum<mim::plug::vec::fold> : std::true_type {};
135template<> struct fe::is_bit_enum<mim::plug::vec::scan> : std::true_type {};
136
137#endif
Base class for all Defs.
Definition def.h:251
The vec Plugin
const Def * normalize_scan(const Def *, const Def *c, const Def *vec)
void register_normalizers(Normalizers &normalizers)
const Def * normalize_cat(const Def *, const Def *callee, const Def *arg)
const Def * normalize_is_unique(const Def *, const Def *, const Def *vec)
const Def * normalize_diff(const Def *type, const Def *c, const Def *arg)
const Def * normalize_fold(const Def *, const Def *c, const Def *arg)
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
const Def * normalize_zip(const Def *type, const Def *c, 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:114
static constexpr size_t Num
Number of Axm::subtags.
Definition plugin.h:116
static constexpr flags_t Base
Definition plugin.h:117