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

The machine facts of the x86-64 backend; the ABI is System V AMD64. More...

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

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

Public Member Functions

 Target ()
bool is_flags (const Def *def) const final
bool is_sched_cc (const App *app) const final
 Is app the sched of the backend's cc?
size_t negate_cc (size_t c) const final
 The hardware encoding pairs each condition code with its negation in bit 0.
bool is_machine_insn (const App *app) const final
 An address is no instruction.
bool is_mem_insn (const App *app) const final
 Is app an instruction that takes the mem.M 0 it continues as its first argument?
size_t num_regs (Class cls) const final
bool reserved (Class cls, size_t r) const final
 Is r never available to register allocation?
bool caller_saved (Class cls, size_t r) const final
 The XMM registers are all caller-saved.
size_t num_arg_regs (Class cls) const final
 The XMM registers are their own argument registers.
size_t arg_reg (Class cls, size_t i) const final
 The register of the i-th argument of class cls.
size_t ret_reg (Class cls) const final
mach::Constraint constraint (const App *insn) const final
 The register constraint of insn; by default, it has none.
const App * untie (const App *insn, const DefSet &after, const Def *phi) const final
 Swaps a commutative operation whose other operand dies and turns such a sub into an rsub.
bool fits_imm (const Def *lit) const final
 A literal that fits a sign-extended 32-bit immediate.
bool is_removable (const App *insn) const final
 May insn go if nothing uses its results, e.g.
Public Member Functions inherited from mim::plug::mach::Target
 Target (std::string_view name, plugin_t plugin)
 plugin is the backend's plugin id.
nat_t ptr_size () const override
 The size and alignment of a pointer in bytes; see core.trait.
size_t num_allocatable (Class cls) const
 The number of registers of cls that register allocation may assign.
size_t num_caller_saved (Class cls) const
 The number of those that a call may clobber.
const App * isa_sched_cc (const Def *cond) const
 The sched of a cc that yields cond, if any.
Class cls (const Def *def) const
bool is_insn (const App *app) const
 Is app an instruction that belongs on a mem.M 0 chain?
const Def * in (Class cls, size_t r, const Def *v) const
 The value v of class cls in register r.
const Def * prev_mem (const App *app) const
 The memory app continues, if app is an instruction on a mem.M 0 chain.
Public Member Functions inherited from mim::Target
 Target (std::string_view name)
virtual ~Target ()=default
std::string_view name () const
 The plugin name, used as the prefix of diagnostics.

Additional Inherited Members

Public Types inherited from mim::plug::mach::Target
enum  Class : size_t {
  Gpr ,
  Fpr ,
  Flags ,
  Stack ,
  Num_Classes
}
 The register classes; Stack values live in a spill slot and are unbounded. More...
Static Public Member Functions inherited from mim::plug::mach::Target
static const Target & of (Driver &driver)
 The Target of the one loaded backend; every backend's Target is a mach::Target.
static constexpr bool is_elf ()
static constexpr std::string_view global_prefix ()
 The prefix that the object format adds to a C symbol.
static constexpr std::string_view local_prefix ()
 The prefix of an assembler-local label.
static const Def * spill (const Def *type)
static const Def * reload (const Def *type)
 The instruction that reloads a value of type from its spill slot.
static const Def * spill_type (const Def *type)
 The type of the spill slot of a value of type.
static bool is_lowered (const Axm *axm)
 Is axm an operation that instruction selection must have replaced?
static DefVec operands (const App *insn)
 The operands of insn: the argument of a sched's instruction, otherwise the arguments including the memory.
static const Def * result (const App *insn, size_t j)
 The j-th projection of the non-memory result of insn.
static const App * rebuild (const App *insn, const Def *m, const DefVec &ops)
 insn continuing m with ops instead of its operands.
static bool is_in (const Def *def)
static size_t in_reg (const Def *inin)
 The register r of in r v.
static bool is_view (const Def *def)
 Is def a zext d v, which reads v's register?
static const Def * unview (const Def *def)
 The v of zext d v, otherwise def.
static const Def * strip (const Def *def)
 The v of in r v, zext d v, or zext d (in r v), otherwise def.
static const Def * sched_insn (const App *app)
static bool is_mem (const Def *def)

Detailed Description

The machine facts of the x86-64 backend; the ABI is System V AMD64.

Definition at line 11 of file target.h.

Constructor & Destructor Documentation

◆ Target()

mim::plug::x86::Target::Target ( )
inline

Definition at line 13 of file target.h.

References Target().

Referenced by Target().

Member Function Documentation

◆ arg_reg()

size_t mim::plug::x86::Target::arg_reg ( Class cls,
size_t i ) const
inlinefinalvirtual

The register of the i-th argument of class cls.

Implements mim::plug::mach::Target.

Definition at line 36 of file target.h.

References mim::plug::x86::Arg_Regs, mim::plug::mach::Target::cls(), and mim::plug::mach::Target::Gpr.

◆ caller_saved()

bool mim::plug::x86::Target::caller_saved ( Class cls,
size_t r ) const
inlinefinalvirtual

The XMM registers are all caller-saved.

Implements mim::plug::mach::Target.

Definition at line 33 of file target.h.

References mim::plug::x86::Caller_Saved, mim::plug::mach::Target::cls(), and mim::plug::mach::Target::Gpr.

◆ constraint()

mach::Constraint mim::plug::x86::Target::constraint ( const App * insn) const
finalvirtual

The register constraint of insn; by default, it has none.

Its operands are values, so an operand zext d v is v.

Reimplemented from mim::plug::mach::Target.

Definition at line 12 of file target.cpp.

References mim::Annex::Base, mim::plug::mach::Target::constraint(), mim::plug::x86::encoding(), mim::Axm::get(), mim::Axm::isa(), mim::Lit::isa(), mim::plug::x86::rax, mim::plug::x86::rcx, mim::plug::x86::rdx, mim::plug::mach::Target::sched_insn(), and mim::plug::x86::insn::tied().

◆ fits_imm()

bool mim::plug::x86::Target::fits_imm ( const Def * lit) const
inlinefinalvirtual

A literal that fits a sign-extended 32-bit immediate.

Reimplemented from mim::plug::mach::Target.

Definition at line 44 of file target.h.

References mim::plug::x86::fits_imm().

◆ is_flags()

bool mim::plug::x86::Target::is_flags ( const Def * def) const
inlinefinalvirtual

Is def a Flags value or a condition tested on one, neither of which is a register value?

Implements mim::plug::mach::Target.

Definition at line 16 of file target.h.

References mim::Axm::isa().

◆ is_machine_insn()

bool mim::plug::x86::Target::is_machine_insn ( const App * app) const
inlinefinalvirtual

An address is no instruction.

Reimplemented from mim::plug::mach::Target.

Definition at line 25 of file target.h.

References mim::plug::mach::Target::is_machine_insn(), and mim::Axm::isa().

◆ is_mem_insn()

bool mim::plug::x86::Target::is_mem_insn ( const App * app) const
finalvirtual

Is app an instruction that takes the mem.M 0 it continues as its first argument?

mach.slot; a backend adds its loads and stores.

Reimplemented from mim::plug::mach::Target.

Definition at line 7 of file target.cpp.

References mim::plug::mach::Target::is_mem_insn(), and mim::Axm::isa().

◆ is_removable()

bool mim::plug::x86::Target::is_removable ( const App * insn) const
finalvirtual

May insn go if nothing uses its results, e.g.

a load? A mach.sched and mach.slot; a backend adds its loads.

Reimplemented from mim::plug::mach::Target.

Definition at line 60 of file target.cpp.

References mim::plug::mach::Target::is_removable(), and mim::Axm::isa().

◆ is_sched_cc()

bool mim::plug::x86::Target::is_sched_cc ( const App * app) const
inlinefinalvirtual

Is app the sched of the backend's cc?

Implements mim::plug::mach::Target.

Definition at line 17 of file target.h.

References mim::Axm::isa(), and mim::plug::mach::Target::sched_insn().

◆ negate_cc()

size_t mim::plug::x86::Target::negate_cc ( size_t c) const
inlinefinalvirtual

The hardware encoding pairs each condition code with its negation in bit 0.

Implements mim::plug::mach::Target.

Definition at line 21 of file target.h.

◆ num_arg_regs()

size_t mim::plug::x86::Target::num_arg_regs ( Class cls) const
inlinefinalvirtual

The XMM registers are their own argument registers.

Implements mim::plug::mach::Target.

Definition at line 35 of file target.h.

References mim::plug::x86::Arg_Regs, mim::plug::mach::Target::cls(), and mim::plug::mach::Target::Gpr.

◆ num_regs()

size_t mim::plug::x86::Target::num_regs ( Class cls) const
inlinefinalvirtual

◆ reserved()

bool mim::plug::x86::Target::reserved ( Class cls,
size_t r ) const
inlinefinalvirtual

Is r never available to register allocation?

Implements mim::plug::mach::Target.

Definition at line 31 of file target.h.

References mim::plug::mach::Target::cls(), mim::plug::mach::Target::Gpr, and mim::plug::x86::reserved().

◆ ret_reg()

size_t mim::plug::x86::Target::ret_reg ( Class cls) const
inlinefinalvirtual

◆ untie()

const App * mim::plug::x86::Target::untie ( const App * insn,
const DefSet & after,
const Def * phi ) const
finalvirtual

Swaps a commutative operation whose other operand dies and turns such a sub into an rsub.

Otherwise, it turns an imul by a literal into an imul3 and an add into an add3.

Reimplemented from mim::plug::mach::Target.

Definition at line 37 of file target.cpp.

References mim::App::arg(), mim::plug::x86::b, mim::Annex::Base, mim::plug::x86::insn::commutes(), mim::Axm::get(), mim::Axm::isa(), mim::Lit::isa(), mim::plug::mach::Target::sched_insn(), and mim::plug::mach::Target::unview().


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