MimIR
0.5-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
nom_erasure.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
mim/phase.h
"
4
5
namespace
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`.
10
class
NomErasure
:
public
RWPhase
{
11
public
:
12
using
RWPhase::RWPhase
;
13
14
private
:
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
mim::Def
Base class for all Defs.
Definition
def.h:289
mim::Name
Nominal newtype term introduction.
Definition
nom.h:34
mim::NomErasure
Eliminates all nominal newtypes, so that no Nom/Name/Struc ever reaches a backend.
Definition
nom_erasure.h:10
mim::NomErasure::rewrite_imm_Nom
const Def * rewrite_imm_Nom(const Nom *) final
Definition
nom_erasure.cpp:26
mim::NomErasure::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::NomErasure::lookup
const Def * lookup(const Def *) final
Lookup old_def by searching in reverse through the stack of maps.
Definition
nom_erasure.cpp:17
mim::NomErasure::rewrite_imm_Name
const Def * rewrite_imm_Name(const Name *) final
Definition
nom_erasure.cpp:33
mim::NomErasure::rewrite_imm_Struc
const Def * rewrite_imm_Struc(const Struc *) final
Definition
nom_erasure.cpp:38
mim::Nom
Nominal newtype formation.
Definition
nom.h:11
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::Struc
Nominal newtype term elimination.
Definition
nom.h:56
mim
Definition
ast.h:16
phase.h
include
mim
phase
nom_erasure.h
Generated by
1.18.0