Fix probabilities for jump table (PR tree-optimization/86702).
[official-gcc.git] / gcc / tree-switch-conversion.h
blobaf2f47a07e69998fb9f43308b8bed671892753de
1 /* Tree switch conversion for GNU compiler.
2 Copyright (C) 2017 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
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/>. */
20 #ifndef TREE_SWITCH_CONVERSION_H
21 #define TREE_SWITCH_CONVERSION_H
23 namespace tree_switch_conversion {
25 /* Type of cluster. */
27 enum cluster_type
29 SIMPLE_CASE,
30 JUMP_TABLE,
31 BIT_TEST
34 #define PRINT_CASE(f,c) print_generic_expr (f, c)
36 /* Abstract base class for representing a cluster of cases.
38 Here is the inheritance hierarachy, and the enum_cluster_type
39 values for the concrete subclasses:
41 cluster
42 |-simple_cluster (SIMPLE_CASE)
43 `-group_cluster
44 |-jump_table_cluster (JUMP_TABLE)
45 `-bit_test_cluster (BIT_TEST). */
47 struct cluster
49 /* Constructor. */
50 cluster (tree case_label_expr, basic_block case_bb, profile_probability prob,
51 profile_probability subtree_prob);
53 /* Destructor. */
54 virtual ~cluster ()
57 /* Return type. */
58 virtual cluster_type get_type () = 0;
60 /* Get low value covered by a cluster. */
61 virtual tree get_low () = 0;
63 /* Get high value covered by a cluster. */
64 virtual tree get_high () = 0;
66 /* Debug content of a cluster. */
67 virtual void debug () = 0;
69 /* Dump content of a cluster. */
70 virtual void dump (FILE *f, bool details = false) = 0;
72 /* Emit GIMPLE code to handle the cluster. */
73 virtual void emit (tree, tree, tree, basic_block) = 0;
75 /* Return range of a cluster. If value would overflow in type of LOW,
76 then return 0. */
77 static unsigned HOST_WIDE_INT get_range (tree low, tree high)
79 tree r = fold_build2 (MINUS_EXPR, TREE_TYPE (low), high, low);
80 if (!tree_fits_uhwi_p (r))
81 return 0;
83 return tree_to_uhwi (r) + 1;
86 /* Case label. */
87 tree m_case_label_expr;
89 /* Basic block of the case. */
90 basic_block m_case_bb;
92 /* Probability of taking this cluster. */
93 profile_probability m_prob;
95 /* Probability of reaching subtree rooted at this node. */
96 profile_probability m_subtree_prob;
98 protected:
99 /* Default constructor. */
100 cluster () {}
103 cluster::cluster (tree case_label_expr, basic_block case_bb,
104 profile_probability prob, profile_probability subtree_prob):
105 m_case_label_expr (case_label_expr), m_case_bb (case_bb), m_prob (prob),
106 m_subtree_prob (subtree_prob)
110 /* Subclass of cluster representing a simple contiguous range
111 from [low..high]. */
113 struct simple_cluster: public cluster
115 /* Constructor. */
116 simple_cluster (tree low, tree high, tree case_label_expr,
117 basic_block case_bb, profile_probability prob);
119 /* Destructor. */
120 ~simple_cluster ()
123 cluster_type
124 get_type ()
126 return SIMPLE_CASE;
129 tree
130 get_low ()
132 return m_low;
135 tree
136 get_high ()
138 return m_high;
141 void
142 debug ()
144 dump (stderr);
147 void
148 dump (FILE *f, bool details ATTRIBUTE_UNUSED = false)
150 PRINT_CASE (f, get_low ());
151 if (get_low () != get_high ())
153 fprintf (f, "-");
154 PRINT_CASE (f, get_high ());
156 fprintf (f, " ");
159 void emit (tree, tree, tree, basic_block)
161 gcc_unreachable ();
164 /* Low value of the case. */
165 tree m_low;
167 /* High value of the case. */
168 tree m_high;
170 /* True if case is a range. */
171 bool m_range_p;
174 simple_cluster::simple_cluster (tree low, tree high, tree case_label_expr,
175 basic_block case_bb, profile_probability prob):
176 cluster (case_label_expr, case_bb, prob, prob),
177 m_low (low), m_high (high)
179 m_range_p = m_high != NULL;
180 if (m_high == NULL)
181 m_high = m_low;
184 /* Abstract subclass of jump table and bit test cluster,
185 handling a collection of simple_cluster instances. */
187 struct group_cluster: public cluster
189 /* Constructor. */
190 group_cluster (vec<cluster *> &clusters, unsigned start, unsigned end);
192 /* Destructor. */
193 ~group_cluster ();
195 tree
196 get_low ()
198 return m_cases[0]->get_low ();
201 tree
202 get_high ()
204 return m_cases[m_cases.length () - 1]->get_high ();
207 void
208 debug ()
210 dump (stderr);
213 void dump (FILE *f, bool details = false);
215 /* List of simple clusters handled by the group. */
216 vec<simple_cluster *> m_cases;
219 /* Concrete subclass of group_cluster representing a collection
220 of cases to be implemented as a jump table.
221 The "emit" vfunc gernerates a nested switch statement which
222 is later lowered to a jump table. */
224 struct jump_table_cluster: public group_cluster
226 /* Constructor. */
227 jump_table_cluster (vec<cluster *> &clusters, unsigned start, unsigned end)
228 : group_cluster (clusters, start, end)
231 cluster_type
232 get_type ()
234 return JUMP_TABLE;
237 void emit (tree index_expr, tree index_type,
238 tree default_label_expr, basic_block default_bb);
240 /* Find jump tables of given CLUSTERS, where all members of the vector
241 are of type simple_cluster. New clusters are returned. */
242 static vec<cluster *> find_jump_tables (vec<cluster *> &clusters);
244 /* Return true when cluster starting at START and ending at END (inclusive)
245 can build a jump-table. */
246 static bool can_be_handled (const vec<cluster *> &clusters, unsigned start,
247 unsigned end);
249 /* Return true if cluster starting at START and ending at END (inclusive)
250 is profitable transformation. */
251 static bool is_beneficial (const vec<cluster *> &clusters, unsigned start,
252 unsigned end);
254 /* Return the smallest number of different values for which it is best
255 to use a jump-table instead of a tree of conditional branches. */
256 static inline unsigned int case_values_threshold (void);
258 /* Return whether jump table expansion is allowed. */
259 static bool is_enabled (void);
261 /* Max growth ratio for code that is optimized for size. */
262 static const unsigned HOST_WIDE_INT max_ratio_for_size = 3;
264 /* Max growth ratio for code that is optimized for speed. */
265 static const unsigned HOST_WIDE_INT max_ratio_for_speed = 8;
268 /* A GIMPLE switch statement can be expanded to a short sequence of bit-wise
269 comparisons. "switch(x)" is converted into "if ((1 << (x-MINVAL)) & CST)"
270 where CST and MINVAL are integer constants. This is better than a series
271 of compare-and-banch insns in some cases, e.g. we can implement:
273 if ((x==4) || (x==6) || (x==9) || (x==11))
275 as a single bit test:
277 if ((1<<x) & ((1<<4)|(1<<6)|(1<<9)|(1<<11)))
279 This transformation is only applied if the number of case targets is small,
280 if CST constains at least 3 bits, and "1 << x" is cheap. The bit tests are
281 performed in "word_mode".
283 The following example shows the code the transformation generates:
285 int bar(int x)
287 switch (x)
289 case '0': case '1': case '2': case '3': case '4':
290 case '5': case '6': case '7': case '8': case '9':
291 case 'A': case 'B': case 'C': case 'D': case 'E':
292 case 'F':
293 return 1;
295 return 0;
300 bar (int x)
302 tmp1 = x - 48;
303 if (tmp1 > (70 - 48)) goto L2;
304 tmp2 = 1 << tmp1;
305 tmp3 = 0b11111100000001111111111;
306 if ((tmp2 & tmp3) != 0) goto L1 ; else goto L2;
308 return 1;
310 return 0;
313 TODO: There are still some improvements to this transformation that could
314 be implemented:
316 * A narrower mode than word_mode could be used if that is cheaper, e.g.
317 for x86_64 where a narrower-mode shift may result in smaller code.
319 * The compounded constant could be shifted rather than the one. The
320 test would be either on the sign bit or on the least significant bit,
321 depending on the direction of the shift. On some machines, the test
322 for the branch would be free if the bit to test is already set by the
323 shift operation.
325 This transformation was contributed by Roger Sayle, see this e-mail:
326 http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01950.html
329 struct bit_test_cluster: public group_cluster
331 /* Constructor. */
332 bit_test_cluster (vec<cluster *> &clusters, unsigned start, unsigned end)
333 :group_cluster (clusters, start, end)
336 cluster_type
337 get_type ()
339 return BIT_TEST;
342 /* Expand a switch statement by a short sequence of bit-wise
343 comparisons. "switch(x)" is effectively converted into
344 "if ((1 << (x-MINVAL)) & CST)" where CST and MINVAL are
345 integer constants.
347 INDEX_EXPR is the value being switched on.
349 MINVAL is the lowest case value of in the case nodes,
350 and RANGE is highest value minus MINVAL. MINVAL and RANGE
351 are not guaranteed to be of the same type as INDEX_EXPR
352 (the gimplifier doesn't change the type of case label values,
353 and MINVAL and RANGE are derived from those values).
354 MAXVAL is MINVAL + RANGE.
356 There *MUST* be max_case_bit_tests or less unique case
357 node targets. */
358 void emit (tree index_expr, tree index_type,
359 tree default_label_expr, basic_block default_bb);
361 /* Find bit tests of given CLUSTERS, where all members of the vector
362 are of type simple_cluster. New clusters are returned. */
363 static vec<cluster *> find_bit_tests (vec<cluster *> &clusters);
365 /* Return true when RANGE of case values with UNIQ labels
366 can build a bit test. */
367 static bool can_be_handled (unsigned HOST_WIDE_INT range, unsigned uniq);
369 /* Return true when cluster starting at START and ending at END (inclusive)
370 can build a bit test. */
371 static bool can_be_handled (const vec<cluster *> &clusters, unsigned start,
372 unsigned end);
374 /* Return true when COUNT of cases of UNIQ labels is beneficial for bit test
375 transformation. */
376 static bool is_beneficial (unsigned count, unsigned uniq);
378 /* Return true if cluster starting at START and ending at END (inclusive)
379 is profitable transformation. */
380 static bool is_beneficial (const vec<cluster *> &clusters, unsigned start,
381 unsigned end);
383 /* Split the basic block at the statement pointed to by GSIP, and insert
384 a branch to the target basic block of E_TRUE conditional on tree
385 expression COND.
387 It is assumed that there is already an edge from the to-be-split
388 basic block to E_TRUE->dest block. This edge is removed, and the
389 profile information on the edge is re-used for the new conditional
390 jump.
392 The CFG is updated. The dominator tree will not be valid after
393 this transformation, but the immediate dominators are updated if
394 UPDATE_DOMINATORS is true.
396 Returns the newly created basic block. */
397 static basic_block hoist_edge_and_branch_if_true (gimple_stmt_iterator *gsip,
398 tree cond,
399 basic_block case_bb);
401 /* Maximum number of different basic blocks that can be handled by
402 a bit test. */
403 static const int m_max_case_bit_tests = 3;
406 /* Helper struct to find minimal clusters. */
408 struct min_cluster_item
410 /* Constructor. */
411 min_cluster_item (unsigned count, unsigned start, unsigned non_jt_cases):
412 m_count (count), m_start (start), m_non_jt_cases (non_jt_cases)
415 /* Count of clusters. */
416 unsigned m_count;
418 /* Index where is cluster boundary. */
419 unsigned m_start;
421 /* Total number of cases that will not be in a jump table. */
422 unsigned m_non_jt_cases;
425 /* Helper struct to represent switch decision tree. */
427 struct case_tree_node
429 /* Empty Constructor. */
430 case_tree_node ();
432 /* Left son in binary tree. */
433 case_tree_node *m_left;
435 /* Right son in binary tree; also node chain. */
436 case_tree_node *m_right;
438 /* Parent of node in binary tree. */
439 case_tree_node *m_parent;
441 /* Cluster represented by this tree node. */
442 cluster *m_c;
445 inline
446 case_tree_node::case_tree_node ():
447 m_left (NULL), m_right (NULL), m_parent (NULL), m_c (NULL)
451 unsigned int
452 jump_table_cluster::case_values_threshold (void)
454 unsigned int threshold = PARAM_VALUE (PARAM_CASE_VALUES_THRESHOLD);
456 if (threshold == 0)
457 threshold = targetm.case_values_threshold ();
459 return threshold;
462 /* Return whether jump table expansion is allowed. */
463 bool jump_table_cluster::is_enabled (void)
465 /* If neither casesi or tablejump is available, or flag_jump_tables
466 over-ruled us, we really have no choice. */
467 if (!targetm.have_casesi () && !targetm.have_tablejump ())
468 return false;
469 if (!flag_jump_tables)
470 return false;
471 #ifndef ASM_OUTPUT_ADDR_DIFF_ELT
472 if (flag_pic)
473 return false;
474 #endif
476 return true;
479 /* A case_bit_test represents a set of case nodes that may be
480 selected from using a bit-wise comparison. HI and LO hold
481 the integer to be tested against, TARGET_EDGE contains the
482 edge to the basic block to jump to upon success and BITS
483 counts the number of case nodes handled by this test,
484 typically the number of bits set in HI:LO. The LABEL field
485 is used to quickly identify all cases in this set without
486 looking at label_to_block for every case label. */
488 struct case_bit_test
490 wide_int mask;
491 basic_block target_bb;
492 tree label;
493 int bits;
495 /* Comparison function for qsort to order bit tests by decreasing
496 probability of execution. */
497 static int cmp (const void *p1, const void *p2);
500 struct switch_decision_tree
502 /* Constructor. */
503 switch_decision_tree (gswitch *swtch): m_switch (swtch), m_phi_mapping (),
504 m_case_bbs (), m_case_node_pool ("struct case_node pool"),
505 m_case_list (NULL)
509 /* Analyze switch statement and return true when the statement is expanded
510 as decision tree. */
511 bool analyze_switch_statement ();
513 /* Attempt to expand CLUSTERS as a decision tree. Return true when
514 expanded. */
515 bool try_switch_expansion (vec<cluster *> &clusters);
516 /* Compute the number of case labels that correspond to each outgoing edge of
517 switch statement. Record this information in the aux field of the edge.
519 void compute_cases_per_edge ();
521 /* Before switch transformation, record all SSA_NAMEs defined in switch BB
522 and used in a label basic block. */
523 void record_phi_operand_mapping ();
525 /* Append new operands to PHI statements that were introduced due to
526 addition of new edges to case labels. */
527 void fix_phi_operands_for_edges ();
529 /* Generate a decision tree, switching on INDEX_EXPR and jumping to
530 one of the labels in CASE_LIST or to the DEFAULT_LABEL.
532 We generate a binary decision tree to select the appropriate target
533 code. */
534 void emit (basic_block bb, tree index_expr,
535 profile_probability default_prob, tree index_type);
537 /* Emit step-by-step code to select a case for the value of INDEX.
538 The thus generated decision tree follows the form of the
539 case-node binary tree NODE, whose nodes represent test conditions.
540 DEFAULT_PROB is probability of cases leading to default BB.
541 INDEX_TYPE is the type of the index of the switch. */
542 basic_block emit_case_nodes (basic_block bb, tree index,
543 case_tree_node *node,
544 profile_probability default_prob,
545 tree index_type);
547 /* Take an ordered list of case nodes
548 and transform them into a near optimal binary tree,
549 on the assumption that any target code selection value is as
550 likely as any other.
552 The transformation is performed by splitting the ordered
553 list into two equal sections plus a pivot. The parts are
554 then attached to the pivot as left and right branches. Each
555 branch is then transformed recursively. */
556 static void balance_case_nodes (case_tree_node **head,
557 case_tree_node *parent);
559 /* Dump ROOT, a list or tree of case nodes, to file F. */
560 static void dump_case_nodes (FILE *f, case_tree_node *root, int indent_step,
561 int indent_level);
563 /* Add an unconditional jump to CASE_BB that happens in basic block BB. */
564 static void emit_jump (basic_block bb, basic_block case_bb);
566 /* Generate code to compare OP0 with OP1 so that the condition codes are
567 set and to jump to LABEL_BB if the condition is true.
568 COMPARISON is the GIMPLE comparison (EQ, NE, GT, etc.).
569 PROB is the probability of jumping to LABEL_BB. */
570 static basic_block emit_cmp_and_jump_insns (basic_block bb, tree op0,
571 tree op1, tree_code comparison,
572 basic_block label_bb,
573 profile_probability prob);
575 /* Reset the aux field of all outgoing edges of switch basic block. */
576 static inline void reset_out_edges_aux (gswitch *swtch);
578 /* Switch statement. */
579 gswitch *m_switch;
581 /* Map of PHI nodes that have to be fixed after expansion. */
582 hash_map<tree, tree> m_phi_mapping;
584 /* List of basic blocks that belong to labels of the switch. */
585 auto_vec<basic_block> m_case_bbs;
587 /* Basic block with default label. */
588 basic_block m_default_bb;
590 /* A pool for case nodes. */
591 object_allocator<case_tree_node> m_case_node_pool;
593 /* Balanced tree of case nodes. */
594 case_tree_node *m_case_list;
598 Switch initialization conversion
600 The following pass changes simple initializations of scalars in a switch
601 statement into initializations from a static array. Obviously, the values
602 must be constant and known at compile time and a default branch must be
603 provided. For example, the following code:
605 int a,b;
607 switch (argc)
609 case 1:
610 case 2:
611 a_1 = 8;
612 b_1 = 6;
613 break;
614 case 3:
615 a_2 = 9;
616 b_2 = 5;
617 break;
618 case 12:
619 a_3 = 10;
620 b_3 = 4;
621 break;
622 default:
623 a_4 = 16;
624 b_4 = 1;
625 break;
627 a_5 = PHI <a_1, a_2, a_3, a_4>
628 b_5 = PHI <b_1, b_2, b_3, b_4>
631 is changed into:
633 static const int = CSWTCH01[] = {6, 6, 5, 1, 1, 1, 1, 1, 1, 1, 1, 4};
634 static const int = CSWTCH02[] = {8, 8, 9, 16, 16, 16, 16, 16, 16, 16,
635 16, 16, 10};
637 if (((unsigned) argc) - 1 < 11)
639 a_6 = CSWTCH02[argc - 1];
640 b_6 = CSWTCH01[argc - 1];
642 else
644 a_7 = 16;
645 b_7 = 1;
647 a_5 = PHI <a_6, a_7>
648 b_b = PHI <b_6, b_7>
650 There are further constraints. Specifically, the range of values across all
651 case labels must not be bigger than SWITCH_CONVERSION_BRANCH_RATIO (default
652 eight) times the number of the actual switch branches.
654 This transformation was contributed by Martin Jambor, see this e-mail:
655 http://gcc.gnu.org/ml/gcc-patches/2008-07/msg00011.html */
657 /* The main structure of the pass. */
658 struct switch_conversion
660 /* Constructor. */
661 switch_conversion ();
663 /* Destructor. */
664 ~switch_conversion ();
666 /* The following function is invoked on every switch statement (the current
667 one is given in SWTCH) and runs the individual phases of switch
668 conversion on it one after another until one fails or the conversion
669 is completed. On success, NULL is in m_reason, otherwise points
670 to a string with the reason why the conversion failed. */
671 void expand (gswitch *swtch);
673 /* Collection information about SWTCH statement. */
674 void collect (gswitch *swtch);
676 /* Checks whether the range given by individual case statements of the switch
677 switch statement isn't too big and whether the number of branches actually
678 satisfies the size of the new array. */
679 bool check_range ();
681 /* Checks whether all but the final BB basic blocks are empty. */
682 bool check_all_empty_except_final ();
684 /* This function checks whether all required values in phi nodes in final_bb
685 are constants. Required values are those that correspond to a basic block
686 which is a part of the examined switch statement. It returns true if the
687 phi nodes are OK, otherwise false. */
688 bool check_final_bb ();
690 /* The following function allocates default_values, target_{in,out}_names and
691 constructors arrays. The last one is also populated with pointers to
692 vectors that will become constructors of new arrays. */
693 void create_temp_arrays ();
695 /* Populate the array of default values in the order of phi nodes.
696 DEFAULT_CASE is the CASE_LABEL_EXPR for the default switch branch
697 if the range is non-contiguous or the default case has standard
698 structure, otherwise it is the first non-default case instead. */
699 void gather_default_values (tree default_case);
701 /* The following function populates the vectors in the constructors array with
702 future contents of the static arrays. The vectors are populated in the
703 order of phi nodes. */
704 void build_constructors ();
706 /* If all values in the constructor vector are the same, return the value.
707 Otherwise return NULL_TREE. Not supposed to be called for empty
708 vectors. */
709 tree contains_same_values_p (vec<constructor_elt, va_gc> *vec);
711 /* Return type which should be used for array elements, either TYPE's
712 main variant or, for integral types, some smaller integral type
713 that can still hold all the constants. */
714 tree array_value_type (tree type, int num);
716 /* Create an appropriate array type and declaration and assemble a static
717 array variable. Also create a load statement that initializes
718 the variable in question with a value from the static array. SWTCH is
719 the switch statement being converted, NUM is the index to
720 arrays of constructors, default values and target SSA names
721 for this particular array. ARR_INDEX_TYPE is the type of the index
722 of the new array, PHI is the phi node of the final BB that corresponds
723 to the value that will be loaded from the created array. TIDX
724 is an ssa name of a temporary variable holding the index for loads from the
725 new array. */
726 void build_one_array (int num, tree arr_index_type,
727 gphi *phi, tree tidx);
729 /* Builds and initializes static arrays initialized with values gathered from
730 the switch statement. Also creates statements that load values from
731 them. */
732 void build_arrays ();
734 /* Generates and appropriately inserts loads of default values at the position
735 given by GSI. Returns the last inserted statement. */
736 gassign *gen_def_assigns (gimple_stmt_iterator *gsi);
738 /* Deletes the unused bbs and edges that now contain the switch statement and
739 its empty branch bbs. BBD is the now dead BB containing
740 the original switch statement, FINAL is the last BB of the converted
741 switch statement (in terms of succession). */
742 void prune_bbs (basic_block bbd, basic_block final, basic_block default_bb);
744 /* Add values to phi nodes in final_bb for the two new edges. E1F is the edge
745 from the basic block loading values from an array and E2F from the basic
746 block loading default values. BBF is the last switch basic block (see the
747 bbf description in the comment below). */
748 void fix_phi_nodes (edge e1f, edge e2f, basic_block bbf);
750 /* Creates a check whether the switch expression value actually falls into the
751 range given by all the cases. If it does not, the temporaries are loaded
752 with default values instead. */
753 void gen_inbound_check ();
755 /* Switch statement for which switch conversion takes place. */
756 gswitch *m_switch;
758 /* The expression used to decide the switch branch. */
759 tree m_index_expr;
761 /* The following integer constants store the minimum and maximum value
762 covered by the case labels. */
763 tree m_range_min;
764 tree m_range_max;
766 /* The difference between the above two numbers. Stored here because it
767 is used in all the conversion heuristics, as well as for some of the
768 transformation, and it is expensive to re-compute it all the time. */
769 tree m_range_size;
771 /* Basic block that contains the actual GIMPLE_SWITCH. */
772 basic_block m_switch_bb;
774 /* Basic block that is the target of the default case. */
775 basic_block m_default_bb;
777 /* The single successor block of all branches out of the GIMPLE_SWITCH,
778 if such a block exists. Otherwise NULL. */
779 basic_block m_final_bb;
781 /* The probability of the default edge in the replaced switch. */
782 profile_probability m_default_prob;
784 /* The count of the default edge in the replaced switch. */
785 profile_count m_default_count;
787 /* Combined count of all other (non-default) edges in the replaced switch. */
788 profile_count m_other_count;
790 /* Number of phi nodes in the final bb (that we'll be replacing). */
791 int m_phi_count;
793 /* Constructors of new static arrays. */
794 vec<constructor_elt, va_gc> **m_constructors;
796 /* Array of default values, in the same order as phi nodes. */
797 tree *m_default_values;
799 /* Array of ssa names that are initialized with a value from a new static
800 array. */
801 tree *m_target_inbound_names;
803 /* Array of ssa names that are initialized with the default value if the
804 switch expression is out of range. */
805 tree *m_target_outbound_names;
807 /* VOP SSA_NAME. */
808 tree m_target_vop;
810 /* The first load statement that loads a temporary from a new static array.
812 gimple *m_arr_ref_first;
814 /* The last load statement that loads a temporary from a new static array. */
815 gimple *m_arr_ref_last;
817 /* String reason why the case wasn't a good candidate that is written to the
818 dump file, if there is one. */
819 const char *m_reason;
821 /* True if default case is not used for any value between range_min and
822 range_max inclusive. */
823 bool m_contiguous_range;
825 /* True if default case does not have the required shape for other case
826 labels. */
827 bool m_default_case_nonstandard;
829 /* Number of uniq labels for non-default edges. */
830 unsigned int m_uniq;
832 /* Count is number of non-default edges. */
833 unsigned int m_count;
835 /* True if CFG has been changed. */
836 bool m_cfg_altered;
839 void
840 switch_decision_tree::reset_out_edges_aux (gswitch *swtch)
842 basic_block bb = gimple_bb (swtch);
843 edge e;
844 edge_iterator ei;
845 FOR_EACH_EDGE (e, ei, bb->succs)
846 e->aux = (void *) 0;
849 } // tree_switch_conversion namespace
851 #endif // TREE_SWITCH_CONVERSION_H