From f41cd241f86a5eb06463958ba5a35649eea364ee Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 13 Feb 2021 17:21:13 -0600 Subject: [PATCH] Slightly optimize stack save code for calls to long long functions. The X register is not used as part of the return value, so it does not have to be preserved. --- Gen.pas | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Gen.pas b/Gen.pas index 451c289..d43d03a 100644 --- a/Gen.pas +++ b/Gen.pas @@ -4716,11 +4716,13 @@ procedure GenTree {op: icptr}; end {if} else if saveStack or (op^.q <> 0) then begin stackSaveDepth := stackSaveDepth - 1; - if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord]) then + if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord,cgQuad,cgUQuad]) + then GenImplied(m_txy); GenNative(m_ldx_dir, direct, stackLoc, nil, 0); GenImplied(m_txs); - if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord]) then + if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord,cgQuad,cgUQuad]) + then GenImplied(m_tyx); if stackSaveDepth <> 0 then begin GenImplied(m_ply); @@ -4808,11 +4810,13 @@ procedure GenTree {op: icptr}; end {if} else if saveStack or (op^.q <> 0) then begin stackSaveDepth := stackSaveDepth - 1; - if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord]) then + if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord,cgQuad,cgUQuad]) + then GenImplied(m_txy); GenNative(m_ldx_dir, direct, stackLoc, nil, 0); GenImplied(m_txs); - if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord]) then + if not (op^.optype in [cgVoid,cgByte,cgUByte,cgWord,cgUWord,cgQuad,cgUQuad]) + then GenImplied(m_tyx); if stackSaveDepth <> 0 then begin GenImplied(m_ply);