MimIR
0.6-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
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
7
#include "
mim/plug/x86/target.h
"
8
9
namespace
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.
13
class
Emit
:
public
mach::AsmEmit
{
14
public
:
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
20
private
:
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
asm.h
mim::Lam
A function.
Definition
lam.h:91
mim::plug::mach::AsmEmit
The emit Phase of a native backend: writes GNU assembler code for each external function and each fun...
Definition
asm.h:19
mim::plug::x86::Emit
Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file.
Definition
emit.h:13
mim::plug::x86::Emit::finish
void finish(std::ostream &os) final
Writes what all functions together need after them, e.g. a constant pool.
Definition
emit.cpp:568
mim::plug::x86::Emit::pool
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
mim::plug::x86
The x86 Plugin
Definition
emit.h:9
mim::plug::x86::emit
emit
Definition
autogen.h:529
mim::u64
uint64_t u64
Definition
types.h:27
target.h
include
mim
plug
x86
emit.h
Generated by
1.18.0