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

The x86 Plugin More...

Namespaces

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

Classes

class  Emit
 Writes GNU assembler code (AT&T syntax) for the scheduled world; see AsmEmit for the output file. More...
struct  Reg
 A physical register of a register class. More...
struct  Src
 The source of a copy: a register or a literal; reg.cls is the class of either. More...
class  Target
 The machine facts of the x86-64 backend; the ABI is System V AMD64. More...

Enumerations

<tt>x86.Base</tt>
enum class  Base : flags_t
<tt>x86.Index</tt>
enum class  Index : flags_t
enum class  index : flags_t
<tt>x86.scale_1</tt>
enum class  scale_1 : flags_t
<tt>x86.scale_2</tt>
enum class  scale_2 : flags_t
<tt>x86.scale_4</tt>
enum class  scale_4 : flags_t
<tt>x86.scale_8</tt>
enum class  scale_8 : flags_t
<tt>x86.is_gpr</tt>
enum class  is_gpr : flags_t
<tt>x86.gpr</tt>
enum class  gpr : flags_t
<tt>x86.gpr16</tt>
enum class  gpr16 : flags_t
<tt>x86.logic</tt>
enum class  logic : flags_t
<tt>x86.rm</tt>
enum class  rm : flags_t
<tt>x86.rm1</tt>
enum class  rm1 : flags_t
<tt>x86.mr</tt>
enum class  mr : flags_t
<tt>x86.reg</tt>
enum class  reg : flags_t {
  rax = 0x67ef000000001000 ,
  rcx = 0x67ef000000001001 ,
  rdx = 0x67ef000000001002 ,
  rbx = 0x67ef000000001003 ,
  rsp = 0x67ef000000001004 ,
  rbp = 0x67ef000000001005 ,
  rsi = 0x67ef000000001006 ,
  rdi = 0x67ef000000001007 ,
  r8 = 0x67ef000000001008 ,
  r9 = 0x67ef000000001009 ,
  r10 = 0x67ef00000000100a ,
  r11 = 0x67ef00000000100b ,
  r12 = 0x67ef00000000100c ,
  r13 = 0x67ef00000000100d ,
  r14 = 0x67ef00000000100e ,
  r15 = 0x67ef00000000100f
}
<tt>x86.xmm</tt>
enum class  xmm : flags_t {
  xmm0 = 0x67ef000000001100 ,
  xmm1 = 0x67ef000000001101 ,
  xmm2 = 0x67ef000000001102 ,
  xmm3 = 0x67ef000000001103 ,
  xmm4 = 0x67ef000000001104 ,
  xmm5 = 0x67ef000000001105 ,
  xmm6 = 0x67ef000000001106 ,
  xmm7 = 0x67ef000000001107 ,
  xmm8 = 0x67ef000000001108 ,
  xmm9 = 0x67ef000000001109 ,
  xmm10 = 0x67ef00000000110a ,
  xmm11 = 0x67ef00000000110b ,
  xmm12 = 0x67ef00000000110c ,
  xmm13 = 0x67ef00000000110d ,
  xmm14 = 0x67ef00000000110e ,
  xmm15 = 0x67ef00000000110f
}
<tt>x86.mov</tt>
enum class  mov : flags_t
<tt>x86.load</tt>
enum class  load : flags_t
<tt>x86.store</tt>
enum class  store : flags_t
<tt>x86.add</tt>
enum class  add : flags_t
<tt>x86.sub</tt>
enum class  sub : flags_t
<tt>x86.and</tt>
enum class  and_ : flags_t
<tt>x86.or</tt>
enum class  or_ : flags_t
<tt>x86.xor</tt>
enum class  xor_ : flags_t
<tt>x86.imul</tt>
enum class  imul : flags_t
<tt>x86.add3</tt>
enum class  add3 : flags_t
<tt>x86.rsub</tt>
enum class  rsub : flags_t
<tt>x86.imul3</tt>
enum class  imul3 : flags_t
<tt>x86.div</tt>
enum class  div : flags_t
<tt>x86.idiv</tt>
enum class  idiv : flags_t
<tt>x86.shl</tt>
enum class  shl : flags_t
<tt>x86.shr</tt>
enum class  shr : flags_t
<tt>x86.sar</tt>
enum class  sar : flags_t
<tt>x86.zero</tt>
enum class  zero : flags_t
<tt>x86.cmp</tt>
enum class  cmp : flags_t
<tt>x86.test</tt>
enum class  test : flags_t
<tt>x86.cc</tt>
enum class  cc : flags_t {
  o = 0x67ef000000002a00 ,
  no = 0x67ef000000002a01 ,
  b = 0x67ef000000002a02 ,
  ae = 0x67ef000000002a03 ,
  e = 0x67ef000000002a04 ,
  ne = 0x67ef000000002a05 ,
  be = 0x67ef000000002a06 ,
  a = 0x67ef000000002a07 ,
  s = 0x67ef000000002a08 ,
  ns = 0x67ef000000002a09 ,
  p = 0x67ef000000002a0a ,
  np = 0x67ef000000002a0b ,
  l = 0x67ef000000002a0c ,
  ge = 0x67ef000000002a0d ,
  le = 0x67ef000000002a0e ,
  g = 0x67ef000000002a0f
}
<tt>x86.fmov</tt>
enum class  fmov : flags_t
<tt>x86.fload</tt>
enum class  fload : flags_t
<tt>x86.fstore</tt>
enum class  fstore : flags_t
<tt>x86.fadd</tt>
enum class  fadd : flags_t
<tt>x86.fsub</tt>
enum class  fsub : flags_t
<tt>x86.fmul</tt>
enum class  fmul : flags_t
<tt>x86.fdiv</tt>
enum class  fdiv : flags_t
<tt>x86.fsqrt</tt>
enum class  fsqrt : flags_t
<tt>x86.fabs</tt>
enum class  fabs : flags_t
<tt>x86.fcmp</tt>
enum class  fcmp : flags_t {
  f = 0x67ef000000003500 ,
  e = 0x67ef000000003501 ,
  l = 0x67ef000000003502 ,
  le = 0x67ef000000003503 ,
  g = 0x67ef000000003504 ,
  ge = 0x67ef000000003505 ,
  ne = 0x67ef000000003506 ,
  o = 0x67ef000000003507 ,
  u = 0x67ef000000003508 ,
  ue = 0x67ef000000003509 ,
  ul = 0x67ef00000000350a ,
  ule = 0x67ef00000000350b ,
  ug = 0x67ef00000000350c ,
  uge = 0x67ef00000000350d ,
  une = 0x67ef00000000350e ,
  t = 0x67ef00000000350f
}
<tt>x86.fsel</tt>
enum class  fsel : flags_t
<tt>x86.i2f</tt>
enum class  i2f : flags_t
<tt>x86.u2f</tt>
enum class  u2f : flags_t
<tt>x86.f2i</tt>
enum class  f2i : flags_t
<tt>x86.f2u</tt>
enum class  f2u : flags_t
<tt>x86.f2f</tt>
enum class  f2f : flags_t
<tt>x86.isel</tt>
enum class  isel : flags_t
<tt>x86.emit</tt>
enum class  emit : flags_t

Functions

nat_t reg_width (nat_t size)
 Width of the register holding an Idx size.
bool fits_i32 (s64 x)
bool fits_imm (std::optional< nat_t > size, nat_t val)
 Does the literal val fit a sign-extended 32-bit immediate, if it is an Idx size?
bool fits_imm (const Def *lit)
 Does the literal lit fit a sign-extended 32-bit immediate?
constexpr bool reserved (size_t r)
void register_normalizers (Normalizers &normalizers)
template<class Reg>
constexpr size_t encoding (Reg r)
 The hardware encoding of the register r of a backend's module reg, whose subtags are in encoding order.

Variables

constexpr size_t Num_Regs = Annex::num<reg>()
constexpr size_t Num_Xmm = Annex::num<xmm>()
constexpr std::array< size_t, 6 > Arg_Regs
 System V AMD64 ABI.
constexpr std::array< bool, Num_Regs > Caller_Saved = {1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}
static constexpr plugin_t Plugin_Id = 0x67ef000000000000

<tt>x86.Addr</tt>

enum class  Addr : flags_t
enum class  addr : flags_t
const Def * normalize_addr (const Def *type, const Def *, const Def *arg)

<tt>x86.lea</tt>

enum class  lea : flags_t
const Def * normalize_lea (const Def *type, const Def *, const Def *a)

<tt>x86.movzx</tt>

enum class  movzx : flags_t
const Def * normalize_movzx (const Def *type, const Def *, const Def *x)

<tt>x86.movsx</tt>

enum class  movsx : flags_t
const Def * normalize_movsx (const Def *type, const Def *, const Def *x)

<tt>x86.trunc</tt>

enum class  trunc : flags_t
const Def * normalize_trunc (const Def *type, const Def *, const Def *x)

<tt>x86.cmovcc</tt>

enum class  cmovcc : flags_t {
  o = 0x67ef000000002b00 ,
  no = 0x67ef000000002b01 ,
  b = 0x67ef000000002b02 ,
  ae = 0x67ef000000002b03 ,
  e = 0x67ef000000002b04 ,
  ne = 0x67ef000000002b05 ,
  be = 0x67ef000000002b06 ,
  a = 0x67ef000000002b07 ,
  s = 0x67ef000000002b08 ,
  ns = 0x67ef000000002b09 ,
  p = 0x67ef000000002b0a ,
  np = 0x67ef000000002b0b ,
  l = 0x67ef000000002b0c ,
  ge = 0x67ef000000002b0d ,
  le = 0x67ef000000002b0e ,
  g = 0x67ef000000002b0f
}
template<cmovcc id>
const Def * normalize_cmovcc (const Def *type, const Def *, const Def *arg)

Detailed Description


Class Documentation

◆ mim::plug::x86::Src

struct mim::plug::x86::Src

The source of a copy: a register or a literal; reg.cls is the class of either.

Definition at line 32 of file emit.h.

Class Members
const Def * imm = nullptr
Reg reg = {}

Enumeration Type Documentation

◆ add

enum class mim::plug::x86::add : flags_t
strong

Definition at line 202 of file autogen.h.

◆ add3

enum class mim::plug::x86::add3 : flags_t
strong

Definition at line 244 of file autogen.h.

◆ Addr

enum class mim::plug::x86::Addr : flags_t
strong

Definition at line 14 of file autogen.h.

◆ addr

enum class mim::plug::x86::addr : flags_t
strong

Definition at line 35 of file autogen.h.

◆ and_

enum class mim::plug::x86::and_ : flags_t
strong

Definition at line 216 of file autogen.h.

◆ Base

enum class mim::plug::x86::Base : flags_t
strong

Definition at line 21 of file autogen.h.

◆ cc

enum class mim::plug::x86::cc : flags_t
strong
Enumerator
o 
no 
b 
ae 
e 
ne 
be 
a 
s 
ns 
p 
np 
l 
ge 
le 
g 

Definition at line 345 of file autogen.h.

◆ cmovcc

enum class mim::plug::x86::cmovcc : flags_t
strong
Enumerator
o 
no 
b 
ae 
e 
ne 
be 
a 
s 
ns 
p 
np 
l 
ge 
le 
g 

Definition at line 368 of file autogen.h.

◆ cmp

enum class mim::plug::x86::cmp : flags_t
strong

Definition at line 331 of file autogen.h.

◆ div

enum class mim::plug::x86::div : flags_t
strong

Definition at line 265 of file autogen.h.

◆ emit

enum class mim::plug::x86::emit : flags_t
strong

Definition at line 529 of file autogen.h.

◆ f2f

enum class mim::plug::x86::f2f : flags_t
strong

Definition at line 515 of file autogen.h.

◆ f2i

enum class mim::plug::x86::f2i : flags_t
strong

Definition at line 501 of file autogen.h.

◆ f2u

enum class mim::plug::x86::f2u : flags_t
strong

Definition at line 508 of file autogen.h.

◆ fabs

enum class mim::plug::x86::fabs : flags_t
strong

Definition at line 450 of file autogen.h.

◆ fadd

enum class mim::plug::x86::fadd : flags_t
strong

Definition at line 415 of file autogen.h.

◆ fcmp

enum class mim::plug::x86::fcmp : flags_t
strong
Enumerator
f 
e 
l 
le 
g 
ge 
ne 
o 
u 
ue 
ul 
ule 
ug 
uge 
une 
t 

Definition at line 457 of file autogen.h.

◆ fdiv

enum class mim::plug::x86::fdiv : flags_t
strong

Definition at line 436 of file autogen.h.

◆ fload

enum class mim::plug::x86::fload : flags_t
strong

Definition at line 401 of file autogen.h.

◆ fmov

enum class mim::plug::x86::fmov : flags_t
strong

Definition at line 394 of file autogen.h.

◆ fmul

enum class mim::plug::x86::fmul : flags_t
strong

Definition at line 429 of file autogen.h.

◆ fsel

enum class mim::plug::x86::fsel : flags_t
strong

Definition at line 480 of file autogen.h.

◆ fsqrt

enum class mim::plug::x86::fsqrt : flags_t
strong

Definition at line 443 of file autogen.h.

◆ fstore

enum class mim::plug::x86::fstore : flags_t
strong

Definition at line 408 of file autogen.h.

◆ fsub

enum class mim::plug::x86::fsub : flags_t
strong

Definition at line 422 of file autogen.h.

◆ gpr

enum class mim::plug::x86::gpr : flags_t
strong

Definition at line 85 of file autogen.h.

◆ gpr16

enum class mim::plug::x86::gpr16 : flags_t
strong

Definition at line 92 of file autogen.h.

◆ i2f

enum class mim::plug::x86::i2f : flags_t
strong

Definition at line 487 of file autogen.h.

◆ idiv

enum class mim::plug::x86::idiv : flags_t
strong

Definition at line 272 of file autogen.h.

◆ imul

enum class mim::plug::x86::imul : flags_t
strong

Definition at line 237 of file autogen.h.

◆ imul3

enum class mim::plug::x86::imul3 : flags_t
strong

Definition at line 258 of file autogen.h.

◆ Index

enum class mim::plug::x86::Index : flags_t
strong

Definition at line 28 of file autogen.h.

◆ index

enum class mim::plug::x86::index : flags_t
strong

Definition at line 43 of file autogen.h.

◆ is_gpr

enum class mim::plug::x86::is_gpr : flags_t
strong

Definition at line 78 of file autogen.h.

◆ isel

enum class mim::plug::x86::isel : flags_t
strong

Definition at line 522 of file autogen.h.

◆ lea

enum class mim::plug::x86::lea : flags_t
strong

Definition at line 173 of file autogen.h.

◆ load

enum class mim::plug::x86::load : flags_t
strong

Definition at line 188 of file autogen.h.

◆ logic

enum class mim::plug::x86::logic : flags_t
strong

Definition at line 99 of file autogen.h.

◆ mov

enum class mim::plug::x86::mov : flags_t
strong

Definition at line 181 of file autogen.h.

◆ movsx

enum class mim::plug::x86::movsx : flags_t
strong

Definition at line 308 of file autogen.h.

◆ movzx

enum class mim::plug::x86::movzx : flags_t
strong

Definition at line 300 of file autogen.h.

◆ mr

enum class mim::plug::x86::mr : flags_t
strong

Definition at line 120 of file autogen.h.

◆ or_

enum class mim::plug::x86::or_ : flags_t
strong

Definition at line 223 of file autogen.h.

◆ reg

enum class mim::plug::x86::reg : flags_t
strong
Enumerator
rax 
rcx 
rdx 
rbx 
rsp 
rbp 
rsi 
rdi 
r8 
r9 
r10 
r11 
r12 
r13 
r14 
r15 

Definition at line 127 of file autogen.h.

◆ rm

enum class mim::plug::x86::rm : flags_t
strong

Definition at line 106 of file autogen.h.

◆ rm1

enum class mim::plug::x86::rm1 : flags_t
strong

Definition at line 113 of file autogen.h.

◆ rsub

enum class mim::plug::x86::rsub : flags_t
strong

Definition at line 251 of file autogen.h.

◆ sar

enum class mim::plug::x86::sar : flags_t
strong

Definition at line 293 of file autogen.h.

◆ scale_1

enum class mim::plug::x86::scale_1 : flags_t
strong

Definition at line 50 of file autogen.h.

◆ scale_2

enum class mim::plug::x86::scale_2 : flags_t
strong

Definition at line 57 of file autogen.h.

◆ scale_4

enum class mim::plug::x86::scale_4 : flags_t
strong

Definition at line 64 of file autogen.h.

◆ scale_8

enum class mim::plug::x86::scale_8 : flags_t
strong

Definition at line 71 of file autogen.h.

◆ shl

enum class mim::plug::x86::shl : flags_t
strong

Definition at line 279 of file autogen.h.

◆ shr

enum class mim::plug::x86::shr : flags_t
strong

Definition at line 286 of file autogen.h.

◆ store

enum class mim::plug::x86::store : flags_t
strong

Definition at line 195 of file autogen.h.

◆ sub

enum class mim::plug::x86::sub : flags_t
strong

Definition at line 209 of file autogen.h.

◆ test

enum class mim::plug::x86::test : flags_t
strong

Definition at line 338 of file autogen.h.

◆ trunc

enum class mim::plug::x86::trunc : flags_t
strong

Definition at line 316 of file autogen.h.

◆ u2f

enum class mim::plug::x86::u2f : flags_t
strong

Definition at line 494 of file autogen.h.

◆ xmm

enum class mim::plug::x86::xmm : flags_t
strong
Enumerator
xmm0 
xmm1 
xmm2 
xmm3 
xmm4 
xmm5 
xmm6 
xmm7 
xmm8 
xmm9 
xmm10 
xmm11 
xmm12 
xmm13 
xmm14 
xmm15 

Definition at line 150 of file autogen.h.

◆ xor_

enum class mim::plug::x86::xor_ : flags_t
strong

Definition at line 230 of file autogen.h.

◆ zero

enum class mim::plug::x86::zero : flags_t
strong

Definition at line 324 of file autogen.h.

Function Documentation

◆ encoding()

template<class Reg>
size_t mim::plug::mach::encoding ( Reg r)
constexpr

The hardware encoding of the register r of a backend's module reg, whose subtags are in encoding order.

Definition at line 15 of file mach.h.

Referenced by mim::plug::x86::Target::constraint(), reserved(), and mim::plug::x86::Target::ret_reg().

◆ fits_i32()

bool mim::plug::x86::fits_i32 ( s64 x)
inline

Definition at line 16 of file imm.h.

References fits_i32().

Referenced by fits_i32(), fits_imm(), and normalize_addr().

◆ fits_imm() [1/2]

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

Does the literal lit fit a sign-extended 32-bit immediate?

Definition at line 24 of file imm.h.

References fits_imm(), mim::Lit::isa(), and mim::Idx::isa_lit().

◆ fits_imm() [2/2]

bool mim::plug::x86::fits_imm ( std::optional< nat_t > size,
nat_t val )
inline

Does the literal val fit a sign-extended 32-bit immediate, if it is an Idx size?

Definition at line 19 of file imm.h.

References fits_i32(), fits_imm(), and reg_width().

Referenced by fits_imm(), fits_imm(), mim::plug::x86::Target::fits_imm(), and mim::plug::x86_isel::normalize_imm().

◆ normalize_addr()

const Def * mim::plug::x86::normalize_addr ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 14 of file normalizers.cpp.

References b, fits_i32(), mim::Lit::isa(), normalize_addr(), and mim::Def::projs().

Referenced by normalize_addr().

◆ normalize_cmovcc()

template<cmovcc id>
const Def * mim::plug::x86::normalize_cmovcc ( const Def * type,
const Def * ,
const Def * arg )

Definition at line 36 of file normalizers.cpp.

References b, mim::Annex::Base, mim::Axm::isa(), ne, normalize_cmovcc(), and mim::Def::projs().

Referenced by normalize_cmovcc().

◆ normalize_lea()

const Def * mim::plug::x86::normalize_lea ( const Def * type,
const Def * ,
const Def * a )

Definition at line 24 of file normalizers.cpp.

References b, mim::Axm::isa(), mim::Lit::isa(), and normalize_lea().

Referenced by normalize_lea().

◆ normalize_movsx()

const Def * mim::plug::x86::normalize_movsx ( const Def * type,
const Def * ,
const Def * x )

Definition at line 11 of file normalizers.cpp.

References mim::plug::mach::fold_ext(), and normalize_movsx().

Referenced by normalize_movsx().

◆ normalize_movzx()

const Def * mim::plug::x86::normalize_movzx ( const Def * type,
const Def * ,
const Def * x )

Definition at line 10 of file normalizers.cpp.

References mim::plug::mach::fold_ext(), and normalize_movzx().

Referenced by normalize_movzx().

◆ normalize_trunc()

const Def * mim::plug::x86::normalize_trunc ( const Def * type,
const Def * ,
const Def * x )

Definition at line 12 of file normalizers.cpp.

References mim::plug::mach::fold_ext(), and normalize_trunc().

Referenced by normalize_trunc().

◆ reg_width()

nat_t mim::plug::x86::reg_width ( nat_t size)
inline

Width of the register holding an Idx size.

Definition at line 14 of file imm.h.

References reg_width(), and mim::Idx::size2bitwidth().

Referenced by mim::plug::x86::insn::cost(), fits_imm(), mim::plug::x86::insn::latency(), and reg_width().

◆ register_normalizers()

void mim::plug::x86::register_normalizers ( Normalizers & normalizers)

◆ reserved()

bool mim::plug::x86::reserved ( size_t r)
constexpr

Definition at line 26 of file x86.h.

References encoding(), rbp, reserved(), and rsp.

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

Variable Documentation

◆ Arg_Regs

std::array<size_t, 6> mim::plug::x86::Arg_Regs
constexpr
Initial value:
= {
}
constexpr size_t encoding(Reg r)
The hardware encoding of the register r of a backend's module reg, whose subtags are in encoding orde...
Definition mach.h:15

System V AMD64 ABI.

Definition at line 20 of file x86.h.

Referenced by mim::plug::x86::Target::arg_reg(), and mim::plug::x86::Target::num_arg_regs().

◆ Caller_Saved

std::array<bool, Num_Regs> mim::plug::x86::Caller_Saved = {1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}
constexpr

Definition at line 25 of file x86.h.

Referenced by mim::plug::x86::Target::caller_saved().

◆ Num_Regs

size_t mim::plug::x86::Num_Regs = Annex::num<reg>()
constexpr

Definition at line 15 of file x86.h.

Referenced by mim::plug::x86::Target::num_regs().

◆ Num_Xmm

size_t mim::plug::x86::Num_Xmm = Annex::num<xmm>()
constexpr

Definition at line 16 of file x86.h.

Referenced by mim::plug::x86::Target::num_regs().

◆ Plugin_Id

plugin_t mim::plug::x86::Plugin_Id = 0x67ef000000000000
staticconstexpr

Definition at line 10 of file autogen.h.