MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::mach::AsmEmit Class Referenceabstract

The emit Phase of a native backend: writes GNU assembler code for each external function and each function it calls. More...

#include <mim/plug/mach/asm.h>

Inheritance diagram for mim::plug::mach::AsmEmit:
[legend]

Public Member Functions

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.

Static Public Member Functions

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

virtual void emit (std::ostream &os, Lam *fun, bool global)=0
virtual void finish (std::ostream &)
 Writes what all functions together need after them, e.g. a constant pool.
Protected Member Functions inherited from mim::plug::mach::FunPhase
void start () override
 Actual entry.

Private Member Functions

void start () final
 Actual entry.
void visit (Lam *lam) final
 Emits the functions callees first, so a caller finds the params() of a known callee.

Additional Inherited Members

Protected Attributes inherited from mim::Phase
std::string name_

Detailed Description

The emit Phase of a native backend: writes GNU assembler code for each external function and each function it calls.

The output goes to <world>.s (or a.s if the World is unnamed), or to <file> of -X <plugin>:o=<file>.

Definition at line 19 of file asm.h.

Member Function Documentation

◆ emit()

virtual void mim::plug::mach::AsmEmit::emit ( std::ostream & os,
Lam * fun,
bool global )
protectedpure virtual

Implemented in mim::plug::arm::Emit, and mim::plug::x86::Emit.

Referenced by visit().

◆ finish()

virtual void mim::plug::mach::AsmEmit::finish ( std::ostream & )
inlineprotectedvirtual

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

Reimplemented in mim::plug::x86::Emit.

Definition at line 35 of file asm.h.

Referenced by start().

◆ FunPhase()

mim::plug::mach::FunPhase::FunPhase ( World & world,
flags_t annex,
const Target & target )
inline

Definition at line 57 of file phase.h.

◆ params()

LamMap< ParamRegs > & mim::plug::mach::AsmEmit::params ( )
inline

The param_regs() of the known() functions emitted so far.

Definition at line 30 of file asm.h.

◆ start()

void mim::plug::mach::AsmEmit::start ( )
inlinefinalprivatevirtual

◆ symbol()

std::string mim::plug::mach::AsmEmit::symbol ( Lam * lam)
inlinestatic

The assembler symbol of lam.

Definition at line 24 of file asm.h.

References mim::plug::mach::Target::global_prefix(), mim::Def::is_external(), mim::Def::is_set(), mim::Def::sym(), and mim::Def::unique_name().

◆ visit()

void mim::plug::mach::AsmEmit::visit ( Lam * lam)
inlinefinalprivatevirtual

Emits the functions callees first, so a caller finds the params() of a known callee.

Implements mim::plug::mach::FunPhase.

Definition at line 55 of file asm.h.

References emit().


The documentation for this class was generated from the following file:
  • include/mim/plug/mach/asm.h