MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
nom_erasure.h
Go to the documentation of this file.
1#pragma once
2
3#include "mim/phase.h"
4
5namespace mim {
6
7/// Eliminates all nominal newtypes, so that no Nom/Name/Struc ever reaches a backend.
8/// A `nom` only distinguishes types and shares the representation of the type it wraps,
9/// so `nom N = T` erases to `T` while both `v inj N` and `#v` erase to `v`.
10class NomErasure : public RWPhase {
11public:
12 using RWPhase::RWPhase;
13
14private:
15 const Def* lookup(const Def*) final;
16 const Def* rewrite_imm_Nom(const Nom*) final;
17 const Def* rewrite_imm_Name(const Name*) final;
18 const Def* rewrite_imm_Struc(const Struc*) final;
19};
20
21} // namespace mim
Base class for all Defs.
Definition def.h:289
Nominal newtype term introduction.
Definition nom.h:34
Eliminates all nominal newtypes, so that no Nom/Name/Struc ever reaches a backend.
Definition nom_erasure.h:10
const Def * rewrite_imm_Nom(const Nom *) final
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:334
const Def * lookup(const Def *) final
Lookup old_def by searching in reverse through the stack of maps.
const Def * rewrite_imm_Name(const Name *) final
const Def * rewrite_imm_Struc(const Struc *) final
Nominal newtype formation.
Definition nom.h:11
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:334
Nominal newtype term elimination.
Definition nom.h:56
Definition ast.h:16