MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
sink_args.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/phase.h>
4#include <mim/tuple.h>
5
6namespace mim::plug::mem::phase {
7
8/// Lets every Dispatch pass nothing but memory.
9/// After mim::EtaConv, a Lam in a Dispatch occurs nowhere else, so it takes only the memory and the rest directly.
10/// Any other target becomes a wrapper that takes the memory `m` and jumps to it with `m` and the other arguments.
11/// A Dispatch without memory passes `()` until mem::phase::AddMem gives each target a `mem.M`.
12/// A wrapper passes more than memory, so it is no η-redex and stays stable next to mim::EtaConv.
13/// mim::DispatchNormalize η-expands the remaining non-Lam targets later.
14class SinkArgs : public RWPhase {
15public:
16 using RWPhase::RWPhase;
17
18private:
19 std::array<const Def*, 2> rewrite_filter_body(Lam*, Lam*) final;
20 const Def* sink(const Dispatch&, const Sieve&);
21};
22
23} // namespace mim::plug::mem::phase
Base class for all Defs.
Definition def.h:285
Matches (target_0, target_1, ...)#index arg.
Definition tuple.h:467
A function.
Definition lam.h:91
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:360
Filters the components of an aggregate and keeps track of where the survivors end up.
Definition tuple.h:116
Lets every Dispatch pass nothing but memory.
Definition sink_args.h:14
std::array< const Def *, 2 > rewrite_filter_body(Lam *, Lam *) final
The rewritten filter and body of old_lam for its stub new_lam, before the body is coerce()d.
Definition sink_args.cpp:9
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:360