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.scan
25///@{
26enum class scan : flags_t {
27 for_all = 0x5c61000000000100,
28 exists = 0x5c61000000000101,
29};
30
31template<scan>
32const Def* normalize_scan(const Def*, const Def*, const Def*);
33
34///@}
35
36/// @name %%vec.first
37///@{
38enum class first : flags_t {
39};
40
41///@}
42
43/// @name %%vec.last
44///@{
45enum class last : flags_t {
46};
47
48///@}
49
50/// @name %%vec.len
51///@{
52enum class len : flags_t {
53};
54
55///@}
56
57/// @name %%vec.is_unique
58///@{
59enum class is_unique : flags_t {
60};
61
62const Def* normalize_is_unique(const Def*, const Def*, const Def*);
63///@}
64
65/// @name %%vec.cat
66///@{
67enum class cat : flags_t {
68};
69
70const Def* normalize_cat(const Def*, const Def*, const Def*);
71///@}
72
73/// @name %%vec.diff
74///@{
75enum class diff : flags_t {
76};
77
78const Def* normalize_diff(const Def*, const Def*, const Def*);
79///@}
80
82
83#define MIM_vec_NORMALIZER_IMPL \
84 void register_normalizers(Normalizers& normalizers) {\
85 normalizers[flags_t(fold::l)] = &normalize_fold<fold::l>; \
86 normalizers[flags_t(fold::r)] = &normalize_fold<fold::r>; \
87 normalizers[flags_t(scan::for_all)] = &normalize_scan<scan::for_all>; \
88 normalizers[flags_t(scan::exists)] = &normalize_scan<scan::exists>; \
89 normalizers[flags_t(Annex::Base<is_unique>)] = &normalize_is_unique; \
90 normalizers[flags_t(Annex::Base<cat>)] = &normalize_cat; \
91 normalizers[flags_t(Annex::Base<diff>)] = &normalize_diff; \
92 }
93} // namespace plug::vec
94
95#ifndef DOXYGEN // don't include in Doxygen documentation
96
97template<> constexpr flags_t Annex::Base<plug::vec::fold> = 0x5c61000000000000;
98template<> constexpr size_t Annex::Num<plug::vec::fold> = 2;
99template<> constexpr flags_t Annex::Base<plug::vec::scan> = 0x5c61000000000100;
100template<> constexpr size_t Annex::Num<plug::vec::scan> = 2;
101template<> constexpr flags_t Annex::Base<plug::vec::first> = 0x5c61000000000200;
102template<> constexpr size_t Annex::Num<plug::vec::first> = 0;
103template<> constexpr flags_t Annex::Base<plug::vec::last> = 0x5c61000000000300;
104template<> constexpr size_t Annex::Num<plug::vec::last> = 0;
105template<> constexpr flags_t Annex::Base<plug::vec::len> = 0x5c61000000000400;
106template<> constexpr size_t Annex::Num<plug::vec::len> = 0;
107template<> constexpr flags_t Annex::Base<plug::vec::is_unique> = 0x5c61000000000500;
108template<> constexpr size_t Annex::Num<plug::vec::is_unique> = 0;
109template<> constexpr flags_t Annex::Base<plug::vec::cat> = 0x5c61000000000600;
110template<> constexpr size_t Annex::Num<plug::vec::cat> = 0;
111template<> constexpr flags_t Annex::Base<plug::vec::diff> = 0x5c61000000000700;
112template<> constexpr size_t Annex::Num<plug::vec::diff> = 0;
113
114template<> struct Axm::IsANode<plug::vec::first> { using type = Axm; };
115template<> struct Axm::IsANode<plug::vec::last> { using type = Axm; };
116template<> struct Axm::IsANode<plug::vec::len> { using type = Axm; };
117
118#endif
119} // namespace mim
120
121#ifndef DOXYGEN // don't include in Doxygen documentation
122
123template<> struct fe::is_bit_enum<mim::plug::vec::fold> : std::true_type {};
124template<> struct fe::is_bit_enum<mim::plug::vec::scan> : std::true_type {};
125
126#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 *type, 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
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