MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
alloc2malloc.cpp
Go to the documentation of this file.
2
3#include "mim/plug/mem/mem.h"
4
5namespace mim::plug::mem {
6
8 if (auto alloc = match<mem::alloc>(def)) {
9 auto [pointee, addr_space] = alloc->decurry()->args<2>();
10 return op_malloc(pointee, alloc->arg());
11 } else if (auto slot = match<mem::slot>(def)) {
12 auto [pointee, addr_space] = slot->decurry()->args<2>();
13 auto [mem, id] = slot->args<2>();
14 return op_mslot(pointee, mem, id);
15 }
16
17 return def;
18}
19
20} // namespace mim::plug::mem
Helper class to retrieve Infer::arg if present.
Definition def.h:85
The mem Plugin
Definition mem.h:10
Ref op_mslot(Ref type, Ref mem, Ref id)
Definition mem.h:160
Ref op_malloc(Ref type, Ref mem)
Definition mem.h:151
auto match(Ref def)
Definition axiom.h:105