MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::x86::Emit Class Reference

Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file. More...

#include <mim/plug/x86/emit.h>

Inheritance diagram for mim::plug::x86::Emit:
[legend]

Public Member Functions

size_t pool (u64 lo, u64 hi)
 The index of the 16-byte constant (lo, hi) in the .rodata pool; allocated on first use.
Public Member Functions inherited from mim::plug::mach::AsmEmit
LamMap< ParamRegs > & params ()
 The param_regs() of the known() functions emitted so far.
 FunPhase (World &world, flags_t annex, const Target &target)
Public Member Functions inherited from mim::plug::mach::FunPhase
 FunPhase (World &world, flags_t annex, const Target &target)
const Target & target () const
const fe::Vector< std::string > & target_args ()
 The arguments -X <backend>:<arg> of the Target's backend plugin.
const LamSet & known () const
 The functions with a convention of their own, see mach::known.
Public Member Functions inherited from mim::Phase
 Phase (World &world, std::string name)
 Phase (World &world, flags_t annex)
virtual ~Phase ()=default
virtual std::unique_ptr< Phase > recreate ()
 Creates a new instance; needed by a fixed-point PhaseMan.
virtual void apply (const App *)
 Invoked if your Phase has additional args.
virtual void apply (Phase &)
 Dito, but invoked by Phase::recreate.
virtual bool redirects () const
 If true, Phase::create uses take_resolved().
virtual std::unique_ptr< Phase > take_resolved ()
 The Phase to use instead; nullptr means elide.
World & world ()
Driver & driver ()
const fe::Log & log () const
std::string_view name () const
flags_t annex () const
const fe::Vector< std::string > & args ()
 Command-line arguments passed to this Phase's plugin via -X <plugin>:<arg>.
bool todo () const
void invalidate (bool todo=true)
 Signals that another round of fixed-point iteration is required, either as part of.
virtual void run ()
 Entry point and generates some debug output; invokes Phase::start.
void profile_count (std::string_view key, uint64_t n=1)
 Adds n to the custom fe::Profiler counter key of the current run; no-op unless profiling is enabled.

Private Member Functions

void emit (std::ostream &os, Lam *fun, bool global) final
void finish (std::ostream &os) final
 Writes what all functions together need after them, e.g. a constant pool.

Additional Inherited Members

Static Public Member Functions inherited from mim::plug::mach::AsmEmit
static std::string symbol (Lam *lam)
 The assembler symbol of lam.
Static Public Member Functions inherited from mim::Phase
static std::unique_ptr< Phase > create (const Flags2Phases &phases, const Def *def)
template<class A, class P>
static void hook (Flags2Phases &phases)
template<class P, class... Args>
static void run (Args &&... args)
 Runs a single Phase.
Protected Member Functions inherited from mim::plug::mach::FunPhase
void start () override
 Actual entry.
Protected Attributes inherited from mim::Phase
std::string name_

Detailed Description

Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file.

Values live in the registers mach.regalloc assigned; jumps, calls, returns, and the entry are parallel copies.

Definition at line 13 of file emit.h.

Member Function Documentation

◆ emit()

void mim::plug::x86::Emit::emit ( std::ostream & os,
Lam * fun,
bool global )
finalprivatevirtual

Implements mim::plug::mach::AsmEmit.

Definition at line 566 of file emit.cpp.

◆ finish()

void mim::plug::x86::Emit::finish ( std::ostream & os)
finalprivatevirtual

Writes what all functions together need after them, e.g. a constant pool.

Reimplemented from mim::plug::mach::AsmEmit.

Definition at line 568 of file emit.cpp.

References mim::plug::mach::Target::is_elf(), and mim::plug::mach::Target::local_prefix().

◆ pool()

size_t mim::plug::x86::Emit::pool ( u64 lo,
u64 hi )
inline

The index of the 16-byte constant (lo, hi) in the .rodata pool; allocated on first use.

Definition at line 18 of file emit.h.


The documentation for this class was generated from the following files: