MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::mem Namespace Reference

The mem Plugin More...

Namespaces

namespace  phase

Enumerations

%mem.Ptr
enum class  Ptr : flags_t
%mem.Ptr0
enum class  Ptr0 : flags_t
%mem.free
enum class  free : flags_t
%mem.add_mem
enum class  add_mem : flags_t
%mem.seo
enum class  seo : flags_t
%mem.remem_repl
enum class  remem_repl : flags_t
%mem.alloc2malloc_repl
enum class  alloc2malloc_repl : flags_t

Functions

void register_normalizers (Normalizers &normalizers)

Variables

static constexpr plugin_t Plugin_Id = 0x3863800000000000

%mem.M

enum class  M : flags_t
Lammut_con (World &w, nat_t a=0)
 Yields con[mem.M 0].
Lammut_con (const Def *dom)
 Yields con[mem.M 0, dom].
const Appisa_mem (const Def *def)
 If def is a mem.M-typed value, yields its memory type mem.M a; otherwise nullptr.
bool has_leading_mem (const Pi *pi)
 Does pi already thread memory - a leading mem.M, either directly or grouped as the first component of the first parameter (e.g.
const Defmem_def (const Def *def)
 Returns the (first) element of type mem.M a from the given tuple.
const Defmem_var (Lam *lam)
 Returns the memory argument of a function if it has one.
const Defstrip_mem_ty (const Def *def)
 Removes recusively all occurences of mem from a type (sigma).
const Defstrip_mem (const Def *def)
 Recursively removes all occurrences of mem from a tuple.

%mem.load

enum class  load : flags_t
const Defnormalize_load (const Def *type, const Def *, const Def *arg)

%mem.store

enum class  store : flags_t
const Defnormalize_store (const Def *, const Def *, const Def *arg)

%mem.remem

enum class  remem : flags_t
const Defnormalize_remem (const Def *, const Def *, const Def *)

%mem.alloc

enum class  alloc : flags_t
const Defop_alloc (const Def *type, const Def *as, const Def *mem)
const Defop_alloc (const Def *type, const Def *mem)

%mem.slot

enum class  slot : flags_t
const Defop_slot (const Def *type, const Def *as, const Def *mem, const Def *ret)
const Defop_slot (const Def *type, const Def *mem, const Def *ret)
std::tuple< const Def *, Lam *, const Def *, const Def * > split_slot (const App *slot)
 Decomposes the continuation-based slot into (mem, ret_lam, ret_mem, ptr), where ret_mem is the continuation's mem and ptr is the continuation's slot var; the slot's lifetime is ret_lam's scope.

%mem.malloc

enum class  malloc : flags_t
const Defop_malloc (const Def *type, const Def *as, const Def *mem)
const Defop_malloc (const Def *type, const Def *mem)

%mem.mslot

enum class  mslot : flags_t
const Defop_mslot (const Def *type, const Def *as, const Def *mem, const Def *ret)
const Defop_mslot (const Def *type, const Def *mem, const Def *ret)

%mem.lea

enum class  lea : flags_t
const Defpointee (const Def *ptr)
const Defop_lea (const Def *ptr, const Def *index)
const Defop_lea_unsafe (const Def *ptr, const Def *i)
const Defop_lea_unsafe (const Def *ptr, u64 i)
const Defnormalize_lea (const Def *, const Def *, const Def *arg)

Detailed Description

Enumeration Type Documentation

◆ add_mem

enum class mim::plug::mem::add_mem : flags_t
strong

Definition at line 102 of file autogen.h.

◆ alloc

enum class mim::plug::mem::alloc : flags_t
strong

Definition at line 59 of file autogen.h.

◆ alloc2malloc_repl

Definition at line 123 of file autogen.h.

◆ free

enum class mim::plug::mem::free : flags_t
strong

Definition at line 80 of file autogen.h.

◆ lea

enum class mim::plug::mem::lea : flags_t
strong

Definition at line 94 of file autogen.h.

◆ load

enum class mim::plug::mem::load : flags_t
strong

Definition at line 35 of file autogen.h.

◆ M

enum class mim::plug::mem::M : flags_t
strong

Definition at line 14 of file autogen.h.

◆ malloc

enum class mim::plug::mem::malloc : flags_t
strong

Definition at line 73 of file autogen.h.

◆ mslot

enum class mim::plug::mem::mslot : flags_t
strong

Definition at line 87 of file autogen.h.

◆ Ptr

enum class mim::plug::mem::Ptr : flags_t
strong

Definition at line 21 of file autogen.h.

◆ Ptr0

enum class mim::plug::mem::Ptr0 : flags_t
strong

Definition at line 28 of file autogen.h.

◆ remem

enum class mim::plug::mem::remem : flags_t
strong

Definition at line 51 of file autogen.h.

◆ remem_repl

enum class mim::plug::mem::remem_repl : flags_t
strong

Definition at line 116 of file autogen.h.

◆ seo

enum class mim::plug::mem::seo : flags_t
strong

Definition at line 109 of file autogen.h.

◆ slot

enum class mim::plug::mem::slot : flags_t
strong

Definition at line 66 of file autogen.h.

◆ store

enum class mim::plug::mem::store : flags_t
strong

Definition at line 43 of file autogen.h.

Function Documentation

◆ has_leading_mem()

bool mim::plug::mem::has_leading_mem ( const Pi * pi)
inline

Does pi already thread memory - a leading mem.M, either directly or grouped as the first component of the first parameter (e.g.

the Fn [mem.M 0, To, ins] → … shape of a mem-threaded combiner)?

Definition at line 33 of file mem.h.

References mim::Pi::dom(), mim::Axm::isa(), and mim::Def::num_ops().

Referenced by mim::plug::mem::phase::AddMem::rewrite_imm_Pi().

◆ isa_mem()

const App * mim::plug::mem::isa_mem ( const Def * def)
inline

If def is a mem.M-typed value, yields its memory type mem.M a; otherwise nullptr.

Null-safe: type-level Defs (e.g. mim::Univ) have no type and hence are not memory.

Definition at line 26 of file mem.h.

References mim::Axm::isa(), and mim::Def::type().

Referenced by mem_def(), mim::plug::mem::phase::AddMem::rewrite(), and mim::plug::mem::phase::AddMem::rewrite_imm_Tuple().

◆ mem_def()

const Def * mim::plug::mem::mem_def ( const Def * def)
inline

Returns the (first) element of type mem.M a from the given tuple.

Definition at line 42 of file mem.h.

References isa_mem(), mem_def(), mim::Def::num_projs(), mim::Def::projs(), and mim::Def::type().

Referenced by mem_def(), mem_var(), and mim::plug::affine::phase::LowerFor::rewrite_imm_App().

◆ mem_var()

const Def * mim::plug::mem::mem_var ( Lam * lam)
inline

Returns the memory argument of a function if it has one.

Definition at line 55 of file mem.h.

References mem_def(), and mim::Def::var().

Referenced by mim::plug::affine::phase::LowerFor::rewrite_imm_App(), and mim::plug::mem::phase::AddMem::rewrite_mut_Lam().

◆ mut_con() [1/2]

Lam * mim::plug::mem::mut_con ( const Def * dom)
inline

Yields con[mem.M 0, dom].

Definition at line 19 of file mem.h.

References mim::Def::world().

◆ mut_con() [2/2]

Lam * mim::plug::mem::mut_con ( World & w,
nat_t a = 0 )
inline

Yields con[mem.M 0].

Definition at line 16 of file mem.h.

Referenced by mim::plug::matrix::phase::LowerMatrixMediumLevel::rewrite_imm_App().

◆ normalize_lea()

const Def * mim::plug::mem::normalize_lea ( const Def * ,
const Def * ,
const Def * arg )

Definition at line 7 of file normalizers.cpp.

References mim::Axm::as(), mim::Lit::isa(), pointee(), and mim::Def::projs().

◆ normalize_load()

const Def * mim::plug::mem::normalize_load ( const Def * type,
const Def * ,
const Def * arg )

◆ normalize_remem()

const Def * mim::plug::mem::normalize_remem ( const Def * ,
const Def * ,
const Def *  )

Definition at line 31 of file normalizers.cpp.

◆ normalize_store()

const Def * mim::plug::mem::normalize_store ( const Def * ,
const Def * ,
const Def * arg )

Definition at line 33 of file normalizers.cpp.

References mim::Seq::body(), and mim::Def::projs().

◆ op_alloc() [1/2]

const Def * mim::plug::mem::op_alloc ( const Def * type,
const Def * as,
const Def * mem )
inline

◆ op_alloc() [2/2]

const Def * mim::plug::mem::op_alloc ( const Def * type,
const Def * mem )
inline

Definition at line 133 of file mem.h.

References op_alloc().

◆ op_lea()

const Def * mim::plug::mem::op_lea ( const Def * ptr,
const Def * index )
inline

Definition at line 112 of file mem.h.

References mim::Axm::as(), pointee(), mim::tuple_of_types(), mim::Def::type(), and mim::Def::world().

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [1/2]

const Def * mim::plug::mem::op_lea_unsafe ( const Def * ptr,
const Def * i )
inline

Definition at line 119 of file mem.h.

References mim::Axm::as(), op_lea(), mim::Def::type(), mim::plug::core::u, and mim::Def::world().

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [2/2]

const Def * mim::plug::mem::op_lea_unsafe ( const Def * ptr,
u64 i )
inline

Definition at line 124 of file mem.h.

References mim::World::lit_i64(), op_lea_unsafe(), and mim::Def::world().

◆ op_malloc() [1/2]

const Def * mim::plug::mem::op_malloc ( const Def * type,
const Def * as,
const Def * mem )
inline

Definition at line 160 of file mem.h.

References mim::plug::core::size.

Referenced by op_malloc(), and reg_phases().

◆ op_malloc() [2/2]

const Def * mim::plug::mem::op_malloc ( const Def * type,
const Def * mem )
inline

Definition at line 165 of file mem.h.

References op_malloc().

◆ op_mslot() [1/2]

const Def * mim::plug::mem::op_mslot ( const Def * type,
const Def * as,
const Def * mem,
const Def * ret )
inline

Builds the continuation-based %mem.mslot (type, as) applied to (mem, size) and the continuation ret. ret is a Cn [mem.M as, mem.Ptr (type, as)] receiving the fresh slot; its scope delimits the slot's lifetime.

Definition at line 172 of file mem.h.

References mim::plug::core::size.

Referenced by op_mslot(), and reg_phases().

◆ op_mslot() [2/2]

const Def * mim::plug::mem::op_mslot ( const Def * type,
const Def * mem,
const Def * ret )
inline

Definition at line 177 of file mem.h.

References op_mslot().

◆ op_slot() [1/2]

const Def * mim::plug::mem::op_slot ( const Def * type,
const Def * as,
const Def * mem,
const Def * ret )
inline

Builds the continuation-based %mem.slot (type, as) applied to mem and the continuation ret. ret is a Cn [mem.M as, mem.Ptr (type, as)] receiving the fresh slot; its scope delimits the slot's lifetime.

Definition at line 140 of file mem.h.

Referenced by op_slot(), and mim::plug::mem::phase::SEO::rewrite_imm_App().

◆ op_slot() [2/2]

const Def * mim::plug::mem::op_slot ( const Def * type,
const Def * mem,
const Def * ret )
inline

Definition at line 144 of file mem.h.

References op_slot().

◆ pointee()

const Def * mim::plug::mem::pointee ( const Def * ptr)
inline

◆ register_normalizers()

void mim::plug::mem::register_normalizers ( Normalizers & normalizers)

Referenced by mim_get_plugin().

◆ split_slot()

std::tuple< const Def *, Lam *, const Def *, const Def * > mim::plug::mem::split_slot ( const App * slot)
inline

Decomposes the continuation-based slot into (mem, ret_lam, ret_mem, ptr), where ret_mem is the continuation's mem and ptr is the continuation's slot var; the slot's lifetime is ret_lam's scope.

Definition at line 150 of file mem.h.

Referenced by mim::plug::mem::phase::SEO::rewrite_imm_App().

◆ strip_mem()

const Def * mim::plug::mem::strip_mem ( const Def * def)
inline

Recursively removes all occurrences of mem from a tuple.

Returns an empty tuple if applied with mem alone.

Definition at line 76 of file mem.h.

References mim::Axm::isa(), strip_mem(), mim::Def::type(), and mim::Def::world().

Referenced by strip_mem().

◆ strip_mem_ty()

const Def * mim::plug::mem::strip_mem_ty ( const Def * def)
inline

Removes recusively all occurences of mem from a type (sigma).

Definition at line 58 of file mem.h.

References mim::Axm::isa(), strip_mem_ty(), and mim::Def::world().

Referenced by mim::plug::ll::Emitter::convert_ret_pi(), and strip_mem_ty().

Variable Documentation

◆ Plugin_Id

plugin_t mim::plug::mem::Plugin_Id = 0x3863800000000000
staticconstexpr

Definition at line 10 of file autogen.h.