* inline nodes can specify whether their result needs to be used

This commit is contained in:
Sven/Sarah Barth 2024-12-08 22:03:10 +01:00
parent 76a15dbd6c
commit 2390e70a4e
2 changed files with 18 additions and 2 deletions

View File

@ -63,6 +63,8 @@ interface
property parameters : tnode read left write left;
function may_have_sideeffect_norecurse: boolean;
function may_ignore_result:boolean;
protected
{ All the following routines currently
call compilerprocs, unless they are
@ -6051,6 +6053,20 @@ implementation
end;
function tinlinenode.may_ignore_result:boolean;
begin
case inlinenumber of
in_atomic_inc,
in_atomic_dec,
in_atomic_xchg,
in_atomic_cmp_xchg:
result:=true;
else
result:=is_void(resultdef);
end;
end;
function tinlinenode.first_fma: tnode;
begin
CGMessage1(cg_e_function_not_support_by_selected_instruction_set,'FMA');

View File

@ -50,7 +50,7 @@ implementation
paramgr,
{ pass 1 }
pass_1,htypechk,
nutils,ngenutil,nbas,ncal,nmem,nset,ncnv,ncon,nld,nflw,
nutils,ngenutil,nbas,ncal,nmem,nset,ncnv,ncon,nld,nflw,ninl,
{ parser }
scanner,
pbase,ptype,pexpr,
@ -1512,7 +1512,7 @@ implementation
if not(p.nodetype in [nothingn,errorn,calln,ifn,assignn,breakn,inlinen,
continuen,labeln,blockn,exitn,goton]) or
((p.nodetype=inlinen) and
not is_void(p.resultdef)) or
not tinlinenode(p).may_ignore_result) or
((p.nodetype=calln) and
(assigned(tcallnode(p).procdefinition)) and
(tcallnode(p).procdefinition.proctypeoption=potype_operator)) then