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