rename numQword as stackSizeByte
This commit is contained in:
parent
a233ab985e
commit
57910b2920
2 changed files with 17 additions and 10 deletions
|
@ -81,7 +81,7 @@ struct Code : public Xbyak::CodeGenerator {
|
||||||
|
|
||||||
void gen9()
|
void gen9()
|
||||||
{
|
{
|
||||||
StackFrame sf(this, 4, 3 | UseRCX | UseRDX, 4);
|
StackFrame sf(this, 4, 3 | UseRCX | UseRDX, 32);
|
||||||
xor_(rcx, rcx);
|
xor_(rcx, rcx);
|
||||||
xor_(rdx, rdx);
|
xor_(rdx, rdx);
|
||||||
mov(sf.t(0), 1);
|
mov(sf.t(0), 1);
|
||||||
|
@ -98,7 +98,7 @@ struct Code : public Xbyak::CodeGenerator {
|
||||||
|
|
||||||
void gen10()
|
void gen10()
|
||||||
{
|
{
|
||||||
StackFrame sf(this, 4, 8 | UseRCX | UseRDX, 4);
|
StackFrame sf(this, 4, 8 | UseRCX | UseRDX, 32);
|
||||||
xor_(rcx, rcx);
|
xor_(rcx, rcx);
|
||||||
xor_(rdx, rdx);
|
xor_(rdx, rdx);
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
|
|
|
@ -267,17 +267,20 @@ public:
|
||||||
/*
|
/*
|
||||||
make stack frame
|
make stack frame
|
||||||
@param sf [in] this
|
@param sf [in] this
|
||||||
@param pNum [in] num of global parameter
|
@param pNum [in] num of function parameter(0 <= pNum <= 4)
|
||||||
@param tNum [in] num of temporary register
|
@param tNum [in] num of temporary register(0 <= tNum <= 10, with UseRCX, UseRDX)
|
||||||
@param numQword [in] local stack size
|
@param stackSizeByte [in] local stack size
|
||||||
@param useReg [in] reserve rcx, rdx if necessary
|
@param makeEpilog [in] automatically call close() if true
|
||||||
|
|
||||||
you can use
|
you can use
|
||||||
rax
|
rax
|
||||||
gp0, ..., gp(pNum - 1)
|
gp0, ..., gp(pNum - 1)
|
||||||
gt0, ..., gt(tNum-1)
|
gt0, ..., gt(tNum-1)
|
||||||
rsp[0..8 * numQrod - 1]
|
rcx if tNum & UseRCX
|
||||||
|
rdx if tNum & UseRDX
|
||||||
|
rsp[0..stackSizeByte - 1]
|
||||||
*/
|
*/
|
||||||
StackFrame(Xbyak::CodeGenerator *code, int pNum, int tNum = 0, int numQword = 0, bool makeEpilog = true)
|
StackFrame(Xbyak::CodeGenerator *code, int pNum, int tNum = 0, int stackSizeByte = 0, bool makeEpilog = true)
|
||||||
: code_(code)
|
: code_(code)
|
||||||
, pNum_(pNum)
|
, pNum_(pNum)
|
||||||
, tNum_(tNum & ~(UseRCX | UseRDX))
|
, tNum_(tNum & ~(UseRCX | UseRDX))
|
||||||
|
@ -295,8 +298,8 @@ public:
|
||||||
const AddressFrame& ptr = code->ptr;
|
const AddressFrame& ptr = code->ptr;
|
||||||
saveNum_ = (std::max)(0, allRegNum - noSaveNum);
|
saveNum_ = (std::max)(0, allRegNum - noSaveNum);
|
||||||
const int *tbl = getOrderTbl() + noSaveNum;
|
const int *tbl = getOrderTbl() + noSaveNum;
|
||||||
P_ = saveNum_ + numQword;
|
P_ = saveNum_ + (stackSizeByte + 7) / 8;
|
||||||
if (P_ > 0 && (P_ & 1) == 0) P_++; // ensure (rsp % 16) == 0
|
if (P_ > 0 && (P_ & 1) == 0) P_++; // here (rsp % 16) == 8, then increment P_ for 16 byte alignment
|
||||||
P_ *= 8;
|
P_ *= 8;
|
||||||
if (P_ > 0) code->sub(rsp, P_);
|
if (P_ > 0) code->sub(rsp, P_);
|
||||||
#ifdef XBYAK64_WIN
|
#ifdef XBYAK64_WIN
|
||||||
|
@ -319,6 +322,10 @@ public:
|
||||||
tTbl_[i] = Xbyak::Reg64(getRegIdx(pos));
|
tTbl_[i] = Xbyak::Reg64(getRegIdx(pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
make epilog manually
|
||||||
|
@param callRet [in] call ret() if true
|
||||||
|
*/
|
||||||
void close(bool callRet = true)
|
void close(bool callRet = true)
|
||||||
{
|
{
|
||||||
using namespace Xbyak;
|
using namespace Xbyak;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue