|
@@ -43,12 +43,13 @@ unit cpupara;
|
|
procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara : TCGPara);override;
|
|
procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara : TCGPara);override;
|
|
function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
|
|
function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
|
|
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
|
function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
|
|
- procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
|
|
|
|
|
|
+ procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
|
|
private
|
|
private
|
|
procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
|
|
procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
|
|
function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
|
|
function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
|
|
var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword):longint;
|
|
var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword):longint;
|
|
function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
|
|
function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
|
|
|
|
+ function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;override;
|
|
end;
|
|
end;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
@@ -190,6 +191,16 @@ unit cpupara;
|
|
retcgsize:=def_cgsize(p.rettype.def);
|
|
retcgsize:=def_cgsize(p.rettype.def);
|
|
|
|
|
|
location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
|
|
location_reset(p.funcretloc[side],LOC_INVALID,OS_NO);
|
|
|
|
+
|
|
|
|
+ { explicit paraloc specified? }
|
|
|
|
+ if po_explicitparaloc in p.procoptions then
|
|
|
|
+ begin
|
|
|
|
+ p.funcretloc[side].loc:=LOC_REGISTER;
|
|
|
|
+ p.funcretloc[side].register:=p.exp_funcretloc;
|
|
|
|
+ p.funcretloc[side].size:=retcgsize;
|
|
|
|
+ exit;
|
|
|
|
+ end;
|
|
|
|
+
|
|
{ void has no location }
|
|
{ void has no location }
|
|
if is_void(p.rettype.def) then
|
|
if is_void(p.rettype.def) then
|
|
begin
|
|
begin
|
|
@@ -414,6 +425,56 @@ unit cpupara;
|
|
end;
|
|
end;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function tm68kparamanager.parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;
|
|
|
|
+ begin
|
|
|
|
+ result:=false;
|
|
|
|
+ case target_info.system of
|
|
|
|
+ system_m68k_amiga:
|
|
|
|
+ begin
|
|
|
|
+ if s='D0' then
|
|
|
|
+ p.exp_funcretloc:=NR_D0
|
|
|
|
+ else if s='D1' then
|
|
|
|
+ p.exp_funcretloc:=NR_D1
|
|
|
|
+ else if s='D2' then
|
|
|
|
+ p.exp_funcretloc:=NR_D2
|
|
|
|
+ else if s='D3' then
|
|
|
|
+ p.exp_funcretloc:=NR_D3
|
|
|
|
+ else if s='D4' then
|
|
|
|
+ p.exp_funcretloc:=NR_D4
|
|
|
|
+ else if s='D5' then
|
|
|
|
+ p.exp_funcretloc:=NR_D5
|
|
|
|
+ else if s='D6' then
|
|
|
|
+ p.exp_funcretloc:=NR_D6
|
|
|
|
+ else if s='D7' then
|
|
|
|
+ p.exp_funcretloc:=NR_D7
|
|
|
|
+ else if s='A0' then
|
|
|
|
+ p.exp_funcretloc:=NR_A0
|
|
|
|
+ else if s='A1' then
|
|
|
|
+ p.exp_funcretloc:=NR_A1
|
|
|
|
+ else if s='A2' then
|
|
|
|
+ p.exp_funcretloc:=NR_A2
|
|
|
|
+ else if s='A3' then
|
|
|
|
+ p.exp_funcretloc:=NR_A3
|
|
|
|
+ else if s='A4' then
|
|
|
|
+ p.exp_funcretloc:=NR_A4
|
|
|
|
+ else if s='A5' then
|
|
|
|
+ p.exp_funcretloc:=NR_A5
|
|
|
|
+ { 'A6' is problematic, since it's the frame pointer in fpc,
|
|
|
|
+ so it should be saved before a call! }
|
|
|
|
+ else if s='A6' then
|
|
|
|
+ p.exp_funcretloc:=NR_A6
|
|
|
|
+ { 'A7' is the stack pointer on 68k, can't be overwritten by API calls }
|
|
|
|
+ else
|
|
|
|
+ p.exp_funcretloc:=NR_NO;
|
|
|
|
+
|
|
|
|
+ if p.exp_funcretloc<>NR_NO then result:=true;
|
|
|
|
+ end;
|
|
|
|
+ else
|
|
|
|
+ internalerror(2005121801);
|
|
|
|
+ end;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+
|
|
function tm68kparamanager.parseparaloc(p : tparavarsym;const s : string) : boolean;
|
|
function tm68kparamanager.parseparaloc(p : tparavarsym;const s : string) : boolean;
|
|
var
|
|
var
|
|
paraloc : pcgparalocation;
|
|
paraloc : pcgparalocation;
|