MimIR
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::buffer @ref buffer
7namespace mim {
8namespace plug::buffer {
9
10static constexpr plugin_t Plugin_Id = 0xd61c71930000000;
11
12/// @name %%buffer.Buf
13///@{
14enum class Buf : flags_t {
15};
16
17const Def* normalize_Buf(const Def*, const Def*, const Def*);
18///@}
19
20/// @name %%buffer.alloc
21///@{
22enum class alloc : flags_t {
23};
24
25///@}
26
27/// @name %%buffer.read
28///@{
29enum class read : flags_t {
30};
31
32const Def* normalize_read(const Def*, const Def*, const Def*);
33///@}
34
35/// @name %%buffer.write
36///@{
37enum class write : flags_t {
38};
39
40const Def* normalize_write(const Def*, const Def*, const Def*);
41///@}
42
43/// @name %%buffer.init
44///@{
45enum class init : flags_t {
46};
47
48///@}
49
50/// @name %%buffer.constant
51///@{
52enum class constant : flags_t {
53};
54
55///@}
56
57/// @name %%buffer.shape
58///@{
59enum class shape : flags_t {
60};
61
62const Def* normalize_shape(const Def*, const Def*, const Def*);
63///@}
64
65/// @name %%buffer.copy
66///@{
67enum class copy : flags_t {
68};
69
70///@}
71
72/// @name %%buffer.lower_ptr
73///@{
74enum class lower_ptr : flags_t {
75};
76
77///@}
78
80
81#define MIM_buffer_NORMALIZER_IMPL \
82 void register_normalizers(Normalizers& normalizers) {\
83 normalizers[flags_t(Annex::Base<Buf>)] = &normalize_Buf; \
84 normalizers[flags_t(Annex::Base<read>)] = &normalize_read; \
85 normalizers[flags_t(Annex::Base<write>)] = &normalize_write; \
86 normalizers[flags_t(Annex::Base<shape>)] = &normalize_shape; \
87 }
88} // namespace plug::buffer
89
90#ifndef DOXYGEN // don't include in Doxygen documentation
91
92template<> constexpr flags_t Annex::Base<plug::buffer::Buf> = 0xd61c71930000000;
93template<> constexpr size_t Annex::Num<plug::buffer::Buf> = 0;
94template<> constexpr flags_t Annex::Base<plug::buffer::alloc> = 0xd61c71930000100;
95template<> constexpr size_t Annex::Num<plug::buffer::alloc> = 0;
96template<> constexpr flags_t Annex::Base<plug::buffer::read> = 0xd61c71930000200;
97template<> constexpr size_t Annex::Num<plug::buffer::read> = 0;
98template<> constexpr flags_t Annex::Base<plug::buffer::write> = 0xd61c71930000300;
99template<> constexpr size_t Annex::Num<plug::buffer::write> = 0;
100template<> constexpr flags_t Annex::Base<plug::buffer::init> = 0xd61c71930000400;
101template<> constexpr size_t Annex::Num<plug::buffer::init> = 0;
102template<> constexpr flags_t Annex::Base<plug::buffer::constant> = 0xd61c71930000500;
103template<> constexpr size_t Annex::Num<plug::buffer::constant> = 0;
104template<> constexpr flags_t Annex::Base<plug::buffer::shape> = 0xd61c71930000600;
105template<> constexpr size_t Annex::Num<plug::buffer::shape> = 0;
106template<> constexpr flags_t Annex::Base<plug::buffer::copy> = 0xd61c71930000700;
107template<> constexpr size_t Annex::Num<plug::buffer::copy> = 0;
108template<> constexpr flags_t Annex::Base<plug::buffer::lower_ptr> = 0xd61c71930000800;
109template<> constexpr size_t Annex::Num<plug::buffer::lower_ptr> = 0;
110
111template<> struct Axm::IsANode<plug::buffer::lower_ptr> { using type = Axm; };
112
113#endif
114} // namespace mim
115
116#ifndef DOXYGEN // don't include in Doxygen documentation
117
118
119#endif
Base class for all Defs.
Definition def.h:261
The buffer Plugin
Definition buffer.h:7
const Def * normalize_write(const Def *, const Def *, const Def *)
const Def * normalize_shape(const Def *type, const Def *, const Def *arg)
shape buf i ↦ the i-th size, read off the buffer's type.
static constexpr plugin_t Plugin_Id
Definition autogen.h:10
const Def * normalize_read(const Def *type, const Def *, const Def *arg)
read (constant v) idx ↦ v.
void register_normalizers(Normalizers &normalizers)
const Def * normalize_Buf(const Def *, const Def *callee, const Def *arg)
Buf (r, s, T) with literal size-1 axes in s ↦ Buf (r', s', T) with those axes dropped.
Definition ast.h:14
u64 flags_t
Definition types.h:39
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Definition plugin.h:22
u64 plugin_t
Definition types.h:40
@ Axm
Definition def.h:109
static constexpr size_t Num
Number of Axm::subtags.
Definition plugin.h:147
static constexpr flags_t Base
Definition plugin.h:148