+ introduce a new method tparamanager.asm_result_var(), which determines whether

a pure assembler routine should be allocated a 'result' variable

git-svn-id: trunk@38245 -
This commit is contained in:
nickysn 2018-02-15 17:41:07 +00:00
parent 040ce05360
commit f3391f81a5
2 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,8 @@ unit paramgr;
function param_use_paraloc(const cgpara:tcgpara):boolean;virtual;
{ Returns true if the return value is actually a parameter pointer }
function ret_in_param(def:tdef;pd:tabstractprocdef):boolean;virtual;
{ Returns true if a result variable should be allocated for an assembler routine }
function asm_result_var(def:tdef;pd:tabstractprocdef):boolean;virtual;
function push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
function keep_para_array_range(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
@ -201,6 +203,15 @@ implementation
end;
{ true if a result variable should be allocated for an assembler routine }
function tparamanager.asm_result_var(def:tdef;pd:tabstractprocdef):boolean;
begin
if not(po_assembler in pd.procoptions) then
internalerror(2018021501);
result:=true;
end;
function tparamanager.push_high_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
begin
push_high_param:=not(calloption in cdecl_pocalls) and

View File

@ -271,7 +271,8 @@ implementation
begin
{ The result from constructors and destructors can't be accessed directly }
if not(pd.proctypeoption in [potype_constructor,potype_destructor]) and
not is_void(pd.returndef) then
not is_void(pd.returndef) and
(not(po_assembler in pd.procoptions) or paramanager.asm_result_var(pd.returndef,pd)) then
begin
storepos:=current_tokenpos;
current_tokenpos:=pd.fileinfo;