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.len
37///@{
38enum class len : flags_t {
39};
40
41///@}
42
43/// @name %%vec.is_unique
44///@{
45enum class is_unique : flags_t {
46};
47
48const Def* normalize_is_unique(const Def*, const Def*, const Def*);
49///@}
50
51/// @name %%vec.diff
52///@{
53enum class diff : flags_t {
54};
55
56const Def* normalize_diff(const Def*, const Def*, const Def*);
57///@}
58
60
61#define MIM_vec_NORMALIZER_IMPL \
62 void register_normalizers(Normalizers& normalizers) {\
63 normalizers[flags_t(fold::l)] = &normalize_fold<fold::l>; \
64 normalizers[flags_t(fold::r)] = &normalize_fold<fold::r>; \
65 normalizers[flags_t(scan::for_all)] = &normalize_scan<scan::for_all>; \
66 normalizers[flags_t(scan::exists)] = &normalize_scan<scan::exists>; \
67 normalizers[flags_t(Annex::Base<is_unique>)] = &normalize_is_unique; \
68 normalizers[flags_t(Annex::Base<diff>)] = &normalize_diff; \
69 }
70} // namespace plug::vec
71
72#ifndef DOXYGEN // don't include in Doxygen documentation
73
74template<> constexpr flags_t Annex::Base<plug::vec::fold> = 0x5c61000000000000;
75template<> constexpr size_t Annex::Num<plug::vec::fold> = 2;
76template<> constexpr flags_t Annex::Base<plug::vec::scan> = 0x5c61000000000100;
77template<> constexpr size_t Annex::Num<plug::vec::scan> = 2;
78template<> constexpr flags_t Annex::Base<plug::vec::len> = 0x5c61000000000200;
79template<> constexpr size_t Annex::Num<plug::vec::len> = 0;
80template<> constexpr flags_t Annex::Base<plug::vec::is_unique> = 0x5c61000000000300;
81template<> constexpr size_t Annex::Num<plug::vec::is_unique> = 0;
82template<> constexpr flags_t Annex::Base<plug::vec::diff> = 0x5c61000000000400;
83template<> constexpr size_t Annex::Num<plug::vec::diff> = 0;
84
85template<> struct Axm::IsANode<plug::vec::len> { using type = Axm; };
86
87#endif
88} // namespace mim
89
90#ifndef DOXYGEN // don't include in Doxygen documentation
91
92template<> struct fe::is_bit_enum<mim::plug::vec::fold> : std::true_type {};
93template<> struct fe::is_bit_enum<mim::plug::vec::scan> : std::true_type {};
94
95#endif
Base class for all Defs.
Definition def.h:198
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