Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Xbyak::Operand Class Reference

#include <xbyak.h>

Inheritance diagram for Xbyak::Operand:

Public Types

enum  Kind {
  NONE = 0 , MEM = 1 << 0 , REG = 1 << 1 , MMX = 1 << 2 ,
  FPU = 1 << 3 , XMM = 1 << 4 , YMM = 1 << 5 , ZMM = 1 << 6 ,
  OPMASK = 1 << 7 , BNDREG = 1 << 8
}
 
enum  Code {
  EAX = 0 , ECX , EDX , EBX ,
  ESP , EBP , ESI , EDI ,
  AX = 0 , CX , DX , BX ,
  SP , BP , SI , DI ,
  AL = 0 , CL , DL , BL ,
  AH , CH , DH , BH
}
 

Public Member Functions

 Operand ()
 
 Operand (int idx, Kind kind, int bit, bool ext8bit=0)
 
Kind getKind () const
 
int getIdx () const
 
bool isNone () const
 
bool isMMX () const
 
bool isXMM () const
 
bool isYMM () const
 
bool isZMM () const
 
bool isXMEM () const
 
bool isYMEM () const
 
bool isZMEM () const
 
bool isOPMASK () const
 
bool isBNDREG () const
 
bool isREG (int bit=0) const
 
bool isMEM (int bit=0) const
 
bool isFPU () const
 
bool isExt8bit () const
 
bool isExtIdx () const
 
bool isExtIdx2 () const
 
bool hasEvex () const
 
bool hasRex () const
 
bool hasZero () const
 
int getOpmaskIdx () const
 
int getRounding () const
 
void setKind (Kind kind)
 
void setBit (int bit)
 
void setOpmaskIdx (int idx, bool ignore_idx0=false)
 
void setRounding (int idx)
 
void setZero ()
 
bool isHigh8bit () const
 
bool is (int kind, uint32 bit=0) const
 
bool isBit (uint32 bit) const
 
uint32 getBit () const
 
const char * toString () const
 
bool isEqualIfNotInherited (const Operand &rhs) const
 
bool operator== (const Operand &rhs) const
 
bool operator!= (const Operand &rhs) const
 
const AddressgetAddress () const
 
const ReggetReg () const
 

Protected Member Functions

void setIdx (int idx)
 

Protected Attributes

unsigned int zero_:1
 
unsigned int mask_:3
 
unsigned int rounding_:3
 

Detailed Description

Definition at line 353 of file xbyak.h.

Member Enumeration Documentation

◆ Code

Enumerator
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
AX 
CX 
DX 
BX 
SP 
BP 
SI 
DI 
AL 
CL 
DL 
BL 
AH 
CH 
DH 
BH 

Definition at line 376 of file xbyak.h.

376 {
377#ifdef XBYAK64
378 RAX = 0, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15,
379 R8D = 8, R9D, R10D, R11D, R12D, R13D, R14D, R15D,
380 R8W = 8, R9W, R10W, R11W, R12W, R13W, R14W, R15W,
381 R8B = 8, R9B, R10B, R11B, R12B, R13B, R14B, R15B,
382 SPL = 4, BPL, SIL, DIL,
383#endif
384 EAX = 0, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
385 AX = 0, CX, DX, BX, SP, BP, SI, DI,
386 AL = 0, CL, DL, BL, AH, CH, DH, BH
387 };
const uint64 RAX
Definition make_nm.cpp:62

◆ Kind

Enumerator
NONE 
MEM 
REG 
MMX 
FPU 
XMM 
YMM 
ZMM 
OPMASK 
BNDREG 

Definition at line 364 of file xbyak.h.

364 {
365 NONE = 0,
366 MEM = 1 << 0,
367 REG = 1 << 1,
368 MMX = 1 << 2,
369 FPU = 1 << 3,
370 XMM = 1 << 4,
371 YMM = 1 << 5,
372 ZMM = 1 << 6,
373 OPMASK = 1 << 7,
374 BNDREG = 1 << 8
375 };

Constructor & Destructor Documentation

◆ Operand() [1/2]

Xbyak::Operand::Operand ( )
inline

Definition at line 388 of file xbyak.h.

388: idx_(0), kind_(0), bit_(0), zero_(0), mask_(0), rounding_(0) { }
unsigned int mask_
Definition xbyak.h:360
unsigned int rounding_
Definition xbyak.h:361
unsigned int zero_
Definition xbyak.h:359

◆ Operand() [2/2]

Xbyak::Operand::Operand ( int idx,
Kind kind,
int bit,
bool ext8bit = 0 )
inline

Definition at line 389 of file xbyak.h.

390 : idx_(static_cast<uint8>(idx | (ext8bit ? EXT8BIT : 0)))
391 , kind_(kind)
392 , bit_(bit)
393 , zero_(0), mask_(0), rounding_(0)
394 {
395 assert((bit_ & (bit_ - 1)) == 0); // bit must be power of two
396 }
unsigned char uint8
int bit
Definition yubihsm.h:566

Member Function Documentation

◆ getAddress()

const Address & Xbyak::Operand::getAddress ( ) const
inline

Definition at line 1044 of file xbyak.h.

1045{
1046 assert(isMEM());
1047 return static_cast<const Address&>(*this);
1048}
bool isMEM(int bit=0) const
Definition xbyak.h:410
Here is the caller graph for this function:

◆ getBit()

uint32 Xbyak::Operand::getBit ( ) const
inline

Definition at line 453 of file xbyak.h.

453{ return bit_; }
Here is the caller graph for this function:

◆ getIdx()

int Xbyak::Operand::getIdx ( ) const
inline

Definition at line 398 of file xbyak.h.

398{ return idx_ & (EXT8BIT - 1); }
Here is the caller graph for this function:

◆ getKind()

Kind Xbyak::Operand::getKind ( ) const
inline

Definition at line 397 of file xbyak.h.

397{ return static_cast<Kind>(kind_); }
Here is the caller graph for this function:

◆ getOpmaskIdx()

int Xbyak::Operand::getOpmaskIdx ( ) const
inline

Definition at line 418 of file xbyak.h.

418{ return mask_; }
Here is the caller graph for this function:

◆ getReg()

const Reg & Xbyak::Operand::getReg ( ) const
inline

Definition at line 540 of file xbyak.h.

541{
542 assert(!isMEM());
543 return static_cast<const Reg&>(*this);
544}
Definition lib.h:4
Here is the caller graph for this function:

◆ getRounding()

int Xbyak::Operand::getRounding ( ) const
inline

Definition at line 419 of file xbyak.h.

419{ return rounding_; }
Here is the caller graph for this function:

◆ hasEvex()

bool Xbyak::Operand::hasEvex ( ) const
inline

Definition at line 415 of file xbyak.h.

415{ return isZMM() || isExtIdx2() || getOpmaskIdx() || getRounding(); }
bool isExtIdx2() const
Definition xbyak.h:414
int getRounding() const
Definition xbyak.h:419
bool isZMM() const
Definition xbyak.h:403
int getOpmaskIdx() const
Definition xbyak.h:418
Here is the call graph for this function:

◆ hasRex()

bool Xbyak::Operand::hasRex ( ) const
inline

Definition at line 416 of file xbyak.h.

416{ return isExt8bit() || isREG(64) || isExtIdx(); }
bool isExt8bit() const
Definition xbyak.h:412
bool isREG(int bit=0) const
Definition xbyak.h:409
bool isExtIdx() const
Definition xbyak.h:413
Here is the call graph for this function:

◆ hasZero()

bool Xbyak::Operand::hasZero ( ) const
inline

Definition at line 417 of file xbyak.h.

417{ return zero_; }

◆ is()

bool Xbyak::Operand::is ( int kind,
uint32 bit = 0 ) const
inline

Definition at line 448 of file xbyak.h.

449 {
450 return (kind == 0 || (kind_ & kind)) && (bit == 0 || (bit_ & bit)); // cf. you can set (8|16)
451 }
Here is the caller graph for this function:

◆ isBit()

bool Xbyak::Operand::isBit ( uint32 bit) const
inline

Definition at line 452 of file xbyak.h.

452{ return (bit_ & bit) != 0; }
Here is the caller graph for this function:

◆ isBNDREG()

bool Xbyak::Operand::isBNDREG ( ) const
inline

Definition at line 408 of file xbyak.h.

408{ return is(BNDREG); }
bool is(int kind, uint32 bit=0) const
Definition xbyak.h:448
Here is the call graph for this function:

◆ isEqualIfNotInherited()

bool Xbyak::Operand::isEqualIfNotInherited ( const Operand & rhs) const
inline

Definition at line 502 of file xbyak.h.

502{ return idx_ == rhs.idx_ && kind_ == rhs.kind_ && bit_ == rhs.bit_ && zero_ == rhs.zero_ && mask_ == rhs.mask_ && rounding_ == rhs.rounding_; }

◆ isExt8bit()

bool Xbyak::Operand::isExt8bit ( ) const
inline

Definition at line 412 of file xbyak.h.

412{ return (idx_ & EXT8BIT) != 0; }
Here is the caller graph for this function:

◆ isExtIdx()

bool Xbyak::Operand::isExtIdx ( ) const
inline

Definition at line 413 of file xbyak.h.

413{ return (getIdx() & 8) != 0; }
int getIdx() const
Definition xbyak.h:398
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isExtIdx2()

bool Xbyak::Operand::isExtIdx2 ( ) const
inline

Definition at line 414 of file xbyak.h.

414{ return (getIdx() & 16) != 0; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFPU()

bool Xbyak::Operand::isFPU ( ) const
inline

Definition at line 411 of file xbyak.h.

411{ return is(FPU); }
Here is the call graph for this function:

◆ isHigh8bit()

bool Xbyak::Operand::isHigh8bit ( ) const
inline

Definition at line 440 of file xbyak.h.

441 {
442 if (!isBit(8)) return false;
443 if (isExt8bit()) return false;
444 const int idx = getIdx();
445 return AH <= idx && idx <= BH;
446 }
bool isBit(uint32 bit) const
Definition xbyak.h:452

◆ isMEM()

bool Xbyak::Operand::isMEM ( int bit = 0) const
inline

Definition at line 410 of file xbyak.h.

410{ return is(MEM, bit); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMMX()

bool Xbyak::Operand::isMMX ( ) const
inline

Definition at line 400 of file xbyak.h.

400{ return is(MMX); }
Here is the call graph for this function:

◆ isNone()

bool Xbyak::Operand::isNone ( ) const
inline

Definition at line 399 of file xbyak.h.

399{ return kind_ == 0; }

◆ isOPMASK()

bool Xbyak::Operand::isOPMASK ( ) const
inline

Definition at line 407 of file xbyak.h.

407{ return is(OPMASK); }
Here is the call graph for this function:

◆ isREG()

bool Xbyak::Operand::isREG ( int bit = 0) const
inline

Definition at line 409 of file xbyak.h.

409{ return is(REG, bit); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isXMEM()

bool Xbyak::Operand::isXMEM ( ) const
inline

Definition at line 404 of file xbyak.h.

404{ return is(XMM | MEM); }
Here is the call graph for this function:

◆ isXMM()

bool Xbyak::Operand::isXMM ( ) const
inline

Definition at line 401 of file xbyak.h.

401{ return is(XMM); }
Here is the call graph for this function:

◆ isYMEM()

bool Xbyak::Operand::isYMEM ( ) const
inline

Definition at line 405 of file xbyak.h.

405{ return is(YMM | MEM); }
Here is the call graph for this function:

◆ isYMM()

bool Xbyak::Operand::isYMM ( ) const
inline

Definition at line 402 of file xbyak.h.

402{ return is(YMM); }
Here is the call graph for this function:

◆ isZMEM()

bool Xbyak::Operand::isZMEM ( ) const
inline

Definition at line 406 of file xbyak.h.

406{ return is(ZMM | MEM); }
Here is the call graph for this function:

◆ isZMM()

bool Xbyak::Operand::isZMM ( ) const
inline

Definition at line 403 of file xbyak.h.

403{ return is(ZMM); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool Xbyak::Operand::operator!= ( const Operand & rhs) const
inline

Definition at line 504 of file xbyak.h.

504{ return !operator==(rhs); }
bool operator==(const Operand &rhs) const
Definition xbyak.h:1050

◆ operator==()

bool Xbyak::Operand::operator== ( const Operand & rhs) const
inline

Definition at line 1050 of file xbyak.h.

1051{
1052 if (isMEM() && rhs.isMEM()) return this->getAddress() == rhs.getAddress();
1053 return isEqualIfNotInherited(rhs);
1054}
const Address & getAddress() const
Definition xbyak.h:1044
bool isEqualIfNotInherited(const Operand &rhs) const
Definition xbyak.h:502
Here is the caller graph for this function:

◆ setBit()

void Xbyak::Operand::setBit ( int bit)
inline

Definition at line 426 of file xbyak.h.

426{ bit_ = bit; }

◆ setIdx()

void Xbyak::Operand::setIdx ( int idx)
inlineprotected

Definition at line 362 of file xbyak.h.

362{ idx_ = idx; }

◆ setKind()

void Xbyak::Operand::setKind ( Kind kind)
inline

Definition at line 420 of file xbyak.h.

421 {
422 if ((kind & (XMM|YMM|ZMM)) == 0) return;
423 kind_ = kind;
424 bit_ = kind == XMM ? 128 : kind == YMM ? 256 : 512;
425 }

◆ setOpmaskIdx()

void Xbyak::Operand::setOpmaskIdx ( int idx,
bool ignore_idx0 = false )
inline

Definition at line 427 of file xbyak.h.

428 {
429 if (!ignore_idx0 && idx == 0) throw Error(ERR_K0_IS_INVALID);
431 mask_ = idx;
432 }
Error
Definition calc.cpp:23
@ ERR_OPMASK_IS_ALREADY_SET
Definition xbyak.h:170
@ ERR_K0_IS_INVALID
Definition xbyak.h:172

◆ setRounding()

void Xbyak::Operand::setRounding ( int idx)
inline

Definition at line 433 of file xbyak.h.

434 {
436 rounding_ = idx;
437 }
@ ERR_ROUNDING_IS_ALREADY_SET
Definition xbyak.h:171

◆ setZero()

void Xbyak::Operand::setZero ( )
inline

Definition at line 438 of file xbyak.h.

438{ zero_ = true; }

◆ toString()

const char * Xbyak::Operand::toString ( ) const
inline

Definition at line 454 of file xbyak.h.

455 {
456 const int idx = getIdx();
457 if (kind_ == REG) {
458 if (isExt8bit()) {
459 static const char *tbl[4] = { "spl", "bpl", "sil", "dil" };
460 return tbl[idx - 4];
461 }
462 static const char *tbl[4][16] = {
463 { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b" },
464 { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" },
465 { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d" },
466 { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" },
467 };
468 return tbl[bit_ == 8 ? 0 : bit_ == 16 ? 1 : bit_ == 32 ? 2 : 3][idx];
469 } else if (isOPMASK()) {
470 static const char *tbl[8] = { "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" };
471 return tbl[idx];
472 } else if (isZMM()) {
473 static const char *tbl[32] = {
474 "zmm0", "zmm1", "zmm2", "zmm3", "zmm4", "zmm5", "zmm6", "zmm7", "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
475 "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23", "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31"
476 };
477 return tbl[idx];
478 } else if (isYMM()) {
479 static const char *tbl[32] = {
480 "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7", "ymm8", "ymm9", "ymm10", "ymm11", "ymm12", "ymm13", "ymm14", "ymm15",
481 "ymm16", "ymm17", "ymm18", "ymm19", "ymm20", "ymm21", "ymm22", "ymm23", "ymm24", "ymm25", "ymm26", "ymm27", "ymm28", "ymm29", "ymm30", "ymm31"
482 };
483 return tbl[idx];
484 } else if (isXMM()) {
485 static const char *tbl[32] = {
486 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15",
487 "xmm16", "xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23", "xmm24", "xmm25", "xmm26", "xmm27", "xmm28", "xmm29", "xmm30", "xmm31"
488 };
489 return tbl[idx];
490 } else if (isMMX()) {
491 static const char *tbl[8] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" };
492 return tbl[idx];
493 } else if (isFPU()) {
494 static const char *tbl[8] = { "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7" };
495 return tbl[idx];
496 } else if (isBNDREG()) {
497 static const char *tbl[4] = { "bnd0", "bnd1", "bnd2", "bnd3" };
498 return tbl[idx];
499 }
500 throw Error(ERR_INTERNAL);
501 }
bool isOPMASK() const
Definition xbyak.h:407
bool isFPU() const
Definition xbyak.h:411
bool isMMX() const
Definition xbyak.h:400
bool isYMM() const
Definition xbyak.h:402
bool isXMM() const
Definition xbyak.h:401
bool isBNDREG() const
Definition xbyak.h:408
const struct Ptn tbl[]
@ ERR_INTERNAL
Definition xbyak.h:181

Member Data Documentation

◆ mask_

unsigned int Xbyak::Operand::mask_
protected

Definition at line 360 of file xbyak.h.

◆ rounding_

unsigned int Xbyak::Operand::rounding_
protected

Definition at line 361 of file xbyak.h.

◆ zero_

unsigned int Xbyak::Operand::zero_
protected

Definition at line 359 of file xbyak.h.


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