MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
libcall.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/phase/ds2cps.h>
4
5namespace mim::plug::mach {
6
7/// Turns each operation without a native instruction into a call of its C library function, e.g. `expf`, `strlen`, or
8/// `malloc`. It runs before `mem.add_mem`, which threads the memory through the calls of the memory-free ones.
9class LibCall : public DS2CPS {
10public:
11 using DS2CPS::DS2CPS;
12
13private:
14 const Def* rewrite_imm_App(const App*) final;
15 /// Lifts @p app into a call of the C function @p name that takes @p args and the continuation of @p app's type.
16 const Def* call(Sym name, const App* app, Defs args);
17
18 fe::SymMap<DefMap<Lam*>> decls_;
19};
20
21} // namespace mim::plug::mach
An RWPhase that lifts direct-style calls of CPS functions out of the bodies of continuations.
Definition ds2cps.h:25
Base class for all Defs.
Definition def.h:285
const fe::Vector< std::string > & args()
Command-line arguments passed to this Phase's plugin via -X <plugin>:<arg>.
Definition phase.cpp:23
std::string_view name() const
Definition phase.h:63
Turns each operation without a native instruction into a call of its C library function,...
Definition libcall.h:9
const Def * rewrite_imm_App(const App *) final
Definition libcall.cpp:65
The mach Plugin
Definition asm.h:15
fe::View< const Def * > Defs
Definition def.h:94