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

Writes the closed rules among the annexes of a backend's isel plugin as the C++ matchers and builders of a rules::Table in mim::plug::<backend>::rules, to -X <isel>:o=<file> or stdout. More...

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

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

Classes

struct  Annexes
 The annexes of the isel plugin that Gen knows; 0 for one it does not have. More...

Public Member Functions

 Gen (World &world, flags_t annex, std::string_view backend, plugin_t backend_id, std::string_view isel, plugin_t isel_id, Annexes annexes)
 backend names the plugin whose instructions the rules of the plugin isel select.
void start () final
 Actual entry.
std::string_view backend () const
plugin_t backend_id () const
std::string_view isel () const
plugin_t isel_id () const
const Annexes & annexes () const
Machine Facts
virtual u32 cost (const App *insn) const =0
virtual std::optional< size_t > tied (const App *) const
 The operand whose register the result of the two-address instruction insn takes.
virtual std::optional< mach::rules::Want > classify (const Def *) const
 What an operand of the backend's address type type is: Want::Base, Want::Index, or Want::Addr.
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.

Additional Inherited Members

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 Attributes inherited from mim::Phase
std::string name_

Detailed Description

Writes the closed rules among the annexes of a backend's isel plugin as the C++ matchers and builders of a rules::Table in mim::plug::<backend>::rules, to -X <isel>:o=<file> or stdout.

The isel plugin derives from it and states the machine facts of its backend.

Definition at line 21 of file gen.h.


Class Documentation

◆ mim::plug::mach::Gen::Annexes

struct mim::plug::mach::Gen::Annexes

The annexes of the isel plugin that Gen knows; 0 for one it does not have.

Definition at line 24 of file gen.h.

Class Members
flags_t addr = 0 addr p: the address p as an address operand, Want::Addr.
flags_t commutes The tuple of the operations whose two operands a rule also matches swapped.
flags_t formats The values of a family parameter of type «2; Nat».
flags_t imm = 0 The guard imm x: Want::Imm.
flags_t lit = 0 The guard lit x: a literal.
flags_t reg_imm = 0 reg_imm x: Want::RegImm.
flags_t reg_sh = 0 reg_sh x: Want::RegSh.
flags_t scaled = 0 scaled i: Want::Scaled.
flags_t sizes The values of a family parameter of type Nat.
flags_t zx = 0 zx x: Want::Zx of a meta variable, else the non-terminal Zx of a rhs or conversion.

Constructor & Destructor Documentation

◆ Gen()

mim::plug::mach::Gen::Gen ( World & world,
flags_t annex,
std::string_view backend,
plugin_t backend_id,
std::string_view isel,
plugin_t isel_id,
Annexes annexes )
inline

backend names the plugin whose instructions the rules of the plugin isel select.

Definition at line 38 of file gen.h.

References mim::Phase::annex(), annexes(), backend(), backend_id(), isel(), isel_id(), mim::Phase::Phase(), and mim::Phase::world().

Member Function Documentation

◆ annexes()

const Annexes & mim::plug::mach::Gen::annexes ( ) const
inline

Definition at line 58 of file gen.h.

Referenced by Gen().

◆ backend()

std::string_view mim::plug::mach::Gen::backend ( ) const
inline

Definition at line 54 of file gen.h.

Referenced by Gen().

◆ backend_id()

plugin_t mim::plug::mach::Gen::backend_id ( ) const
inline

Definition at line 55 of file gen.h.

Referenced by Gen().

◆ classify()

virtual std::optional< mach::rules::Want > mim::plug::mach::Gen::classify ( const Def * ) const
inlinevirtual

What an operand of the backend's address type type is: Want::Base, Want::Index, or Want::Addr.

Reimplemented in mim::plug::x86_isel::Gen.

Definition at line 67 of file gen.h.

◆ cost()

virtual u32 mim::plug::mach::Gen::cost ( const App * insn) const
pure virtual

The cost of the instruction insn of the backend, which a rule's cost sums up.

Implemented in mim::plug::arm_isel::Gen, and mim::plug::x86_isel::Gen.

◆ isel()

std::string_view mim::plug::mach::Gen::isel ( ) const
inline

Definition at line 56 of file gen.h.

Referenced by Gen().

◆ isel_id()

plugin_t mim::plug::mach::Gen::isel_id ( ) const
inline

Definition at line 57 of file gen.h.

Referenced by Gen().

◆ start()

void mim::plug::mach::Gen::start ( )
inlinefinalvirtual

Actual entry.

Implements mim::Phase.

Definition at line 52 of file gen.h.

References mim::Phase::driver(), and mim::plug::mach::mim_mach_gen().

◆ tied()

virtual std::optional< size_t > mim::plug::mach::Gen::tied ( const App * ) const
inlinevirtual

The operand whose register the result of the two-address instruction insn takes.

Reimplemented in mim::plug::x86_isel::Gen.

Definition at line 65 of file gen.h.


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