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

The mem Plugin More...

Classes

class  AddMem
 This phase adds mems to all lambdas and continuations. More...
 
class  Alloc2Malloc
 
class  CopyProp
 This FPPass is similar to sparse conditional constant propagation (SCCP). More...
 
class  RememElim
 
class  Reshape
 The general idea of this pass/phase is to change the shape of signatures of functions. More...
 
class  SSAConstr
 SSA construction algorithm that promotes slots, loads, and stores to SSA values. More...
 

Typedefs

using DefQueue = std::deque<const Def*>
 

Enumerations

%mem.Ptr
enum class  AddrSpace : nat_t {
  Generic = 0 ,
  Global = 1 ,
  Texture = 2 ,
  Shared = 3 ,
  Constant = 4
}
 
enum class  Ptr : flags_t
 
%mem.Ptr0
enum class  Ptr0 : flags_t
 
%mem.free
enum class  free : flags_t
 
%mem.ignore
enum class  ignore : flags_t
 
%mem.rm
enum class  rm : flags_t
 
%mem.reshape_mode
enum class  reshape_mode : flags_t
 
%mem.reshape_flat
enum class  reshape_flat : flags_t
 
%mem.reshape_arg
enum class  reshape_arg : flags_t
 
%mem.ssa_pass
enum class  ssa_pass : flags_t
 
%mem.copy_prop_pass
enum class  copy_prop_pass : flags_t
 
%mem.remem_elim_pass
enum class  remem_elim_pass : flags_t
 
%mem.alloc2malloc_pass
enum class  alloc2malloc_pass : flags_t
 
%mem.reshape_pass
enum class  reshape_pass : flags_t
 
%mem.add_mem_phase
enum class  add_mem_phase : flags_t
 

Functions

void register_normalizers (Normalizers &normalizers)
 

Variables

static constexpr plugin_t Plugin_Id = 0x3863800000000000
 

%mem.M

enum class  M : flags_t
 
enum class  m : flags_t
 
Lammut_con (World &w)
 Yields con[mem.M].
 
Lammut_con (Ref dom)
 Yields con[mem.M, dom].
 
Ref mem_def (Ref def)
 Returns the (first) element of type mem::M from the given tuple.
 
Ref mem_var (Lam *lam)
 Returns the memory argument of a function if it has one.
 
Ref replace_mem (Ref mem, Ref arg)
 Swaps the memory occurrences in the given def with the given memory.
 
Ref strip_mem_ty (Ref def)
 Removes recusively all occurences of mem from a type (sigma).
 
Ref strip_mem (Ref def)
 Recursively removes all occurrences of mem from a tuple.
 

%mem.load

enum class  load : flags_t
 
Ref normalize_load (Ref type, Ref callee, Ref arg)
 

%mem.store

enum class  store : flags_t
 
Ref normalize_store (Ref type, Ref callee, Ref arg)
 

%mem.remem

enum class  remem : flags_t
 
Ref op_remem (Ref mem)
 
Ref normalize_remem (Ref type, Ref callee, Ref mem)
 

%mem.alloc

enum class  alloc : flags_t
 
Ref op_alloc (Ref type, Ref mem)
 

%mem.slot

enum class  slot : flags_t
 
Ref op_slot (Ref type, Ref mem)
 

%mem.malloc

enum class  malloc : flags_t
 
Ref op_malloc (Ref type, Ref mem)
 

%mem.mslot

enum class  mslot : flags_t
 
Ref op_mslot (Ref type, Ref mem, Ref id)
 

%mem.lea

enum class  lea : flags_t
 
Ref op_lea (Ref ptr, Ref index)
 
Ref op_lea_unsafe (Ref ptr, Ref i)
 
Ref op_lea_unsafe (Ref ptr, u64 i)
 
Ref normalize_lea (Ref type, Ref callee, Ref arg)
 

Detailed Description

Typedef Documentation

◆ DefQueue

using mim::plug::mem::DefQueue = std::deque<const Def*>

Definition at line 9 of file reshape.h.

Enumeration Type Documentation

◆ add_mem_phase

Definition at line 179 of file autogen.h.

◆ AddrSpace

enum class mim::plug::mem::AddrSpace : nat_t
strong
Enumerator
Generic 
Global 
Texture 
Shared 
Constant 

Definition at line 100 of file mem.h.

◆ alloc

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

Definition at line 59 of file autogen.h.

◆ alloc2malloc_pass

Definition at line 165 of file autogen.h.

◆ copy_prop_pass

Definition at line 151 of file autogen.h.

◆ free

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

Definition at line 80 of file autogen.h.

◆ ignore

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

Definition at line 109 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.

◆ m

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

Definition at line 102 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_elim_pass

Definition at line 158 of file autogen.h.

◆ reshape_arg

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

Definition at line 137 of file autogen.h.

◆ reshape_flat

Definition at line 130 of file autogen.h.

◆ reshape_mode

Definition at line 123 of file autogen.h.

◆ reshape_pass

Definition at line 172 of file autogen.h.

◆ rm

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

Definition at line 116 of file autogen.h.

◆ slot

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

Definition at line 66 of file autogen.h.

◆ ssa_pass

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

Definition at line 144 of file autogen.h.

◆ store

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

Definition at line 43 of file autogen.h.

Function Documentation

◆ mem_def()

Ref mim::plug::mem::mem_def ( Ref def)
inline

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

Definition at line 25 of file mem.h.

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

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

◆ mem_var()

Ref mim::plug::mem::mem_var ( Lam * lam)
inline

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

Definition at line 38 of file mem.h.

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

Referenced by mim::plug::clos::Clos2SJLJ::enter(), mim::plug::affine::LowerFor::rewrite(), and mim::plug::mem::CopyProp::rewrite().

◆ mut_con() [1/2]

Lam * mim::plug::mem::mut_con ( Ref dom)
inline

Yields con[mem.M, 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)
inline

Yields con[mem.M].

Definition at line 16 of file mem.h.

Referenced by dfa2matcher(), mim::plug::clos::Clos2SJLJ::enter(), and mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().

◆ normalize_lea()

Ref mim::plug::mem::normalize_lea ( Ref type,
Ref callee,
Ref arg )

Definition at line 7 of file normalizers.cpp.

References mim::force(), mim::Lit::isa(), mim::Def::projs(), and mim::Def::world().

◆ normalize_load()

Ref mim::plug::mem::normalize_load ( Ref type,
Ref callee,
Ref arg )

◆ normalize_remem()

Ref mim::plug::mem::normalize_remem ( Ref type,
Ref callee,
Ref mem )

Definition at line 32 of file normalizers.cpp.

References mim::World::raw_app(), and mim::Def::world().

◆ normalize_store()

Ref mim::plug::mem::normalize_store ( Ref type,
Ref callee,
Ref arg )

Definition at line 39 of file normalizers.cpp.

References mim::Pack::body(), mim::Def::projs(), and mim::Def::world().

◆ op_alloc()

Ref mim::plug::mem::op_alloc ( Ref type,
Ref mem )
inline

Definition at line 136 of file mem.h.

References mim::Def::world().

Referenced by mim::plug::matrix::LowerMatrixLowLevel::rewrite_imm().

◆ op_lea()

Ref mim::plug::mem::op_lea ( Ref ptr,
Ref index )
inline

Definition at line 111 of file mem.h.

References mim::force(), mim::tuple_of_types(), mim::Def::type(), and mim::Def::world().

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [1/2]

Ref mim::plug::mem::op_lea_unsafe ( Ref ptr,
Ref i )
inline

Definition at line 118 of file mem.h.

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

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [2/2]

Ref mim::plug::mem::op_lea_unsafe ( Ref ptr,
u64 i )
inline

Definition at line 123 of file mem.h.

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

◆ op_malloc()

Ref mim::plug::mem::op_malloc ( Ref type,
Ref mem )
inline

Definition at line 152 of file mem.h.

References mim::plug::core::size, and mim::Def::world().

Referenced by mim::plug::mem::Alloc2Malloc::rewrite().

◆ op_mslot()

Ref mim::plug::mem::op_mslot ( Ref type,
Ref mem,
Ref id )
inline

Definition at line 161 of file mem.h.

References mim::plug::core::size, and mim::Def::world().

Referenced by mim::plug::mem::Alloc2Malloc::rewrite().

◆ op_remem()

Ref mim::plug::mem::op_remem ( Ref mem)
inline

Definition at line 128 of file mem.h.

Referenced by mim::plug::mem::SSAConstr::rewrite().

◆ op_slot()

Ref mim::plug::mem::op_slot ( Ref type,
Ref mem )
inline

Definition at line 144 of file mem.h.

References mim::Def::world().

Referenced by mim::plug::clos::Clos2SJLJ::enter().

◆ register_normalizers()

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

Referenced by mim_get_plugin().

◆ replace_mem()

Ref mim::plug::mem::replace_mem ( Ref mem,
Ref arg )
inline

Swaps the memory occurrences in the given def with the given memory.

Definition at line 41 of file mem.h.

References mim::match(), mim::Def::num_projs(), and mim::Def::type().

◆ strip_mem()

Ref mim::plug::mem::strip_mem ( Ref def)
inline

Recursively removes all occurrences of mem from a tuple.

Returns an empty tuple if applied with mem alone.

Definition at line 72 of file mem.h.

References mim::match(), mim::Def::ops(), mim::Def::projs(), strip_mem(), mim::Def::type(), and mim::Def::world().

Referenced by strip_mem().

◆ strip_mem_ty()

Ref mim::plug::mem::strip_mem_ty ( Ref def)
inline

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

Definition at line 54 of file mem.h.

References mim::match(), mim::Def::ops(), strip_mem_ty(), and mim::Def::world().

Referenced by strip_mem_ty().

Variable Documentation

◆ Plugin_Id

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

Definition at line 10 of file autogen.h.