mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-10 03:07:11 +01:00
* moved amiga/morphos-specific libsym-related field from tprocdef to
cpu-specific descendants (unfortunately causes some duplication, but the
code is trivial and there is no easy way to avoid it)
* also moved the use of the field in ncal to cpu-specific files (with same
caveat)
git-svn-id: trunk@27438 -
This commit is contained in:
parent
5053a39501
commit
9c7c64a3af
@ -30,6 +30,9 @@ interface
|
||||
|
||||
type
|
||||
tm68kcallnode = class(tcgcallnode)
|
||||
protected
|
||||
procedure gen_syscall_para(para: tcallparanode); override;
|
||||
public
|
||||
procedure do_syscall;override;
|
||||
end;
|
||||
|
||||
@ -39,7 +42,7 @@ implementation
|
||||
uses
|
||||
globtype,systems,
|
||||
cutils,verbose,globals,
|
||||
symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
|
||||
symconst,symbase,symsym,symcpu,symtable,defutil,paramgr,parabase,
|
||||
cgbase,pass_2,
|
||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
nmem,nld,ncnv,
|
||||
@ -47,6 +50,13 @@ implementation
|
||||
cg64f32,cgcpu,cpupi,procinfo;
|
||||
|
||||
|
||||
procedure tm68kcallnode.gen_syscall_para(para: tcallparanode);
|
||||
begin
|
||||
{ lib parameter has no special type but proccalloptions must be a syscall }
|
||||
para.left:=cloadnode.create(tcpuprocdef(procdefinition).libsym,tcpuprocdef(procdefinition).libsym.owner);
|
||||
end;
|
||||
|
||||
|
||||
procedure tm68kcallnode.do_syscall;
|
||||
var
|
||||
tmpref: treference;
|
||||
|
||||
@ -26,7 +26,7 @@ unit symcpu;
|
||||
interface
|
||||
|
||||
uses
|
||||
symdef,symsym;
|
||||
symconst,symtype,symdef,symsym;
|
||||
|
||||
type
|
||||
{ defs }
|
||||
@ -91,6 +91,15 @@ type
|
||||
tcpuprocvardefclass = class of tcpuprocvardef;
|
||||
|
||||
tcpuprocdef = class(tprocdef)
|
||||
procedure ppuload_platform(ppufile: tcompilerppufile); override;
|
||||
procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
|
||||
public
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
libsym : tsym;
|
||||
libsymderef : tderef;
|
||||
function getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef; override;
|
||||
procedure buildderef; override;
|
||||
procedure deref; override;
|
||||
end;
|
||||
tcpuprocdefclass = class of tcpuprocdef;
|
||||
|
||||
@ -166,6 +175,45 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{****************************************************************************
|
||||
tcpuprocdef
|
||||
****************************************************************************}
|
||||
|
||||
procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
|
||||
begin
|
||||
inherited;
|
||||
ppufile.getderef(libsymderef);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
|
||||
begin
|
||||
inherited;
|
||||
ppufile.putderef(libsymderef);
|
||||
end;
|
||||
|
||||
|
||||
function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef;
|
||||
begin
|
||||
result:=inherited;
|
||||
if newtpy=procdef then
|
||||
tcpuprocdef(result).libsym:=libsym;
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.buildderef;
|
||||
begin
|
||||
inherited;
|
||||
libsymderef.build(libsym);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.deref;
|
||||
begin
|
||||
inherited;
|
||||
libsym:=tsym(libsymderef.resolve);
|
||||
end;
|
||||
|
||||
begin
|
||||
{ used tdef classes }
|
||||
cfiledef:=tcpufiledef;
|
||||
|
||||
@ -81,6 +81,7 @@ interface
|
||||
procedure register_created_object_types;
|
||||
function get_expect_loc: tcgloc;
|
||||
protected
|
||||
procedure gen_syscall_para(para: tcallparanode); virtual;
|
||||
procedure objc_convert_to_message_send;virtual;
|
||||
|
||||
protected
|
||||
@ -1987,6 +1988,13 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
procedure tcallnode.gen_syscall_para(para: tcallparanode);
|
||||
begin
|
||||
{ unsupported }
|
||||
internalerror(2014040101);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcallnode.objc_convert_to_message_send;
|
||||
var
|
||||
block,
|
||||
@ -2496,14 +2504,9 @@ implementation
|
||||
begin
|
||||
para.left:=gen_vmt_tree;
|
||||
end
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
else
|
||||
if vo_is_syscall_lib in para.parasym.varoptions then
|
||||
begin
|
||||
{ lib parameter has no special type but proccalloptions must be a syscall }
|
||||
para.left:=cloadnode.create(tprocdef(procdefinition).libsym,tprocdef(procdefinition).libsym.owner);
|
||||
end
|
||||
{$endif powerpc or m68k}
|
||||
gen_syscall_para(para)
|
||||
else
|
||||
if vo_is_parentfp in para.parasym.varoptions then
|
||||
begin
|
||||
|
||||
@ -99,7 +99,7 @@ implementation
|
||||
systems,
|
||||
cpuinfo,
|
||||
{ symtable }
|
||||
symbase,symtable,defutil,defcmp,
|
||||
symbase,symcpu,symtable,defutil,defcmp,
|
||||
{ parameter handling }
|
||||
paramgr,cpupara,
|
||||
{ pass 1 }
|
||||
@ -1787,7 +1787,7 @@ begin
|
||||
is_32bitint(tabstractvarsym(sym).vardef)
|
||||
) then
|
||||
begin
|
||||
tprocdef(pd).libsym:=sym;
|
||||
tcpuprocdef(pd).libsym:=sym;
|
||||
if po_syscall_legacy in tprocdef(pd).procoptions then
|
||||
begin
|
||||
vs:=cparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
|
||||
@ -1821,7 +1821,7 @@ begin
|
||||
is_32bitint(tabstractvarsym(sym).vardef)
|
||||
) then
|
||||
begin
|
||||
tprocdef(pd).libsym:=sym;
|
||||
tcpuprocdef(pd).libsym:=sym;
|
||||
vs:=cparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]);
|
||||
pd.parast.insert(vs);
|
||||
end
|
||||
@ -1888,7 +1888,7 @@ begin
|
||||
is_32bitint(tabstractvarsym(sym).vardef)
|
||||
) then
|
||||
begin
|
||||
tprocdef(pd).libsym:=sym;
|
||||
tcpuprocdef(pd).libsym:=sym;
|
||||
if po_syscall_legacy in tprocdef(pd).procoptions then
|
||||
begin
|
||||
vs:=cparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]);
|
||||
|
||||
@ -30,6 +30,9 @@ interface
|
||||
|
||||
type
|
||||
tppccallnode = class(tcgcallnode)
|
||||
protected
|
||||
procedure gen_syscall_para(para: tcallparanode); override;
|
||||
public
|
||||
procedure extra_call_code;override;
|
||||
procedure do_syscall;override;
|
||||
end;
|
||||
@ -40,13 +43,19 @@ implementation
|
||||
uses
|
||||
globtype,systems,
|
||||
cutils,verbose,globals,
|
||||
symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
|
||||
symconst,symbase,symsym,symcpu,symtable,defutil,paramgr,parabase,
|
||||
cgbase,pass_2,
|
||||
cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
|
||||
nmem,nld,ncnv,
|
||||
ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
|
||||
cg64f32,cgcpu,cpupi,procinfo;
|
||||
|
||||
procedure tppccallnode.gen_syscall_para(para: tcallparanode);
|
||||
begin
|
||||
{ lib parameter has no special type but proccalloptions must be a syscall }
|
||||
para.left:=cloadnode.create(tcpuprocdef(procdefinition).libsym,tcpuprocdef(procdefinition).libsym.owner);
|
||||
end;
|
||||
|
||||
|
||||
procedure tppccallnode.extra_call_code;
|
||||
begin
|
||||
@ -88,7 +97,7 @@ implementation
|
||||
cg.getcpuregister(current_asmdata.CurrAsmList,NR_R12);
|
||||
|
||||
reference_reset(tmpref,sizeof(pint));
|
||||
tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tprocdef(procdefinition).libsym).mangledname);
|
||||
tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname);
|
||||
tmpref.refaddr:=addr_higha;
|
||||
current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R12,tmpref));
|
||||
tmpref.base:=NR_R12;
|
||||
|
||||
@ -26,7 +26,7 @@ unit symcpu;
|
||||
interface
|
||||
|
||||
uses
|
||||
symdef,symsym;
|
||||
symconst,symtype,symdef,symsym;
|
||||
|
||||
type
|
||||
{ defs }
|
||||
@ -91,6 +91,15 @@ type
|
||||
tcpuprocvardefclass = class of tcpuprocvardef;
|
||||
|
||||
tcpuprocdef = class(tprocdef)
|
||||
procedure ppuload_platform(ppufile: tcompilerppufile); override;
|
||||
procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
|
||||
public
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
libsym : tsym;
|
||||
libsymderef : tderef;
|
||||
function getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef; override;
|
||||
procedure buildderef; override;
|
||||
procedure deref; override;
|
||||
end;
|
||||
tcpuprocdefclass = class of tcpuprocdef;
|
||||
|
||||
@ -166,6 +175,45 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{****************************************************************************
|
||||
tcpuprocdef
|
||||
****************************************************************************}
|
||||
|
||||
procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
|
||||
begin
|
||||
inherited;
|
||||
ppufile.getderef(libsymderef);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
|
||||
begin
|
||||
inherited;
|
||||
ppufile.putderef(libsymderef);
|
||||
end;
|
||||
|
||||
|
||||
function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef;
|
||||
begin
|
||||
result:=inherited;
|
||||
if newtyp=procdef then
|
||||
tcpuprocdef(result).libsym:=libsym;
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.buildderef;
|
||||
begin
|
||||
inherited;
|
||||
libsymderef.build(libsym);
|
||||
end;
|
||||
|
||||
|
||||
procedure tcpuprocdef.deref;
|
||||
begin
|
||||
inherited;
|
||||
libsym:=tsym(libsymderef.resolve);
|
||||
end;
|
||||
|
||||
begin
|
||||
{ used tdef classes }
|
||||
cfiledef:=tcpufiledef;
|
||||
|
||||
@ -698,11 +698,6 @@ interface
|
||||
struct : tabstractrecorddef;
|
||||
structderef : tderef;
|
||||
implprocoptions: timplprocoptions;
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
libsym : tsym;
|
||||
libsymderef : tderef;
|
||||
{$endif powerpc or m68k}
|
||||
{ import info }
|
||||
import_dll,
|
||||
import_name : pshortstring;
|
||||
@ -4820,10 +4815,6 @@ implementation
|
||||
else
|
||||
deprecatedmsg:=nil;
|
||||
synthetickind:=tsynthetickind(ppufile.getbyte);
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
ppufile.getderef(libsymderef);
|
||||
{$endif powerpc or m68k}
|
||||
{ import stuff }
|
||||
if po_has_importdll in procoptions then
|
||||
import_dll:=stringdup(ppufile.getstring)
|
||||
@ -4970,10 +4961,6 @@ implementation
|
||||
if sp_has_deprecated_msg in symoptions then
|
||||
ppufile.putstring(deprecatedmsg^);
|
||||
ppufile.putbyte(byte(synthetickind));
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
ppufile.putderef(libsymderef);
|
||||
{$endif powerpc or m68k}
|
||||
{ import }
|
||||
if po_has_importdll in procoptions then
|
||||
ppufile.putstring(import_dll^);
|
||||
@ -5198,9 +5185,6 @@ implementation
|
||||
end;
|
||||
{ will have to be associated with a new struct }
|
||||
tprocdef(result).struct:=nil;
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
tprocdef(result).libsym:=libsym;
|
||||
{$endif powerpc or m68k}
|
||||
if assigned(implprocdefinfo) then
|
||||
begin
|
||||
if assigned(resultname) then
|
||||
@ -5236,10 +5220,6 @@ implementation
|
||||
{ procsym that originaly defined this definition, should be in the
|
||||
same symtable }
|
||||
procsymderef.build(procsym);
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
libsymderef.build(libsym);
|
||||
{$endif powerpc or m68k}
|
||||
end;
|
||||
|
||||
|
||||
@ -5270,10 +5250,6 @@ implementation
|
||||
{ procsym that originaly defined this definition, should be in the
|
||||
same symtable }
|
||||
procsym:=tprocsym(procsymderef.resolve);
|
||||
{$if defined(powerpc) or defined(m68k)}
|
||||
{ library symbol for AmigaOS/MorphOS }
|
||||
libsym:=tsym(libsymderef.resolve);
|
||||
{$endif powerpc or m68k}
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user