MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
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
7
namespace
mim
{
8
namespace
plug::vec
{
9
10
static
constexpr
plugin_t
Plugin_Id
= 0x5c61000000000000;
11
12
/// @name %%vec.fold
13
///@{
14
enum class
fold
:
flags_t
{
15
l = 0x5c61000000000000,
16
r = 0x5c61000000000001,
17
};
18
19
template
<fold>
20
const
Def
*
normalize_fold
(
const
Def
*,
const
Def
*,
const
Def
*);
21
22
///@}
23
24
/// @name %%vec.zip
25
///@{
26
enum class
zip
:
flags_t
{
27
};
28
29
const
Def
*
normalize_zip
(
const
Def
*,
const
Def
*,
const
Def
*);
30
///@}
31
32
/// @name %%vec.scan
33
///@{
34
enum class
scan
:
flags_t
{
35
for_all
= 0x5c61000000000200,
36
exists
= 0x5c61000000000201,
37
};
38
39
template
<scan>
40
const
Def
*
normalize_scan
(
const
Def
*,
const
Def
*,
const
Def
*);
41
42
///@}
43
44
/// @name %%vec.first
45
///@{
46
enum class
first
:
flags_t
{
47
};
48
49
///@}
50
51
/// @name %%vec.last
52
///@{
53
enum class
last
:
flags_t
{
54
};
55
56
///@}
57
58
/// @name %%vec.len
59
///@{
60
enum class
len
:
flags_t
{
61
};
62
63
///@}
64
65
/// @name %%vec.is_unique
66
///@{
67
enum class
is_unique
:
flags_t
{
68
};
69
70
const
Def
*
normalize_is_unique
(
const
Def
*,
const
Def
*,
const
Def
*);
71
///@}
72
73
/// @name %%vec.cat
74
///@{
75
enum class
cat
:
flags_t
{
76
};
77
78
const
Def
*
normalize_cat
(
const
Def
*,
const
Def
*,
const
Def
*);
79
///@}
80
81
/// @name %%vec.diff
82
///@{
83
enum class
diff
:
flags_t
{
84
};
85
86
const
Def
*
normalize_diff
(
const
Def
*,
const
Def
*,
const
Def
*);
87
///@}
88
89
void
register_normalizers
(
Normalizers
& normalizers);
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
106
template
<>
constexpr
flags_t
Annex::Base<plug::vec::fold>
= 0x5c61000000000000;
107
template
<>
constexpr
size_t
Annex::Num<plug::vec::fold>
= 2;
108
template
<>
constexpr
flags_t
Annex::Base<plug::vec::zip>
= 0x5c61000000000100;
109
template
<>
constexpr
size_t
Annex::Num<plug::vec::zip>
= 0;
110
template
<>
constexpr
flags_t
Annex::Base<plug::vec::scan>
= 0x5c61000000000200;
111
template
<>
constexpr
size_t
Annex::Num<plug::vec::scan>
= 2;
112
template
<>
constexpr
flags_t
Annex::Base<plug::vec::first>
= 0x5c61000000000300;
113
template
<>
constexpr
size_t
Annex::Num<plug::vec::first>
= 0;
114
template
<>
constexpr
flags_t
Annex::Base<plug::vec::last>
= 0x5c61000000000400;
115
template
<>
constexpr
size_t
Annex::Num<plug::vec::last>
= 0;
116
template
<>
constexpr
flags_t
Annex::Base<plug::vec::len>
= 0x5c61000000000500;
117
template
<>
constexpr
size_t
Annex::Num<plug::vec::len>
= 0;
118
template
<>
constexpr
flags_t
Annex::Base<plug::vec::is_unique>
= 0x5c61000000000600;
119
template
<>
constexpr
size_t
Annex::Num<plug::vec::is_unique>
= 0;
120
template
<>
constexpr
flags_t
Annex::Base<plug::vec::cat>
= 0x5c61000000000700;
121
template
<>
constexpr
size_t
Annex::Num<plug::vec::cat>
= 0;
122
template
<>
constexpr
flags_t
Annex::Base<plug::vec::diff>
= 0x5c61000000000800;
123
template
<>
constexpr
size_t
Annex::Num<plug::vec::diff>
= 0;
124
125
template
<>
struct
Axm::IsANode
<
plug
::vec::first> {
using
type
=
Axm
; };
126
template
<>
struct
Axm::IsANode
<
plug
::vec::last> {
using
type
=
Axm
; };
127
template
<>
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
134
template
<>
struct
fe::is_bit_enum<
mim
::plug::vec::fold> : std::true_type {};
135
template
<>
struct
fe::is_bit_enum<
mim
::plug::vec::scan> : std::true_type {};
136
137
#endif
axm.h
mim::Axm::IsANode::type
App type
Definition
axm.h:70
mim::Axm::IsANode
Definition
axm.h:69
mim::Def
Base class for all Defs.
Definition
def.h:273
mim::plug::vec
The vec Plugin
Definition
normalizers.cpp:11
mim::plug::vec::normalize_scan
const Def * normalize_scan(const Def *, const Def *c, const Def *vec)
Definition
normalizers.cpp:78
mim::plug::vec::fold
fold
Definition
autogen.h:14
mim::plug::vec::is_unique
is_unique
Definition
autogen.h:67
mim::plug::vec::register_normalizers
void register_normalizers(Normalizers &normalizers)
mim::plug::vec::zip
zip
Definition
autogen.h:26
mim::plug::vec::len
len
Definition
autogen.h:60
mim::plug::vec::normalize_cat
const Def * normalize_cat(const Def *, const Def *callee, const Def *arg)
Definition
normalizers.cpp:116
mim::plug::vec::diff
diff
Definition
autogen.h:83
mim::plug::vec::cat
cat
Definition
autogen.h:75
mim::plug::vec::first
first
Definition
autogen.h:46
mim::plug::vec::normalize_fold
const Def * normalize_fold(const Def *type, const Def *c, const Def *arg)
Definition
normalizers.cpp:14
mim::plug::vec::normalize_is_unique
const Def * normalize_is_unique(const Def *, const Def *, const Def *vec)
Definition
normalizers.cpp:95
mim::plug::vec::normalize_diff
const Def * normalize_diff(const Def *type, const Def *c, const Def *arg)
Definition
normalizers.cpp:125
mim::plug::vec::Plugin_Id
static constexpr plugin_t Plugin_Id
Definition
autogen.h:10
mim::plug::vec::normalize_zip
const Def * normalize_zip(const Def *type, const Def *c, const Def *arg)
Definition
normalizers.cpp:55
mim::plug::vec::scan
scan
Definition
autogen.h:34
mim::plug::vec::scan::for_all
@ for_all
Definition
autogen.h:35
mim::plug::vec::scan::exists
@ exists
Definition
autogen.h:36
mim::plug::vec::last
last
Definition
autogen.h:53
mim::plug
Definition
lower_for.h:5
mim
Definition
ast.h:16
mim::flags_t
u64 flags_t
Definition
types.h:39
mim::Normalizers
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition
plugin.h:27
mim::plugin_t
u64 plugin_t
Definition
types.h:40
mim::Node::Axm
@ Axm
Definition
def.h:122
plugin.h
mim::Annex::Num
static constexpr size_t Num
Number of Axm::subtags.
Definition
plugin.h:247
mim::Annex::Base
static constexpr flags_t Base
Definition
plugin.h:248
build
include
mim
plug
vec
autogen.h
Generated by
1.18.0