mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 17:48:46 +02:00
* x86-64: adjust stack by push/pop if possible
git-svn-id: trunk@45476 -
This commit is contained in:
parent
d2879f5bb9
commit
8f0a3cfce7
@ -3146,9 +3146,16 @@ unit cgx86;
|
||||
var
|
||||
href : treference;
|
||||
begin
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-a,ctempposinvalid,0,[]);
|
||||
{ normally, lea is a better choice than a sub to adjust the stack pointer }
|
||||
list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG));
|
||||
{$ifdef x86_64}
|
||||
if localsize=8 then
|
||||
list.concat(Taicpu.op_reg(A_PUSH,TCGSize2OpSize[OS_ADDR],NR_RAX))
|
||||
else
|
||||
{$endif x86_64}
|
||||
begin
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,-a,ctempposinvalid,0,[]);
|
||||
{ normally, lea is a better choice than a sub to adjust the stack pointer }
|
||||
list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG));
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ifdef x86}
|
||||
|
@ -353,9 +353,14 @@ unit cgcpu;
|
||||
var
|
||||
href : treference;
|
||||
begin
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,a,ctempposinvalid,0,[]);
|
||||
{ normally, lea is a better choice than an add }
|
||||
list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG));
|
||||
if a=8 then
|
||||
list.concat(Taicpu.op_reg(A_POP,TCGSize2OpSize[OS_ADDR],NR_RCX))
|
||||
else
|
||||
begin
|
||||
reference_reset_base(href,NR_STACK_POINTER_REG,a,ctempposinvalid,0,[]);
|
||||
{ normally, lea is a better choice than an add }
|
||||
list.concat(Taicpu.op_ref_reg(A_LEA,TCGSize2OpSize[OS_ADDR],href,NR_STACK_POINTER_REG));
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user