xref: /dflybsd-src/contrib/gcc-8.0/gcc/ifcvt.h (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* If-conversion header file.
2*38fd1498Szrj    Copyright (C) 2014-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj    This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj    GCC is free software; you can redistribute it and/or modify it
7*38fd1498Szrj    under the terms of the GNU General Public License as published by
8*38fd1498Szrj    the Free Software Foundation; either version 3, or (at your option)
9*38fd1498Szrj    any later version.
10*38fd1498Szrj 
11*38fd1498Szrj    GCC is distributed in the hope that it will be useful, but WITHOUT
12*38fd1498Szrj    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13*38fd1498Szrj    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14*38fd1498Szrj    License for more details.
15*38fd1498Szrj 
16*38fd1498Szrj    You should have received a copy of the GNU General Public License
17*38fd1498Szrj    along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj    <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_IFCVT_H
21*38fd1498Szrj #define GCC_IFCVT_H
22*38fd1498Szrj 
23*38fd1498Szrj /* Structure to group all of the information to process IF-THEN and
24*38fd1498Szrj    IF-THEN-ELSE blocks for the conditional execution support.  */
25*38fd1498Szrj 
26*38fd1498Szrj struct ce_if_block
27*38fd1498Szrj {
28*38fd1498Szrj   basic_block test_bb;			/* First test block.  */
29*38fd1498Szrj   basic_block then_bb;			/* THEN block.  */
30*38fd1498Szrj   basic_block else_bb;			/* ELSE block or NULL.  */
31*38fd1498Szrj   basic_block join_bb;			/* Join THEN/ELSE blocks.  */
32*38fd1498Szrj   basic_block last_test_bb;		/* Last bb to hold && or || tests.  */
33*38fd1498Szrj   int num_multiple_test_blocks;		/* # of && and || basic blocks.  */
34*38fd1498Szrj   int num_and_and_blocks;		/* # of && blocks.  */
35*38fd1498Szrj   int num_or_or_blocks;			/* # of || blocks.  */
36*38fd1498Szrj   int num_multiple_test_insns;		/* # of insns in && and || blocks.  */
37*38fd1498Szrj   int and_and_p;			/* Complex test is &&.  */
38*38fd1498Szrj   int num_then_insns;			/* # of insns in THEN block.  */
39*38fd1498Szrj   int num_else_insns;			/* # of insns in ELSE block.  */
40*38fd1498Szrj   int pass;				/* Pass number.  */
41*38fd1498Szrj };
42*38fd1498Szrj 
43*38fd1498Szrj /* Used by noce_process_if_block to communicate with its subroutines.
44*38fd1498Szrj 
45*38fd1498Szrj    The subroutines know that A and B may be evaluated freely.  They
46*38fd1498Szrj    know that X is a register.  They should insert new instructions
47*38fd1498Szrj    before cond_earliest.  */
48*38fd1498Szrj 
49*38fd1498Szrj struct noce_if_info
50*38fd1498Szrj {
51*38fd1498Szrj   /* The basic blocks that make up the IF-THEN-{ELSE-,}JOIN block.  */
52*38fd1498Szrj   basic_block test_bb, then_bb, else_bb, join_bb;
53*38fd1498Szrj 
54*38fd1498Szrj   /* The jump that ends TEST_BB.  */
55*38fd1498Szrj   rtx_insn *jump;
56*38fd1498Szrj 
57*38fd1498Szrj   /* The jump condition.  */
58*38fd1498Szrj   rtx cond;
59*38fd1498Szrj 
60*38fd1498Szrj   /* Reversed jump condition.  */
61*38fd1498Szrj   rtx rev_cond;
62*38fd1498Szrj 
63*38fd1498Szrj   /* New insns should be inserted before this one.  */
64*38fd1498Szrj   rtx_insn *cond_earliest;
65*38fd1498Szrj 
66*38fd1498Szrj   /* Insns in the THEN and ELSE block.  There is always just this
67*38fd1498Szrj      one insns in those blocks.  The insns are single_set insns.
68*38fd1498Szrj      If there was no ELSE block, INSN_B is the last insn before
69*38fd1498Szrj      COND_EARLIEST, or NULL_RTX.  In the former case, the insn
70*38fd1498Szrj      operands are still valid, as if INSN_B was moved down below
71*38fd1498Szrj      the jump.  */
72*38fd1498Szrj   rtx_insn *insn_a, *insn_b;
73*38fd1498Szrj 
74*38fd1498Szrj   /* The SET_SRC of INSN_A and INSN_B.  */
75*38fd1498Szrj   rtx a, b;
76*38fd1498Szrj 
77*38fd1498Szrj   /* The SET_DEST of INSN_A.  */
78*38fd1498Szrj   rtx x;
79*38fd1498Szrj 
80*38fd1498Szrj   /* The original set destination that the THEN and ELSE basic blocks finally
81*38fd1498Szrj      write their result to.  */
82*38fd1498Szrj   rtx orig_x;
83*38fd1498Szrj   /* True if this if block is not canonical.  In the canonical form of
84*38fd1498Szrj      if blocks, the THEN_BB is the block reached via the fallthru edge
85*38fd1498Szrj      from TEST_BB.  For the noce transformations, we allow the symmetric
86*38fd1498Szrj      form as well.  */
87*38fd1498Szrj   bool then_else_reversed;
88*38fd1498Szrj 
89*38fd1498Szrj   /* True if the contents of then_bb and else_bb are a
90*38fd1498Szrj      simple single set instruction.  */
91*38fd1498Szrj   bool then_simple;
92*38fd1498Szrj   bool else_simple;
93*38fd1498Szrj 
94*38fd1498Szrj   /* True if we're optimisizing the control block for speed, false if
95*38fd1498Szrj      we're optimizing for size.  */
96*38fd1498Szrj   bool speed_p;
97*38fd1498Szrj 
98*38fd1498Szrj   /* An estimate of the original costs.  When optimizing for size, this is the
99*38fd1498Szrj      combined cost of COND, JUMP and the costs for THEN_BB and ELSE_BB.
100*38fd1498Szrj      When optimizing for speed, we use the costs of COND plus the minimum of
101*38fd1498Szrj      the costs for THEN_BB and ELSE_BB, as computed in the next field.  */
102*38fd1498Szrj   unsigned int original_cost;
103*38fd1498Szrj 
104*38fd1498Szrj   /* Maximum permissible cost for the unconditional sequence we should
105*38fd1498Szrj      generate to replace this branch.  */
106*38fd1498Szrj   unsigned int max_seq_cost;
107*38fd1498Szrj 
108*38fd1498Szrj   /* The name of the noce transform that succeeded in if-converting
109*38fd1498Szrj      this structure.  Used for debugging.  */
110*38fd1498Szrj   const char *transform_name;
111*38fd1498Szrj };
112*38fd1498Szrj 
113*38fd1498Szrj #endif /* GCC_IFCVT_H */
114