mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 15:47:52 +02:00
* moved (unfinished) routines related to writing taicpu's to ppu files
from x86/aasmcpu to aasmtai and (new) aasmsym, so that when they're finished they're available for all targets * added dummy implementation of tai_cpu_abstract.pass1 and pass2 so there are no more hundreds of warnings on non-x86 about constructing taicpu instances with abstract methods git-svn-id: trunk@5787 -
This commit is contained in:
parent
912e1e13eb
commit
a23fa2e81e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -8,6 +8,7 @@ compiler/Makefile.fpc svneol=native#text/plain
|
||||
compiler/README -text
|
||||
compiler/aasmbase.pas svneol=native#text/plain
|
||||
compiler/aasmdata.pas svneol=native#text/plain
|
||||
compiler/aasmsym.pas svneol=native#text/plain
|
||||
compiler/aasmtai.pas svneol=native#text/plain
|
||||
compiler/aggas.pas svneol=native#text/plain
|
||||
compiler/alpha/aasmcpu.pas svneol=native#text/plain
|
||||
|
71
compiler/aasmsym.pas
Normal file
71
compiler/aasmsym.pas
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
Copyright (c) 1998-2007 by Florian Klaempfl and Peter Vreman
|
||||
|
||||
Contains abstract assembler instructions for all processor
|
||||
types, including routines which depend on the symbol table.
|
||||
These cannot be in aasmtai, because the symbol table units
|
||||
depend on that one.
|
||||
|
||||
* Portions of this code was inspired by the NASM sources
|
||||
The Netwide Assembler is Copyright (c) 1996 Simon Tatham and
|
||||
Julian Hall. All rights reserved.
|
||||
|
||||
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.
|
||||
|
||||
****************************************************************************
|
||||
}
|
||||
unit aasmsym;
|
||||
|
||||
{$i fpcdefs.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
aasmtai;
|
||||
|
||||
type
|
||||
tai_cpu_abstract_sym = class(tai_cpu_abstract)
|
||||
protected
|
||||
procedure ppubuildderefimploper(var o:toper);override;
|
||||
procedure ppuderefoper(var o:toper);override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
symsym;
|
||||
|
||||
|
||||
procedure tai_cpu_abstract_sym.ppubuildderefimploper(var o:toper);
|
||||
begin
|
||||
case o.typ of
|
||||
top_local :
|
||||
o.localoper^.localsymderef.build(tlocalvarsym(o.localoper^.localsym));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure tai_cpu_abstract_sym.ppuderefoper(var o:toper);
|
||||
begin
|
||||
case o.typ of
|
||||
top_ref :
|
||||
begin
|
||||
end;
|
||||
top_local :
|
||||
o.localoper^.localsym:=tlocalvarsym(o.localoper^.localsymderef.resolve);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
@ -557,8 +557,8 @@ interface
|
||||
}
|
||||
tai_cpu_abstract = class(tailineinfo)
|
||||
protected
|
||||
procedure ppuloadoper(ppufile:tcompilerppufile;var o:toper);virtual;abstract;
|
||||
procedure ppuwriteoper(ppufile:tcompilerppufile;const o:toper);virtual;abstract;
|
||||
procedure ppuloadoper(ppufile:tcompilerppufile;var o:toper);virtual;
|
||||
procedure ppuwriteoper(ppufile:tcompilerppufile;const o:toper);virtual;
|
||||
procedure ppubuildderefimploper(var o:toper);virtual;abstract;
|
||||
procedure ppuderefoper(var o:toper);virtual;abstract;
|
||||
public
|
||||
@ -599,8 +599,8 @@ interface
|
||||
function spilling_get_operation_type(opnr: longint): topertype;virtual;
|
||||
function spilling_get_operation_type_ref(opnr: longint; reg: tregister): topertype;virtual;
|
||||
|
||||
function Pass1(objdata:TObjData):longint;virtual;abstract;
|
||||
procedure Pass2(objdata:TObjData);virtual;abstract;
|
||||
function Pass1(objdata:TObjData):longint;virtual;
|
||||
procedure Pass2(objdata:TObjData);virtual;
|
||||
|
||||
procedure resetpass1; virtual;
|
||||
procedure resetpass2; virtual;
|
||||
@ -2319,6 +2319,95 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function tai_cpu_abstract.Pass1(objdata:TObjData):longint;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure tai_cpu_abstract.Pass2(objdata:TObjData);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure tai_cpu_abstract.ppuloadoper(ppufile:tcompilerppufile;var o:toper);
|
||||
begin
|
||||
o.typ:=toptype(ppufile.getbyte);
|
||||
o.ot:=ppufile.getlongint;
|
||||
case o.typ of
|
||||
top_reg :
|
||||
ppufile.getdata(o.reg,sizeof(Tregister));
|
||||
top_ref :
|
||||
begin
|
||||
new(o.ref);
|
||||
{$ifdef x86}
|
||||
ppufile.getdata(o.ref^.segment,sizeof(Tregister));
|
||||
{$endif x86}
|
||||
ppufile.getdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.getdata(o.ref^.index,sizeof(Tregister));
|
||||
ppufile.getdata(o.ref^.refaddr,sizeof(o.ref^.refaddr));;
|
||||
o.ref^.scalefactor:=ppufile.getbyte;
|
||||
o.ref^.offset:=ppufile.getaint;
|
||||
o.ref^.symbol:=ppufile.getasmsymbol;
|
||||
o.ref^.relsymbol:=ppufile.getasmsymbol;
|
||||
end;
|
||||
top_const :
|
||||
o.val:=ppufile.getaint;
|
||||
top_local :
|
||||
begin
|
||||
new(o.localoper);
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.getderef(localsymderef);
|
||||
localsymofs:=ppufile.getaint;
|
||||
localindexreg:=tregister(ppufile.getlongint);
|
||||
localscale:=ppufile.getbyte;
|
||||
localgetoffset:=(ppufile.getbyte<>0);
|
||||
end;
|
||||
end;
|
||||
else
|
||||
internalerror(2007010210);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure tai_cpu_abstract.ppuwriteoper(ppufile:tcompilerppufile;const o:toper);
|
||||
begin
|
||||
ppufile.putbyte(byte(o.typ));
|
||||
ppufile.putlongint(o.ot);
|
||||
case o.typ of
|
||||
top_reg :
|
||||
ppufile.putdata(o.reg,sizeof(Tregister));
|
||||
top_ref :
|
||||
begin
|
||||
{$ifdef x86}
|
||||
ppufile.putdata(o.ref^.segment,sizeof(Tregister));
|
||||
{$endif x86}
|
||||
ppufile.putdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.putdata(o.ref^.index,sizeof(Tregister));
|
||||
ppufile.putdata(o.ref^.refaddr,sizeof(o.ref^.refaddr));
|
||||
ppufile.putbyte(o.ref^.scalefactor);
|
||||
ppufile.putaint(o.ref^.offset);
|
||||
ppufile.putasmsymbol(o.ref^.symbol);
|
||||
ppufile.putasmsymbol(o.ref^.relsymbol);
|
||||
end;
|
||||
top_const :
|
||||
ppufile.putaint(o.val);
|
||||
top_local :
|
||||
begin
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.putderef(localsymderef);
|
||||
ppufile.putaint(localsymofs);
|
||||
ppufile.putlongint(longint(localindexreg));
|
||||
ppufile.putbyte(localscale);
|
||||
ppufile.putbyte(byte(localgetoffset));
|
||||
end;
|
||||
end;
|
||||
else
|
||||
internalerror(2007010211);
|
||||
end;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
tai_align_abstract
|
||||
****************************************************************************}
|
||||
|
@ -30,7 +30,7 @@ unit aasmcpu;
|
||||
|
||||
uses
|
||||
aasmbase,globals,verbose,
|
||||
cpubase,aasmtai,aasmdata;
|
||||
cpubase,aasmtai,aasmdata,aasmsym;
|
||||
|
||||
type
|
||||
tai_frame = class(tai)
|
||||
@ -45,7 +45,7 @@ unit aasmcpu;
|
||||
end;
|
||||
|
||||
|
||||
taicpu = class(taicpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
constructor op_none(op : tasmop);
|
||||
|
||||
constructor op_reg(op : tasmop;_op1 : tregister);
|
||||
|
@ -27,7 +27,7 @@ interface
|
||||
|
||||
uses
|
||||
cclasses,globtype,globals,verbose,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
aasmbase,aasmtai,aasmdata,aasmsym,
|
||||
ogbase,
|
||||
symtype,
|
||||
cpubase,cpuinfo,cgbase,cgutils;
|
||||
@ -153,7 +153,7 @@ uses
|
||||
InsTabCache : PInsTabCache;
|
||||
|
||||
type
|
||||
taicpu = class(tai_cpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
oppostfix : TOpPostfix;
|
||||
roundingmode : troundingmode;
|
||||
procedure loadshifterop(opidx:longint;const so:tshifterop);
|
||||
|
@ -26,7 +26,7 @@ unit aasmcpu;
|
||||
interface
|
||||
|
||||
uses
|
||||
cclasses,aasmtai,aasmdata,
|
||||
cclasses,aasmtai,aasmdata,aasmsym,
|
||||
aasmbase,globals,verbose,symtype,
|
||||
cpubase,cpuinfo,cgbase,cgutils;
|
||||
|
||||
@ -38,7 +38,7 @@ const
|
||||
O_MOV_DEST = 1;
|
||||
type
|
||||
|
||||
taicpu = class(tai_cpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
opsize : topsize;
|
||||
constructor op_none(op : tasmop);
|
||||
constructor op_none(op : tasmop;_size : topsize);
|
||||
|
@ -27,7 +27,7 @@ interface
|
||||
|
||||
uses
|
||||
globtype,verbose,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
aasmbase,aasmtai,aasmdata,aasmsym,
|
||||
cpubase,cgbase,cgutils;
|
||||
|
||||
const
|
||||
@ -38,7 +38,7 @@ uses
|
||||
|
||||
|
||||
type
|
||||
taicpu = class(tai_cpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
constructor op_none(op : tasmop);
|
||||
|
||||
constructor op_reg(op : tasmop;_op1 : tregister);
|
||||
@ -81,7 +81,6 @@ uses
|
||||
|
||||
procedure loadbool(opidx:aint;_b:boolean);
|
||||
|
||||
|
||||
function is_same_reg_move(regtype: Tregistertype):boolean; override;
|
||||
|
||||
{ register spilling code }
|
||||
|
@ -28,7 +28,7 @@ interface
|
||||
uses
|
||||
cclasses,
|
||||
globtype,globals,verbose,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
aasmbase,aasmtai,aasmdata,aasmsym,
|
||||
cgbase,cgutils,cpubase,cpuinfo;
|
||||
|
||||
const
|
||||
@ -38,7 +38,7 @@ uses
|
||||
O_MOV_DEST = 1;
|
||||
|
||||
type
|
||||
taicpu = class(tai_cpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
delayslot_annulled : boolean; { conditinal opcode with ,a }
|
||||
constructor op_none(op : tasmop);
|
||||
|
||||
|
@ -34,7 +34,7 @@ interface
|
||||
cpubase,
|
||||
cgbase,cgutils,
|
||||
symtype,
|
||||
aasmbase,aasmtai,aasmdata,
|
||||
aasmbase,aasmtai,aasmdata,aasmsym,
|
||||
ogbase;
|
||||
|
||||
const
|
||||
@ -192,7 +192,7 @@ interface
|
||||
function calculatefillbuf(var buf : tfillbuffer):pchar;override;
|
||||
end;
|
||||
|
||||
taicpu = class(tai_cpu_abstract)
|
||||
taicpu = class(tai_cpu_abstract_sym)
|
||||
opsize : topsize;
|
||||
constructor op_none(op : tasmop);
|
||||
constructor op_none(op : tasmop;_size : topsize);
|
||||
@ -243,11 +243,6 @@ interface
|
||||
function is_same_reg_move(regtype: Tregistertype):boolean;override;
|
||||
{ register spilling code }
|
||||
function spilling_get_operation_type(opnr: longint): topertype;override;
|
||||
protected
|
||||
procedure ppuloadoper(ppufile:tcompilerppufile;var o:toper);override;
|
||||
procedure ppuwriteoper(ppufile:tcompilerppufile;const o:toper);override;
|
||||
procedure ppubuildderefimploper(var o:toper);override;
|
||||
procedure ppuderefoper(var o:toper);override;
|
||||
private
|
||||
{ next fields are filled in pass1, so pass2 is faster }
|
||||
insentry : PInsEntry;
|
||||
@ -833,97 +828,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure taicpu.ppuloadoper(ppufile:tcompilerppufile;var o:toper);
|
||||
begin
|
||||
o.typ:=toptype(ppufile.getbyte);
|
||||
o.ot:=ppufile.getlongint;
|
||||
case o.typ of
|
||||
top_reg :
|
||||
ppufile.getdata(o.reg,sizeof(Tregister));
|
||||
top_ref :
|
||||
begin
|
||||
new(o.ref);
|
||||
ppufile.getdata(o.ref^.segment,sizeof(Tregister));
|
||||
ppufile.getdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.getdata(o.ref^.index,sizeof(Tregister));
|
||||
o.ref^.scalefactor:=ppufile.getbyte;
|
||||
o.ref^.offset:=ppufile.getaint;
|
||||
o.ref^.symbol:=ppufile.getasmsymbol;
|
||||
o.ref^.relsymbol:=ppufile.getasmsymbol;
|
||||
end;
|
||||
top_const :
|
||||
o.val:=ppufile.getaint;
|
||||
top_local :
|
||||
begin
|
||||
new(o.localoper);
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.getderef(localsymderef);
|
||||
localsymofs:=ppufile.getaint;
|
||||
localindexreg:=tregister(ppufile.getlongint);
|
||||
localscale:=ppufile.getbyte;
|
||||
localgetoffset:=(ppufile.getbyte<>0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure taicpu.ppuwriteoper(ppufile:tcompilerppufile;const o:toper);
|
||||
begin
|
||||
ppufile.putbyte(byte(o.typ));
|
||||
ppufile.putlongint(o.ot);
|
||||
case o.typ of
|
||||
top_reg :
|
||||
ppufile.putdata(o.reg,sizeof(Tregister));
|
||||
top_ref :
|
||||
begin
|
||||
ppufile.putdata(o.ref^.segment,sizeof(Tregister));
|
||||
ppufile.putdata(o.ref^.base,sizeof(Tregister));
|
||||
ppufile.putdata(o.ref^.index,sizeof(Tregister));
|
||||
ppufile.putbyte(o.ref^.scalefactor);
|
||||
ppufile.putaint(o.ref^.offset);
|
||||
ppufile.putasmsymbol(o.ref^.symbol);
|
||||
ppufile.putasmsymbol(o.ref^.relsymbol);
|
||||
end;
|
||||
top_const :
|
||||
ppufile.putaint(o.val);
|
||||
top_local :
|
||||
begin
|
||||
with o.localoper^ do
|
||||
begin
|
||||
ppufile.putderef(localsymderef);
|
||||
ppufile.putaint(localsymofs);
|
||||
ppufile.putlongint(longint(localindexreg));
|
||||
ppufile.putbyte(localscale);
|
||||
ppufile.putbyte(byte(localgetoffset));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure taicpu.ppubuildderefimploper(var o:toper);
|
||||
begin
|
||||
case o.typ of
|
||||
top_local :
|
||||
o.localoper^.localsymderef.build(tlocalvarsym(o.localoper^.localsym));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure taicpu.ppuderefoper(var o:toper);
|
||||
begin
|
||||
case o.typ of
|
||||
top_ref :
|
||||
begin
|
||||
end;
|
||||
top_local :
|
||||
o.localoper^.localsym:=tlocalvarsym(o.localoper^.localsymderef.resolve);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure taicpu.CheckNonCommutativeOpcodes;
|
||||
begin
|
||||
{ we need ATT order }
|
||||
|
Loading…
Reference in New Issue
Block a user