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

#include <xbyak.h>

Public Types

enum  { i32e = 32 }
 

Public Member Functions

 RegExp (size_t disp=0)
 
 RegExp (const Reg &r, int scale=1)
 
bool isVsib (int bit=128|256|512) const
 
RegExp optimize () const
 
bool operator== (const RegExp &rhs) const
 
const ReggetBase () const
 
const ReggetIndex () const
 
int getScale () const
 
size_t getDisp () const
 
void verify () const
 
uint8 getRex () const
 

Friends

RegExp operator+ (const RegExp &a, const RegExp &b)
 
RegExp operator- (const RegExp &e, size_t disp)
 

Detailed Description

Definition at line 690 of file xbyak.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
i32e 

Definition at line 695 of file xbyak.h.

695{ i32e = 32 };

Constructor & Destructor Documentation

◆ RegExp() [1/2]

Xbyak::RegExp::RegExp ( size_t disp = 0)
inline

Definition at line 697 of file xbyak.h.

697: scale_(0), disp_(disp) { }

◆ RegExp() [2/2]

Xbyak::RegExp::RegExp ( const Reg & r,
int scale = 1 )
inline

Definition at line 698 of file xbyak.h.

699 : scale_(scale)
700 , disp_(0)
701 {
702 if (!r.isREG(i32e) && !r.is(Reg::XMM|Reg::YMM|Reg::ZMM)) throw Error(ERR_BAD_SIZE_OF_REGISTER);
703 if (scale == 0) return;
704 if (scale != 1 && scale != 2 && scale != 4 && scale != 8) throw Error(ERR_BAD_SCALE);
705 if (r.getBit() >= 128 || scale != 1) { // xmm/ymm is always index
706 index_ = r;
707 } else {
708 base_ = r;
709 }
710 }
const mie::Vuint & r
Definition bn.cpp:28
Error
Definition calc.cpp:23
@ ERR_BAD_SIZE_OF_REGISTER
Definition xbyak.h:143
@ ERR_BAD_SCALE
Definition xbyak.h:140

Member Function Documentation

◆ getBase()

const Reg & Xbyak::RegExp::getBase ( ) const
inline

Definition at line 726 of file xbyak.h.

726{ return base_; }
Here is the caller graph for this function:

◆ getDisp()

size_t Xbyak::RegExp::getDisp ( ) const
inline

Definition at line 729 of file xbyak.h.

729{ return disp_; }
Here is the caller graph for this function:

◆ getIndex()

const Reg & Xbyak::RegExp::getIndex ( ) const
inline

Definition at line 727 of file xbyak.h.

727{ return index_; }
Here is the caller graph for this function:

◆ getRex()

uint8 Xbyak::RegExp::getRex ( ) const
inline

Definition at line 740 of file xbyak.h.

741 {
742 uint8 rex = index_.getRexX() | base_.getRexB();
743 return rex ? uint8(rex | 0x40) : 0;
744 }
uint8 getRexX() const
Definition xbyak.h:524
uint8 getRexB() const
Definition xbyak.h:525
unsigned char uint8

◆ getScale()

int Xbyak::RegExp::getScale ( ) const
inline

Definition at line 728 of file xbyak.h.

728{ return scale_; }

◆ isVsib()

bool Xbyak::RegExp::isVsib ( int bit = 128 | 256 | 512) const
inline

Definition at line 711 of file xbyak.h.

711{ return index_.isBit(bit); }
bool isBit(uint32 bit) const
Definition xbyak.h:452
int bit
Definition yubihsm.h:566
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==()

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

Definition at line 722 of file xbyak.h.

723 {
724 return base_ == rhs.base_ && index_ == rhs.index_ && disp_ == rhs.disp_ && scale_ == rhs.scale_;
725 }

◆ optimize()

RegExp Xbyak::RegExp::optimize ( ) const
inline

Definition at line 712 of file xbyak.h.

713 {
714 RegExp exp = *this;
715 // [reg * 2] => [reg + reg]
716 if (index_.isBit(i32e) && !base_.getBit() && scale_ == 2) {
717 exp.base_ = index_;
718 exp.scale_ = 1;
719 }
720 return exp;
721 }
uint32 getBit() const
Definition xbyak.h:453
RegExp(size_t disp=0)
Definition xbyak.h:697

◆ verify()

void Xbyak::RegExp::verify ( ) const
inline

Definition at line 730 of file xbyak.h.

731 {
732 if (base_.getBit() >= 128) throw Error(ERR_BAD_SIZE_OF_REGISTER);
733 if (index_.getBit() && index_.getBit() <= 64) {
734 if (index_.getIdx() == Operand::ESP) throw Error(ERR_ESP_CANT_BE_INDEX);
735 if (base_.getBit() && base_.getBit() != index_.getBit()) throw Error(ERR_BAD_SIZE_OF_REGISTER);
736 }
737 }
int getIdx() const
Definition xbyak.h:398
@ ERR_ESP_CANT_BE_INDEX
Definition xbyak.h:141

Friends And Related Symbol Documentation

◆ operator+

RegExp operator+ ( const RegExp & a,
const RegExp & b )
friend

Definition at line 756 of file xbyak.h.

757{
758 if (a.index_.getBit() && b.index_.getBit()) throw Error(ERR_BAD_ADDRESSING);
759 RegExp ret = a;
760 if (!ret.index_.getBit()) { ret.index_ = b.index_; ret.scale_ = b.scale_; }
761 if (b.base_.getBit()) {
762 if (ret.base_.getBit()) {
763 if (ret.index_.getBit()) throw Error(ERR_BAD_ADDRESSING);
764 // base + base => base + index * 1
765 ret.index_ = b.base_;
766 // [reg + esp] => [esp + reg]
767 if (ret.index_.getIdx() == Operand::ESP) std::swap(ret.base_, ret.index_);
768 ret.scale_ = 1;
769 } else {
770 ret.base_ = b.base_;
771 }
772 }
773 ret.disp_ += b.disp_;
774 return ret;
775}
@ ERR_BAD_ADDRESSING
Definition xbyak.h:138
void swap(picojson::value &x, picojson::value &y)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
CK_RV ret

◆ operator-

RegExp operator- ( const RegExp & e,
size_t disp )
friend

Definition at line 780 of file xbyak.h.

781{
782 RegExp ret = e;
783 ret.disp_ -= disp;
784 return ret;
785}

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