MimIR
0.5-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
using
RWPhase::RWPhase
;
29
30
const
Def
*
rewrite_imm_App
(
const
App
*)
final
;
31
};
32
33
}
// namespace mim::plug::affine::phase
mim::App
Definition
lam.h:215
mim::Def
Base class for all Defs.
Definition
def.h:289
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::plug::affine::phase::LowerFor
Lowers the for axm to actual control flow in CPS.
Definition
lower_for.h:26
mim::plug::affine::phase::LowerFor::rewrite_imm_App
const Def * rewrite_imm_App(const App *) final
Definition
lower_for.cpp:24
mim::plug::affine::phase::LowerFor::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::plug::affine::phase
Definition
lower_for.h:5
phase.h
include
mim
plug
affine
phase
lower_for.h
Generated by
1.18.0