MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
lower_for.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
mim/phase.h
>
4
5
namespace
mim::plug::affine::phase
{
6
7
/// Lowers the for axm to actual control flow in CPS.
8
/// It basically mimics this implementation:
9
/// ```
10
/// con affine.For_impl
11
/// {m n: Nat, Ts: «n; *»}
12
/// (begin: Idx m, end: Idx m, step: Idx m, init: «i: n; Ts#i»,
13
/// body: Cn [iter: Idx m, acc: «i: n; Ts#i», yield: Cn «i: n; Ts#i»],
14
/// exit: Cn «i: n; Ts#i»
15
/// ) =
16
/// con head(iter: Idx m, acc: «i: n; Ts#i») =
17
/// con new_body() = body (iter, acc, cn acc: «i: n; Ts#i» =
18
/// let iter2 = core.wrap.add core.mode.nsuw (iter, step);
19
/// head (iter2, acc));
20
/// con new_exit() = exit (acc);
21
/// (new_exit, new_body)#(core.icmp.ul (iter, end)) ();
22
/// head(begin, init);
23
/// ```
24
/// However, we merge `init`/`acc` into the signature, as it may contain a `mem`.
25
/// In this case we have to equip `new_body`/`new_exit` with a `mem` as well.
26
class
LowerFor
:
public
RWPhase
{
27
public
:
28
LowerFor
(
World
&
world
,
flags_t
annex
)
29
:
RWPhase
(
world
,
annex
) {}
30
31
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
32
};
33
34
}
// namespace mim::plug::affine::phase
mim::App
Definition
lam.h:224
mim::Def
Base class for all Defs.
Definition
def.h:273
mim::Phase::annex
flags_t annex() const
Definition
phase.h:81
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:431
mim::RWPhase::world
World & world()=delete
Hides both and forbids direct access.
mim::World
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition
world.h:40
mim::plug::affine::phase::LowerFor::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
lower_for.cpp:36
mim::plug::affine::phase::LowerFor::LowerFor
LowerFor(World &world, flags_t annex)
Definition
lower_for.h:28
mim::plug::affine::phase
Definition
lower_for.h:5
mim::flags_t
u64 flags_t
Definition
types.h:39
phase.h
include
mim
plug
affine
phase
lower_for.h
Generated by
1.18.0