MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::x86::insn Namespace Reference

Machine facts about the instructions of the x86 plugin, shared by x86_isel.gen and the backend. More...

Functions

std::optional< size_t > tied (flags_t base)
 The operand whose register the result of a two-address instruction base takes.
bool commutes (flags_t base)
 Does the two-address instruction base compute the same with its operands swapped?
flags_t op (const App *app)
 The operation f of the memory form x86.rm f, x86.rm1 f, or x86.mr f app.
std::optional< size_t > tied (const App *app)
 The operand whose register the result of the two-address instruction app takes.
u32 latency (flags_t base, nat_t s)
 The latency in cycles of the instruction base on s-bit operands, roughly as on recent cores (uops.info).
u32 cost (const App *app)
 The cost of the instruction app: its latency plus one, so of two equally fast covers the shorter wins.

Variables

constexpr u32 Load = 4

Detailed Description

Machine facts about the instructions of the x86 plugin, shared by x86_isel.gen and the backend.

Function Documentation

◆ commutes()

bool mim::plug::x86::insn::commutes ( flags_t base)
inline

Does the two-address instruction base compute the same with its operands swapped?

Definition at line 33 of file insn.h.

References mim::Annex::Base, and commutes().

Referenced by commutes(), and mim::plug::x86::Target::untie().

◆ cost()

u32 mim::plug::x86::insn::cost ( const App * app)
inline

The cost of the instruction app: its latency plus one, so of two equally fast covers the shorter wins.

An address is no instruction and costs nothing.

Definition at line 65 of file insn.h.

References mim::App::arg(), mim::App::args(), mim::App::axm(), mim::Annex::Base, cost(), mim::Axm::isa(), mim::Idx::isa_lit(), latency(), Load, op(), mim::Def::proj(), mim::plug::x86::reg_width(), and mim::Def::type().

Referenced by cost(), and mim::plug::x86_isel::Gen::cost().

◆ latency()

u32 mim::plug::x86::insn::latency ( flags_t base,
nat_t s )
inline

The latency in cycles of the instruction base on s-bit operands, roughly as on recent cores (uops.info).

Definition at line 52 of file insn.h.

References mim::Annex::Base, latency(), Load, and mim::plug::x86::reg_width().

Referenced by cost(), and latency().

◆ op()

flags_t mim::plug::x86::insn::op ( const App * app)
inline

The operation f of the memory form x86.rm f, x86.rm1 f, or x86.mr f app.

Definition at line 40 of file insn.h.

References mim::App::arg(), mim::App::callee(), mim::Axm::get(), and op().

Referenced by cost(), op(), and tied().

◆ tied() [1/2]

std::optional< size_t > mim::plug::x86::insn::tied ( const App * app)
inline

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

x86.rm f (m, a, addr) overwrites a if f overwrites its first operand.

Definition at line 44 of file insn.h.

References mim::App::axm(), mim::Annex::Base, mim::Axm::base(), op(), and tied().

◆ tied() [2/2]

std::optional< size_t > mim::plug::x86::insn::tied ( flags_t base)
inline

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

Definition at line 20 of file insn.h.

References mim::Annex::Base, and tied().

Referenced by mim::plug::x86::Target::constraint(), tied(), tied(), and mim::plug::x86_isel::Gen::tied().

Variable Documentation

◆ Load

u32 mim::plug::x86::insn::Load = 4
inlineconstexpr

Definition at line 17 of file insn.h.

Referenced by cost(), and latency().