mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-28 16:30:59 +00:00
Recognize pc_not as a boolean operation for purposes of optimizations.
This generates better code for certain things, like the following assignment: _Bool b = !x;
This commit is contained in:
parent
753c9b9f20
commit
23b870908e
8
DAG.pas
8
DAG.pas
@ -1607,7 +1607,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
||||
if op^.right^.q = 1 then
|
||||
if op^.left^.opcode in
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt]
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt,pc_not]
|
||||
then begin
|
||||
opv := op^.left;
|
||||
opv^.next := op^.next;
|
||||
@ -1616,7 +1616,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
else if op^.right^.optype in [cgLong, cgULong] then begin
|
||||
if op^.right^.lval = 1 then
|
||||
if op^.left^.opcode in
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt]
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt,pc_not]
|
||||
then begin
|
||||
opv := op^.left;
|
||||
opv^.next := op^.next;
|
||||
@ -2126,7 +2126,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
else if op^.right^.optype in [cgByte, cgUByte, cgWord, cgUWord] then begin
|
||||
if op^.right^.q = 0 then
|
||||
if op^.left^.opcode in
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt]
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt,pc_not]
|
||||
then begin
|
||||
opv := op^.left;
|
||||
opv^.next := op^.next;
|
||||
@ -2135,7 +2135,7 @@ case op^.opcode of {check for optimizations of this node}
|
||||
else if op^.right^.optype in [cgLong, cgULong] then begin
|
||||
if op^.right^.lval = 0 then
|
||||
if op^.left^.opcode in
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt]
|
||||
[pc_and,pc_ior,pc_neq,pc_equ,pc_geq,pc_leq,pc_les,pc_grt,pc_not]
|
||||
then begin
|
||||
opv := op^.left;
|
||||
opv^.next := op^.next;
|
||||
|
Loading…
Reference in New Issue
Block a user