* fixed Z80 stack and temp allocation, so it doesn't have any wasted bytes

git-svn-id: branches/z80@44906 -
This commit is contained in:
nickysn 2020-04-21 02:51:44 +00:00
parent 1669254c5a
commit d3e946b779
4 changed files with 71 additions and 1 deletions

1
.gitattributes vendored
View File

@ -1084,6 +1084,7 @@ compiler/z80/rz80sta.inc svneol=native#text/plain
compiler/z80/rz80std.inc svneol=native#text/plain
compiler/z80/rz80sup.inc svneol=native#text/plain
compiler/z80/symcpu.pas svneol=native#text/plain
compiler/z80/tgcpu.pas svneol=native#text/plain
compiler/z80/z80ins.dat svneol=native#text/plain
compiler/z80/z80nop.inc svneol=native#text/plain
compiler/z80/z80op.inc svneol=native#text/plain

View File

@ -40,6 +40,8 @@ unit cpunode;
// ,nz80cnv
// ,nz80mem
// ,nz80util,
{ these are not really nodes }
,tgcpu
{ symtable }
,symcpu,
aasmdef

View File

@ -55,7 +55,7 @@ unit cpupi;
procedure tcpuprocinfo.set_first_temp_offset;
begin
if tg.direction = -1 then
tg.setfirsttemp(-1)
tg.setfirsttemp(0)
else if not (po_nostackframe in procdef.procoptions) then
tg.setfirsttemp(maxpushedparasize+1)
else

67
compiler/z80/tgcpu.pas Normal file
View File

@ -0,0 +1,67 @@
{
Copyright (C) 1998-2000 by Florian Klaempfl
This unit handles the temporary variables stuff for Z80
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
{
This unit handles the temporary variables stuff for Z80.
}
unit tgcpu;
{$i fpcdefs.inc}
interface
uses
tgobj,globtype,aasmdata,cgutils,symtype;
type
{ ttgz80 }
ttgz80 = class(ttgobj)
public
procedure setfirsttemp(l: asizeint); override;
end;
implementation
uses
globals,
verbose,
cpubase,
cutils;
{ ttgz80 }
procedure ttgz80.setfirsttemp(l: asizeint);
begin
{ this is a negative value normally }
if l*direction<0 then
internalerror(200204221);
firsttemp:=l;
lasttemp:=l;
{$ifdef EXTDEBUG}
Comment(V_Note,'tgobj: (SetFirstTemp) set to '+tostr(l));
{$endif}
end;
begin
tgobjclass:=ttgz80;
end.