This type tracks all kinds of side effects in the given address space.
Pointer type with pointee type T and address space a. At the moment, the address space is not really used and serves as a placeholder for future work.
The following operations have side effects. For this reason, they consume a mem.M a and yield a new mem.M a.
Loads the pointee of type T from a pointer of type mem.Ptr (T, a).
Stores a value of type T to the location pointed to by a pointer of type mem.Ptr (T, a).
Creates a new dummy mem.M a-typed value in order to acknowledge the fact that some unspecified side-effect happened.
Passes a fresh mem.M a for address space a to its return continuation: ret mem = mem.fresh $ 0. Conversion-only phases (e.g. tensor.lower_to_mem) emit memory operations before memory has been threaded. Each call site's return continuation is a distinct mutable, so the received memories are distinct by construction - hash-consing cannot collapse two otherwise identical memory operations into one. mem.add_mem resolves each call by jumping to the continuation with the memory that is current at that point.
Allocates memory of type T in address space a.
Reserves a stack slot for type T in address space a. The slot is passed to the continuation and its lifetime is scoped to that continuation.
Allocates memory of type T in address space a. The difference to mem.alloc is that the size is passed explicitly (in bytes) instead of being derived from T.
Frees memory of type T in address space a.
Reserves a stack slot for type T in address space a. The reserved slot will be size bytes large. The slot is passed to the continuation and its lifetime is scoped to that continuation.
Load effective address. Performs address computation by offsetting the passed pointer with index i.
Threads mem.M through functions that lack it.
Symbolic Expression Optimization — SSA construction, expression propagation, and GVN in one fixed point (see mim::plug::mem::phase::SEO).
Removes mem.remems.
Rewrites mem.alloc / mem.slot into mem.malloc / mem.mslot.