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 (const Def *dom)
 Yields con[mem.M, dom].
 
const Defmem_def (const Def *def)
 Returns the (first) element of type mem::M from the given tuple.
 
const Defmem_var (Lam *lam)
 Returns the memory argument of a function if it has one.
 
const Defreplace_mem (const Def *mem, const Def *arg)
 Swaps the memory occurrences in the given def with the given memory.
 
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 Defop_remem (const Def *mem)
 
const Defnormalize_remem (const Def *, const Def *, const Def *)
 

%mem.alloc

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

%mem.slot

enum class  slot : flags_t
 
const Defop_slot (const Def *type, const Def *mem)
 

%mem.malloc

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

%mem.mslot

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

%mem.lea

enum class  lea : flags_t
 
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

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()

const Def * mim::plug::mem::mem_def ( const Def * 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()

const Def * 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 ( const Def * 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 mim::plug::clos::Clos2SJLJ::enter(), and mim::plug::matrix::LowerMatrixMediumLevel::rewrite_().

◆ 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::force(), mim::Lit::isa(), 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::Pack::body(), and mim::Def::projs().

◆ op_alloc()

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

Definition at line 136 of file mem.h.

References mim::Def::world().

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

◆ op_lea()

const Def * mim::plug::mem::op_lea ( const Def * ptr,
const Def * 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]

const Def * mim::plug::mem::op_lea_unsafe ( const Def * ptr,
const Def * 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]

const Def * mim::plug::mem::op_lea_unsafe ( const Def * 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()

const Def * mim::plug::mem::op_malloc ( const Def * type,
const Def * 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()

const Def * mim::plug::mem::op_mslot ( const Def * type,
const Def * mem,
const Def * 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()

const Def * mim::plug::mem::op_remem ( const Def * mem)
inline

Definition at line 128 of file mem.h.

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

◆ op_slot()

const Def * mim::plug::mem::op_slot ( const Def * type,
const Def * 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()

const Def * mim::plug::mem::replace_mem ( const Def * mem,
const Def * 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()

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 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()

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 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.