Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::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  Ptr : flags_t
 
%mem.Ptr0
enum  Ptr0 : flags_t
 
%mem.free
enum  free : flags_t
 
%mem.ignore
enum  ignore : flags_t
 
%mem.rm
enum  rm : flags_t
 
%mem.reshape_mode
enum  reshape_mode : flags_t
 
%mem.reshape_flat
enum  reshape_flat : flags_t
 
%mem.reshape_arg
enum  reshape_arg : flags_t
 
%mem.ssa_pass
enum  ssa_pass : flags_t
 
%mem.copy_prop_pass
enum  copy_prop_pass : flags_t
 
%mem.remem_elim_pass
enum  remem_elim_pass : flags_t
 
%mem.alloc2malloc_pass
enum  alloc2malloc_pass : flags_t
 
%mem.reshape_pass
enum  reshape_pass : flags_t
 
%mem.add_mem_phase
enum  add_mem_phase : flags_t
 

Functions

void register_normalizers (Normalizers &normalizers)
 

Variables

static constexpr plugin_t Plugin_Id = 0x3863800000000000
 

%mem.M

enum  M : flags_t
 
enum  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  load : flags_t
 
Ref normalize_load (Ref type, Ref callee, Ref arg)
 

%mem.store

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

%mem.remem

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

%mem.alloc

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

%mem.slot

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

%mem.malloc

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

%mem.mslot

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

%mem.lea

enum  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 thorin::plug::mem::DefQueue = typedef std::deque<const Def*>

Definition at line 9 of file reshape.h.

Enumeration Type Documentation

◆ add_mem_phase

Definition at line 272 of file autogen.h.

◆ AddrSpace

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

Definition at line 100 of file mem.h.

◆ alloc

Definition at line 84 of file autogen.h.

◆ alloc2malloc_pass

Definition at line 250 of file autogen.h.

◆ copy_prop_pass

Definition at line 228 of file autogen.h.

◆ free

Definition at line 117 of file autogen.h.

◆ ignore

Definition at line 162 of file autogen.h.

◆ lea

Definition at line 139 of file autogen.h.

◆ load

Definition at line 48 of file autogen.h.

◆ M

Definition at line 15 of file autogen.h.

◆ m

Definition at line 151 of file autogen.h.

◆ malloc

Definition at line 106 of file autogen.h.

◆ mslot

Definition at line 128 of file autogen.h.

◆ Ptr

Definition at line 26 of file autogen.h.

◆ Ptr0

Definition at line 37 of file autogen.h.

◆ remem

Definition at line 72 of file autogen.h.

◆ remem_elim_pass

Definition at line 239 of file autogen.h.

◆ reshape_arg

Definition at line 206 of file autogen.h.

◆ reshape_flat

Definition at line 195 of file autogen.h.

◆ reshape_mode

Definition at line 184 of file autogen.h.

◆ reshape_pass

Definition at line 261 of file autogen.h.

◆ rm

Definition at line 173 of file autogen.h.

◆ slot

Definition at line 95 of file autogen.h.

◆ ssa_pass

Definition at line 217 of file autogen.h.

◆ store

Definition at line 60 of file autogen.h.

Function Documentation

◆ mem_def()

Ref thorin::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 mem_def(), thorin::Def::num_projs(), thorin::Def::projs(), and thorin::Def::type().

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

◆ mem_var()

Ref thorin::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 thorin::Def::var().

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

◆ mut_con() [1/2]

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

Yields .con[mem.M, dom].

Definition at line 19 of file mem.h.

References thorin::Def::world().

◆ mut_con() [2/2]

Lam * thorin::plug::mem::mut_con ( World w)
inline

◆ normalize_lea()

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

Definition at line 7 of file normalizers.cpp.

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

◆ normalize_load()

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

Definition at line 18 of file normalizers.cpp.

References thorin::Def::op(), thorin::Def::projs(), and thorin::Def::world().

◆ normalize_remem()

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

Definition at line 32 of file normalizers.cpp.

References normalize_remem(), thorin::World::raw_app(), and thorin::Def::world().

Referenced by normalize_remem().

◆ normalize_store()

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

◆ op_alloc()

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

Definition at line 136 of file mem.h.

References thorin::Def::world().

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

◆ op_lea()

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

Definition at line 111 of file mem.h.

References thorin::tuple_of_types(), thorin::Def::type(), and thorin::Def::world().

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [1/2]

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

Definition at line 118 of file mem.h.

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

Referenced by op_lea_unsafe().

◆ op_lea_unsafe() [2/2]

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

Definition at line 123 of file mem.h.

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

◆ op_malloc()

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

Definition at line 152 of file mem.h.

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

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

◆ op_mslot()

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

Definition at line 161 of file mem.h.

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

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

◆ op_remem()

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

Definition at line 128 of file mem.h.

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

◆ op_slot()

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

Definition at line 144 of file mem.h.

References thorin::Def::world().

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

◆ register_normalizers()

void thorin::plug::mem::register_normalizers ( Normalizers normalizers)

Referenced by thorin_get_plugin().

◆ replace_mem()

Ref thorin::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 thorin::Def::num_projs(), and thorin::Def::type().

◆ strip_mem()

Ref thorin::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 strip_mem(), thorin::Def::type(), and thorin::Def::world().

Referenced by strip_mem().

◆ strip_mem_ty()

Ref thorin::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 strip_mem_ty(), and thorin::Def::world().

Referenced by strip_mem_ty().

Variable Documentation

◆ Plugin_Id

constexpr plugin_t thorin::plug::mem::Plugin_Id = 0x3863800000000000
staticconstexpr

Definition at line 10 of file autogen.h.