mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 01:59:18 +02:00
+ function node_not_zero and make use of it
This commit is contained in:
parent
92b3e6a7d7
commit
9cb6497fae
@ -81,7 +81,7 @@ implementation
|
|||||||
aasmbase,aasmdata,
|
aasmbase,aasmdata,
|
||||||
cgbase,pass_2,
|
cgbase,pass_2,
|
||||||
cpubase,procinfo,
|
cpubase,procinfo,
|
||||||
nadd,ncon,ncal,
|
nadd,ncon,ncal,nutils,
|
||||||
tgobj,ncgutil,
|
tgobj,ncgutil,
|
||||||
cgutils,cgobj,hlcgobj,
|
cgutils,cgobj,hlcgobj,
|
||||||
defcmp
|
defcmp
|
||||||
@ -999,8 +999,7 @@ implementation
|
|||||||
opsize: tcgsize;
|
opsize: tcgsize;
|
||||||
begin
|
begin
|
||||||
reverse:=(inlinenumber = in_bsr_x);
|
reverse:=(inlinenumber = in_bsr_x);
|
||||||
not_zero:=(left.nodetype=orn) and (((is_constintnode(taddnode(left).left) and (tordconstnode(taddnode(left).left).value<>0))) or
|
not_zero:=node_not_zero(left);
|
||||||
((is_constintnode(taddnode(left).right) and (tordconstnode(taddnode(left).right).value<>0))));
|
|
||||||
secondpass(left);
|
secondpass(left);
|
||||||
|
|
||||||
opsize:=tcgsize2unsigned[left.location.size];
|
opsize:=tcgsize2unsigned[left.location.size];
|
||||||
|
@ -214,6 +214,9 @@ interface
|
|||||||
{ Returns True if n one of its children has a type that appears in TypeList }
|
{ Returns True if n one of its children has a type that appears in TypeList }
|
||||||
function has_node_of_type(n: TNode; TypeList: TNodeTypeSet): Boolean; {$IFDEF USEINLINE}inline;{$ENDIF USEINLINE}
|
function has_node_of_type(n: TNode; TypeList: TNodeTypeSet): Boolean; {$IFDEF USEINLINE}inline;{$ENDIF USEINLINE}
|
||||||
|
|
||||||
|
{ returns true if n is guranteed not to return an ordinal zero }
|
||||||
|
function node_not_zero(n : tnode) : Boolean;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -1727,4 +1730,11 @@ implementation
|
|||||||
Result := foreachnodestatic(n, @node_in_list, @TypeList);
|
Result := foreachnodestatic(n, @node_in_list, @TypeList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function node_not_zero(n: tnode): Boolean;
|
||||||
|
begin
|
||||||
|
result:=(is_constintnode(n) and (get_int_value(n)<>0)) or
|
||||||
|
((n.nodetype=orn) and (node_not_zero(taddnode(n).left) or node_not_zero(taddnode(n).right)));
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user