mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 11:29:29 +02:00
+ extend node_not_zero to take range types into account
+ aarch64: if no FPC_DIVBYZERO call is needed, div nodes do not generate calls
This commit is contained in:
parent
bcaa58db01
commit
09be204011
@ -63,7 +63,7 @@ implementation
|
||||
function taarch64moddivnode.pass_1: tnode;
|
||||
begin
|
||||
result:=inherited pass_1;
|
||||
if not assigned(result) then
|
||||
if not assigned(result) and not(node_not_zero(right)) then
|
||||
include(current_procinfo.flags,pi_do_call);
|
||||
end;
|
||||
|
||||
|
@ -1734,6 +1734,7 @@ implementation
|
||||
function node_not_zero(n: tnode): Boolean;
|
||||
begin
|
||||
result:=(is_constintnode(n) and (get_int_value(n)<>0)) or
|
||||
((n.resultdef.typ=orddef) and ((torddef(n.resultdef).low>0) or (torddef(n.resultdef).high<0))) or
|
||||
((n.nodetype=typeconvn) and (ttypeconvnode(n).convtype=tc_int_2_int) and node_not_zero(ttypeconvnode(n).left)) or
|
||||
((n.nodetype=orn) and (node_not_zero(taddnode(n).left) or node_not_zero(taddnode(n).right)));
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user