summaryrefslogtreecommitdiff
path: root/riscv_new/compiler/nutils.pas
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-09-25 20:31:03 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-09-25 20:31:03 +0000
commit94251f1e0a381251ce64fc7c75052034d260cc98 (patch)
tree4a846177c7a479901ea4314e8c9892c3918d5e0e /riscv_new/compiler/nutils.pas
parent59ba4252495da6e8b43eef54fb187d811996f903 (diff)
downloadfpc-94251f1e0a381251ce64fc7c75052034d260cc98.tar.gz
* correctly take care of short boolean evaluation when rearranging nodes during CSElaksen
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/laksen@39803 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'riscv_new/compiler/nutils.pas')
-rw-r--r--riscv_new/compiler/nutils.pas13
1 files changed, 12 insertions, 1 deletions
diff --git a/riscv_new/compiler/nutils.pas b/riscv_new/compiler/nutils.pas
index fa91b3bee4..c276217800 100644
--- a/riscv_new/compiler/nutils.pas
+++ b/riscv_new/compiler/nutils.pas
@@ -161,6 +161,10 @@ interface
{ include or exclude cs from p.localswitches }
procedure node_change_local_switch(p : tnode;cs : tlocalswitch;enable : boolean);
+ { returns true, if p is a node which shall be short boolean evaluated,
+ if it is not an orn/andn with boolean operans, the result is undefined }
+ function doshortbooleval(p : tnode) : Boolean;
+
implementation
uses
@@ -1459,7 +1463,8 @@ implementation
exclude(p.localswitches, plocalswitchchange(plsc)^.cs);
result:=fen_true;
end;
-
+
+
procedure node_change_local_switch(p : tnode;cs : tlocalswitch;enable : boolean);
var
lsc : tlocalswitchchange;
@@ -1469,4 +1474,10 @@ implementation
foreachnodestatic(p,@do_change_local_settings,@lsc);
end;
+
+ function doshortbooleval(p : tnode) : Boolean;
+ begin
+ Result:=(p.nodetype in [orn,andn]) and ((nf_short_bool in taddnode(p).flags) or not(cs_full_boolean_eval in p.localswitches));
+ end;
+
end.