MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
emit.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4
5#include <mim/plug/mach/asm.h>
6
8
9namespace mim::plug::x86 {
10
11/// Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file.
12/// Values live in the registers `mach.regalloc` assigned; jumps, calls, returns, and the entry are parallel copies.
13class Emit : public mach::AsmEmit {
14public:
15 using mach::AsmEmit::AsmEmit;
16
17 /// The index of the 16-byte constant (@p lo, @p hi) in the `.rodata` pool; allocated on first use.
18 size_t pool(u64 lo, u64 hi) { return pool_.emplace(std::pair(lo, hi), pool_.size()).first->second; }
19
20private:
21 void emit(std::ostream& os, Lam* fun, bool global) final;
22 void finish(std::ostream& os) final;
23
24 std::map<std::pair<u64, u64>, size_t> pool_;
25};
26
27} // namespace mim::plug::x86
A function.
Definition lam.h:91
The emit Phase of a native backend: writes GNU assembler code for each external function and each fun...
Definition asm.h:19
Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file.
Definition emit.h:13
void finish(std::ostream &os) final
Writes what all functions together need after them, e.g. a constant pool.
Definition emit.cpp:568
size_t pool(u64 lo, u64 hi)
The index of the 16-byte constant (lo, hi) in the .rodata pool; allocated on first use.
Definition emit.h:18
The x86 Plugin
Definition emit.h:9
uint64_t u64
Definition types.h:27