11using namespace std::string_literals;
14 Emitter emitter(world, ostream);
20 auto exe = name +
".exe"s;
24 return compile(world, name +
".ll"s, exe);
28 std::ofstream ofs(
ll);
31 auto cmd =
fmt(
"clang \"{}\" -o \"{}\" -Wno-override-module",
ll, out);
37 error(
"compilation failed");
virtual void run()
Entry point and generates some debug output; invokes Phase::start.
The World represents the whole program and manages creation of MimIR nodes (Defs).
int compile_and_run(World &, std::string name, std::string args={})
void emit(World &, std::ostream &)
int compile(World &, std::string name)
int run(std::string cmd, std::string args={})
Wraps sys::system and puts .exe at the back (Windows) and ./ at the front (otherwise) of cmd.
int system(std::string)
Wraps std::system and makes the return value usable.
std::string fmt(const char *s, Args &&... args)
Wraps mim::print to output a formatted std:string.
void error(Loc loc, const char *f, Args &&... args)