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.diff
66///@{
67enum class diff : flags_t {
68};
69
70const Def* normalize_diff(const Def*, const Def*, const Def*);
71///@}
72
74
75#define MIM_vec_NORMALIZER_IMPL \
76 void register_normalizers(Normalizers& normalizers) {\
77 normalizers[flags_t(fold::l)] = &normalize_fold<fold::l>; \
78 normalizers[flags_t(fold::r)] = &normalize_fold<fold::r>; \
79 normalizers[flags_t(scan::for_all)] = &normalize_scan<scan::for_all>; \
80 normalizers[flags_t(scan::exists)] = &normalize_scan<scan::exists>; \
81 normalizers[flags_t(Annex::Base<is_unique>)] = &normalize_is_unique; \
82 normalizers[flags_t(Annex::Base<diff>)] = &normalize_diff; \
83 }
84} // namespace plug::vec
85
86#ifndef DOXYGEN // don't include in Doxygen documentation
87
88template<> constexpr flags_t Annex::Base<plug::vec::fold> = 0x5c61000000000000;
89template<> constexpr size_t Annex::Num<plug::vec::fold> = 2;
90template<> constexpr flags_t Annex::Base<plug::vec::scan> = 0x5c61000000000100;
91template<> constexpr size_t Annex::Num<plug::vec::scan> = 2;
92template<> constexpr flags_t Annex::Base<plug::vec::first> = 0x5c61000000000200;
93template<> constexpr size_t Annex::Num<plug::vec::first> = 0;
94template<> constexpr flags_t Annex::Base<plug::vec::last> = 0x5c61000000000300;
95template<> constexpr size_t Annex::Num<plug::vec::last> = 0;
96template<> constexpr flags_t Annex::Base<plug::vec::len> = 0x5c61000000000400;
97template<> constexpr size_t Annex::Num<plug::vec::len> = 0;
98template<> constexpr flags_t Annex::Base<plug::vec::is_unique> = 0x5c61000000000500;
99template<> constexpr size_t Annex::Num<plug::vec::is_unique> = 0;
100template<> constexpr flags_t Annex::Base<plug::vec::diff> = 0x5c61000000000600;
101template<> constexpr size_t Annex::Num<plug::vec::diff> = 0;
102
103template<> struct Axm::IsANode<plug::vec::first> { using type = Axm; };
104template<> struct Axm::IsANode<plug::vec::last> { using type = Axm; };
105template<> struct Axm::IsANode<plug::vec::len> { using type = Axm; };
106
107#endif
108} // namespace mim
109
110#ifndef DOXYGEN // don't include in Doxygen documentation
111
112template<> struct fe::is_bit_enum<mim::plug::vec::fold> : std::true_type {};
113template<> struct fe::is_bit_enum<mim::plug::vec::scan> : std::true_type {};
114
115#endif
Base class for all Defs.
Definition def.h:203
The vec Plugin
const Def * normalize_scan(const Def *, const Def *c, const Def *vec)
void register_normalizers(Normalizers &normalizers)
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:85
static constexpr size_t Num
Definition plugin.h:115
static constexpr flags_t Base
Definition plugin.h:118