1 /* Data flow functions for trees.
2 Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3 Contributed by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "coretypes.h"
27 #include "pointer-set.h"
31 #include "hard-reg-set.h"
32 #include "basic-block.h"
38 #include "langhooks.h"
41 #include "diagnostic.h"
42 #include "tree-dump.h"
43 #include "tree-gimple.h"
44 #include "tree-flow.h"
45 #include "tree-inline.h"
46 #include "tree-pass.h"
51 /* Build and maintain data flow information for trees. */
53 /* Counters used to display DFA and SSA statistics. */
69 /* State information for find_vars_r. */
72 /* Hash table used to avoid adding the same variable more than once. */
77 /* Local functions. */
78 static void collect_dfa_stats (struct dfa_stats_d *);
79 static tree collect_dfa_stats_r (tree *, int *, void *);
80 static void add_immediate_use (tree, tree);
81 static tree find_vars_r (tree *, int *, void *);
82 static void add_referenced_var (tree, struct walk_state *);
83 static void compute_immediate_uses_for_phi (tree, bool (*)(tree));
84 static void compute_immediate_uses_for_stmt (tree, int, bool (*)(tree));
87 /* Global declarations. */
89 /* Array of all variables referenced in the function. */
90 varray_type referenced_vars;
93 /*---------------------------------------------------------------------------
94 Dataflow analysis (DFA) routines
95 ---------------------------------------------------------------------------*/
96 /* Find all the variables referenced in the function. This function
97 builds the global arrays REFERENCED_VARS and CALL_CLOBBERED_VARS.
99 Note that this function does not look for statement operands, it simply
100 determines what variables are referenced in the program and detects
101 various attributes for each variable used by alias analysis and the
105 find_referenced_vars (void)
109 block_stmt_iterator si;
110 struct walk_state walk_state;
112 cgraph_reset_static_var_maps ();
113 vars_found = htab_create (50, htab_hash_pointer, htab_eq_pointer, NULL);
114 memset (&walk_state, 0, sizeof (walk_state));
115 walk_state.vars_found = vars_found;
118 for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
120 tree *stmt_p = bsi_stmt_ptr (si);
121 walk_tree (stmt_p, find_vars_r, &walk_state, NULL);
124 htab_delete (vars_found);
127 struct tree_opt_pass pass_referenced_vars =
131 find_referenced_vars, /* execute */
134 0, /* static_pass_number */
136 PROP_gimple_leh | PROP_cfg, /* properties_required */
137 PROP_referenced_vars, /* properties_provided */
138 0, /* properties_destroyed */
139 0, /* todo_flags_start */
140 0, /* todo_flags_finish */
145 /* Compute immediate uses.
147 CALC_FOR is an optional function pointer which indicates whether
148 immediate uses information should be calculated for a given SSA
149 variable. If NULL, then information is computed for all
152 FLAGS is one of {TDFA_USE_OPS, TDFA_USE_VOPS}. It is used by
153 compute_immediate_uses_for_stmt to determine whether to look at
154 virtual and/or real operands while computing def-use chains. */
157 compute_immediate_uses (int flags, bool (*calc_for)(tree))
160 block_stmt_iterator si;
166 for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
168 if (is_gimple_reg (PHI_RESULT (phi)))
170 if (!(flags & TDFA_USE_OPS))
175 if (!(flags & TDFA_USE_VOPS))
179 compute_immediate_uses_for_phi (phi, calc_for);
182 for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
184 tree stmt = bsi_stmt (si);
185 get_stmt_operands (stmt);
186 compute_immediate_uses_for_stmt (stmt, flags, calc_for);
192 /* Invalidates dataflow information for a statement STMT. */
195 free_df_for_stmt (tree stmt)
199 if (TREE_CODE (stmt) == PHI_NODE)
203 stmt_ann_t ann = stmt_ann (stmt);
214 /* If we have a varray of immediate uses, then go ahead and release
216 if ((*df)->immediate_uses)
217 ggc_free ((*df)->immediate_uses);
219 /* Similarly for the main dataflow structure. */
225 /* Invalidate dataflow information for the whole function.
227 Note this only invalidates dataflow information on statements and
228 PHI nodes which are reachable.
230 A deleted statement may still have attached dataflow information
237 block_stmt_iterator si;
243 for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
244 free_df_for_stmt (phi);
246 for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
248 tree stmt = bsi_stmt (si);
249 free_df_for_stmt (stmt);
255 /* Helper for compute_immediate_uses. Check all the USE and/or VUSE
256 operands in phi node PHI and add a def-use edge between their
257 defining statement and PHI. CALC_FOR is as in
258 compute_immediate_uses.
260 PHI nodes are easy, we only need to look at their arguments. */
263 compute_immediate_uses_for_phi (tree phi, bool (*calc_for)(tree))
267 gcc_assert (TREE_CODE (phi) == PHI_NODE);
269 for (i = 0; i < PHI_NUM_ARGS (phi); i++)
271 tree arg = PHI_ARG_DEF (phi, i);
273 if (TREE_CODE (arg) == SSA_NAME && (!calc_for || calc_for (arg)))
275 tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (phi, i));
276 if (!IS_EMPTY_STMT (imm_rdef_stmt))
277 add_immediate_use (imm_rdef_stmt, phi);
283 /* Another helper for compute_immediate_uses. Depending on the value
284 of FLAGS, check all the USE and/or VUSE operands in STMT and add a
285 def-use edge between their defining statement and STMT. CALC_FOR
286 is as in compute_immediate_uses. */
289 compute_immediate_uses_for_stmt (tree stmt, int flags, bool (*calc_for)(tree))
294 /* PHI nodes are handled elsewhere. */
295 gcc_assert (TREE_CODE (stmt) != PHI_NODE);
297 /* Look at USE_OPS or VUSE_OPS according to FLAGS. */
298 if (flags & TDFA_USE_OPS)
300 FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
302 tree imm_stmt = SSA_NAME_DEF_STMT (use);
303 if (!IS_EMPTY_STMT (imm_stmt) && (!calc_for || calc_for (use)))
304 add_immediate_use (imm_stmt, stmt);
308 if (flags & TDFA_USE_VOPS)
310 FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_VIRTUAL_USES)
312 tree imm_rdef_stmt = SSA_NAME_DEF_STMT (use);
313 if (!IS_EMPTY_STMT (imm_rdef_stmt) && (!calc_for || calc_for (use)))
314 add_immediate_use (imm_rdef_stmt, stmt);
320 /* Add statement USE_STMT to the list of statements that use definitions
324 add_immediate_use (tree stmt, tree use_stmt)
326 struct dataflow_d **df;
328 if (TREE_CODE (stmt) == PHI_NODE)
332 stmt_ann_t ann = get_stmt_ann (stmt);
338 *df = ggc_alloc (sizeof (struct dataflow_d));
339 memset ((void *) *df, 0, sizeof (struct dataflow_d));
340 (*df)->uses[0] = use_stmt;
346 (*df)->uses[1] = use_stmt;
350 if ((*df)->immediate_uses == NULL)
351 VARRAY_TREE_INIT ((*df)->immediate_uses, 4, "immediate_uses");
353 VARRAY_PUSH_TREE ((*df)->immediate_uses, use_stmt);
357 /* If the immediate use of USE points to OLD, then redirect it to NEW. */
360 redirect_immediate_use (tree use, tree old, tree new)
362 tree imm_stmt = SSA_NAME_DEF_STMT (use);
363 struct dataflow_d *df = get_immediate_uses (imm_stmt);
364 unsigned int num_uses = num_immediate_uses (df);
367 for (i = 0; i < num_uses; i++)
369 if (immediate_use (df, i) == old)
371 if (i == 0 || i == 1)
374 VARRAY_TREE (df->immediate_uses, i - 2) = new;
380 /* Redirect all immediate uses for operands in OLD so that they point
381 to NEW. This routine should have no knowledge of how immediate
385 redirect_immediate_uses (tree old, tree new)
390 FOR_EACH_SSA_TREE_OPERAND (val, old, iter, SSA_OP_ALL_USES)
391 redirect_immediate_use (val, old, new);
395 /*---------------------------------------------------------------------------
397 ---------------------------------------------------------------------------*/
398 /* Create a new annotation for a _DECL node T. */
401 create_var_ann (tree t)
406 gcc_assert (DECL_P (t));
407 gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN);
409 ann = ggc_alloc (sizeof (*ann));
410 memset ((void *) ann, 0, sizeof (*ann));
412 ann->common.type = VAR_ANN;
414 t->common.ann = (tree_ann_t) ann;
420 /* Create a new annotation for a statement node T. */
423 create_stmt_ann (tree t)
427 gcc_assert (is_gimple_stmt (t));
428 gcc_assert (!t->common.ann || t->common.ann->common.type == STMT_ANN);
430 ann = ggc_alloc (sizeof (*ann));
431 memset ((void *) ann, 0, sizeof (*ann));
433 ann->common.type = STMT_ANN;
435 /* Since we just created the annotation, mark the statement modified. */
436 ann->modified = true;
438 t->common.ann = (tree_ann_t) ann;
444 /* Create a new annotation for a tree T. */
447 create_tree_ann (tree t)
452 gcc_assert (!t->common.ann || t->common.ann->common.type == TREE_ANN_COMMON);
454 ann = ggc_alloc (sizeof (*ann));
455 memset ((void *) ann, 0, sizeof (*ann));
457 ann->common.type = TREE_ANN_COMMON;
463 /* Build a temporary. Make sure and register it to be renamed. */
466 make_rename_temp (tree type, const char *prefix)
468 tree t = create_tmp_var (type, prefix);
471 add_referenced_tmp_var (t);
472 bitmap_set_bit (vars_to_rename, var_ann (t)->uid);
479 /*---------------------------------------------------------------------------
481 ---------------------------------------------------------------------------*/
482 /* Dump the list of all the referenced variables in the current function to
486 dump_referenced_vars (FILE *file)
490 fprintf (file, "\nReferenced variables in %s: %u\n\n",
491 get_name (current_function_decl), (unsigned) num_referenced_vars);
493 for (i = 0; i < num_referenced_vars; i++)
495 tree var = referenced_var (i);
496 fprintf (file, "Variable: ");
497 dump_variable (file, var);
498 fprintf (file, "\n");
503 /* Dump the list of all the referenced variables to stderr. */
506 debug_referenced_vars (void)
508 dump_referenced_vars (stderr);
512 /* Dump variable VAR and its may-aliases to FILE. */
515 dump_variable (FILE *file, tree var)
519 if (TREE_CODE (var) == SSA_NAME)
521 if (POINTER_TYPE_P (TREE_TYPE (var)))
522 dump_points_to_info_for (file, var);
523 var = SSA_NAME_VAR (var);
526 if (var == NULL_TREE)
528 fprintf (file, "<nil>");
532 print_generic_expr (file, var, dump_flags);
536 fprintf (file, ", UID %u", (unsigned) ann->uid);
538 fprintf (file, ", ");
539 print_generic_expr (file, TREE_TYPE (var), dump_flags);
541 if (ann->type_mem_tag)
543 fprintf (file, ", type memory tag: ");
544 print_generic_expr (file, ann->type_mem_tag, dump_flags);
547 if (ann->is_alias_tag)
548 fprintf (file, ", is an alias tag");
550 if (TREE_ADDRESSABLE (var))
551 fprintf (file, ", is addressable");
553 if (is_global_var (var))
554 fprintf (file, ", is global");
556 if (TREE_THIS_VOLATILE (var))
557 fprintf (file, ", is volatile");
559 if (is_call_clobbered (var))
560 fprintf (file, ", call clobbered");
562 if (ann->default_def)
564 fprintf (file, ", default def: ");
565 print_generic_expr (file, ann->default_def, dump_flags);
568 if (ann->may_aliases)
570 fprintf (file, ", may aliases: ");
571 dump_may_aliases_for (file, var);
574 fprintf (file, "\n");
578 /* Dump variable VAR and its may-aliases to stderr. */
581 debug_variable (tree var)
583 dump_variable (stderr, var);
587 /* Dump def-use edges on FILE. */
590 dump_immediate_uses (FILE *file)
593 block_stmt_iterator si;
595 = lang_hooks.decl_printable_name (current_function_decl, 2);
597 fprintf (file, "\nDef-use edges for function %s\n", funcname);
603 for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
604 dump_immediate_uses_for (file, phi);
606 for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
607 dump_immediate_uses_for (file, bsi_stmt (si));
610 fprintf (file, "\n");
614 /* Dump def-use edges on stderr. */
617 debug_immediate_uses (void)
619 dump_immediate_uses (stderr);
623 /* Dump all immediate uses for STMT on FILE. */
626 dump_immediate_uses_for (FILE *file, tree stmt)
628 dataflow_t df = get_immediate_uses (stmt);
629 int num_imm_uses = num_immediate_uses (df);
631 if (num_imm_uses > 0)
635 fprintf (file, "-> ");
636 print_generic_stmt (file, stmt, TDF_SLIM);
637 fprintf (file, "\n");
639 for (i = 0; i < num_imm_uses; i++)
641 fprintf (file, "\t");
642 print_generic_stmt (file, immediate_use (df, i), TDF_SLIM);
643 fprintf (file, "\n");
646 fprintf (file, "\n");
651 /* Dump immediate uses for STMT on stderr. */
654 debug_immediate_uses_for (tree stmt)
656 dump_immediate_uses_for (stderr, stmt);
660 /* Dump various DFA statistics to FILE. */
663 dump_dfa_stats (FILE *file)
665 struct dfa_stats_d dfa_stats;
667 unsigned long size, total = 0;
668 const char * const fmt_str = "%-30s%-13s%12s\n";
669 const char * const fmt_str_1 = "%-30s%13lu%11lu%c\n";
670 const char * const fmt_str_3 = "%-43s%11lu%c\n";
672 = lang_hooks.decl_printable_name (current_function_decl, 2);
674 collect_dfa_stats (&dfa_stats);
676 fprintf (file, "\nDFA Statistics for %s\n\n", funcname);
678 fprintf (file, "---------------------------------------------------------\n");
679 fprintf (file, fmt_str, "", " Number of ", "Memory");
680 fprintf (file, fmt_str, "", " instances ", "used ");
681 fprintf (file, "---------------------------------------------------------\n");
683 size = num_referenced_vars * sizeof (tree);
685 fprintf (file, fmt_str_1, "Referenced variables", num_referenced_vars,
686 SCALE (size), LABEL (size));
688 size = dfa_stats.num_stmt_anns * sizeof (struct stmt_ann_d);
690 fprintf (file, fmt_str_1, "Statements annotated", dfa_stats.num_stmt_anns,
691 SCALE (size), LABEL (size));
693 size = dfa_stats.num_var_anns * sizeof (struct var_ann_d);
695 fprintf (file, fmt_str_1, "Variables annotated", dfa_stats.num_var_anns,
696 SCALE (size), LABEL (size));
698 size = dfa_stats.num_uses * sizeof (tree *);
700 fprintf (file, fmt_str_1, "USE operands", dfa_stats.num_uses,
701 SCALE (size), LABEL (size));
703 size = dfa_stats.num_defs * sizeof (tree *);
705 fprintf (file, fmt_str_1, "DEF operands", dfa_stats.num_defs,
706 SCALE (size), LABEL (size));
708 size = dfa_stats.num_vuses * sizeof (tree *);
710 fprintf (file, fmt_str_1, "VUSE operands", dfa_stats.num_vuses,
711 SCALE (size), LABEL (size));
713 size = dfa_stats.num_v_may_defs * sizeof (tree *);
715 fprintf (file, fmt_str_1, "V_MAY_DEF operands", dfa_stats.num_v_may_defs,
716 SCALE (size), LABEL (size));
718 size = dfa_stats.num_v_must_defs * sizeof (tree *);
720 fprintf (file, fmt_str_1, "V_MUST_DEF operands", dfa_stats.num_v_must_defs,
721 SCALE (size), LABEL (size));
723 size = dfa_stats.num_phis * sizeof (struct tree_phi_node);
725 fprintf (file, fmt_str_1, "PHI nodes", dfa_stats.num_phis,
726 SCALE (size), LABEL (size));
728 size = dfa_stats.num_phi_args * sizeof (struct phi_arg_d);
730 fprintf (file, fmt_str_1, "PHI arguments", dfa_stats.num_phi_args,
731 SCALE (size), LABEL (size));
733 fprintf (file, "---------------------------------------------------------\n");
734 fprintf (file, fmt_str_3, "Total memory used by DFA/SSA data", SCALE (total),
736 fprintf (file, "---------------------------------------------------------\n");
737 fprintf (file, "\n");
739 if (dfa_stats.num_phis)
740 fprintf (file, "Average number of arguments per PHI node: %.1f (max: %d)\n",
741 (float) dfa_stats.num_phi_args / (float) dfa_stats.num_phis,
742 dfa_stats.max_num_phi_args);
744 fprintf (file, "\n");
748 /* Dump DFA statistics on stderr. */
751 debug_dfa_stats (void)
753 dump_dfa_stats (stderr);
757 /* Collect DFA statistics and store them in the structure pointed by
761 collect_dfa_stats (struct dfa_stats_d *dfa_stats_p)
763 struct pointer_set_t *pset;
765 block_stmt_iterator i;
767 gcc_assert (dfa_stats_p);
769 memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));
771 /* Walk all the trees in the function counting references. Start at
772 basic block 0, but don't stop at block boundaries. */
773 pset = pointer_set_create ();
775 for (i = bsi_start (BASIC_BLOCK (0)); !bsi_end_p (i); bsi_next (&i))
776 walk_tree (bsi_stmt_ptr (i), collect_dfa_stats_r, (void *) dfa_stats_p,
779 pointer_set_destroy (pset);
784 for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
786 dfa_stats_p->num_phis++;
787 dfa_stats_p->num_phi_args += PHI_NUM_ARGS (phi);
788 if (PHI_NUM_ARGS (phi) > dfa_stats_p->max_num_phi_args)
789 dfa_stats_p->max_num_phi_args = PHI_NUM_ARGS (phi);
795 /* Callback for walk_tree to collect DFA statistics for a tree and its
799 collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
803 struct dfa_stats_d *dfa_stats_p = (struct dfa_stats_d *)data;
807 switch (ann_type (t->common.ann))
811 stmt_ann_t ann = (stmt_ann_t) t->common.ann;
812 dfa_stats_p->num_stmt_anns++;
813 dfa_stats_p->num_defs += NUM_DEFS (DEF_OPS (ann));
814 dfa_stats_p->num_uses += NUM_USES (USE_OPS (ann));
815 dfa_stats_p->num_v_may_defs +=
816 NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann));
817 dfa_stats_p->num_vuses += NUM_VUSES (VUSE_OPS (ann));
818 dfa_stats_p->num_v_must_defs +=
819 NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann));
824 dfa_stats_p->num_var_anns++;
836 /*---------------------------------------------------------------------------
837 Miscellaneous helpers
838 ---------------------------------------------------------------------------*/
839 /* Callback for walk_tree. Used to collect variables referenced in
843 find_vars_r (tree *tp, int *walk_subtrees, void *data)
845 struct walk_state *walk_state = (struct walk_state *) data;
847 /* If T is a regular variable that the optimizers are interested
848 in, add it to the list of variables. */
850 add_referenced_var (*tp, walk_state);
852 /* Type, _DECL and constant nodes have no interesting children.
854 else if (IS_TYPE_OR_DECL_P (*tp) || CONSTANT_CLASS_P (*tp))
861 /* Add VAR to the list of dereferenced variables.
863 WALK_STATE contains a hash table used to avoid adding the same
864 variable more than once. Note that this function assumes that
865 VAR is a valid SSA variable. If WALK_STATE is NULL, no
866 duplicate checking is done. */
869 add_referenced_var (tree var, struct walk_state *walk_state)
874 v_ann = get_var_ann (var);
877 slot = htab_find_slot (walk_state->vars_found, (void *) var, INSERT);
881 if (slot == NULL || *slot == NULL)
883 /* This is the first time we find this variable, add it to the
884 REFERENCED_VARS array and annotate it with attributes that are
885 intrinsic to the variable. */
887 *slot = (void *) var;
888 v_ann->uid = num_referenced_vars;
889 VARRAY_PUSH_TREE (referenced_vars, var);
891 /* Global variables are always call-clobbered. */
892 if (is_global_var (var))
893 mark_call_clobbered (var);
895 /* Scan DECL_INITIAL for pointer variables as they may contain
896 address arithmetic referencing the address of other
898 if (DECL_INITIAL (var)
899 && POINTER_TYPE_P (TREE_TYPE (var)))
900 walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
905 /* Return the virtual variable associated to the non-scalar variable VAR. */
908 get_virtual_var (tree var)
912 if (TREE_CODE (var) == SSA_NAME)
913 var = SSA_NAME_VAR (var);
915 while (TREE_CODE (var) == REALPART_EXPR || TREE_CODE (var) == IMAGPART_EXPR
916 || handled_component_p (var))
917 var = TREE_OPERAND (var, 0);
919 /* Treating GIMPLE registers as virtual variables makes no sense.
920 Also complain if we couldn't extract a _DECL out of the original
922 gcc_assert (SSA_VAR_P (var));
923 gcc_assert (!is_gimple_reg (var));
928 /* Add a temporary variable to REFERENCED_VARS. This is similar to
929 add_referenced_var, but is used by passes that need to add new temps to
930 the REFERENCED_VARS array after the program has been scanned for
931 variables. The variable will just receive a new UID and be added
932 to the REFERENCED_VARS array without checking for duplicates. */
935 add_referenced_tmp_var (tree var)
937 add_referenced_var (var, NULL);
941 /* Add all the non-SSA variables found in STMT's operands to the bitmap
945 mark_new_vars_to_rename (tree stmt, bitmap vars_to_rename)
949 bitmap vars_in_vops_to_rename;
950 bool found_exposed_symbol = false;
951 int v_may_defs_before, v_may_defs_after;
952 int v_must_defs_before, v_must_defs_after;
954 vars_in_vops_to_rename = BITMAP_XMALLOC ();
956 /* Before re-scanning the statement for operands, mark the existing
957 virtual operands to be renamed again. We do this because when new
958 symbols are exposed, the virtual operands that were here before due to
959 aliasing will probably be removed by the call to get_stmt_operand.
960 Therefore, we need to flag them to be renamed beforehand.
962 We flag them in a separate bitmap because we don't really want to
963 rename them if there are not any newly exposed symbols in the
964 statement operands. */
965 v_may_defs_before = NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt));
966 v_must_defs_before = NUM_V_MUST_DEFS (STMT_V_MUST_DEF_OPS (stmt));
968 FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter,
969 SSA_OP_VMAYDEF | SSA_OP_VUSE | SSA_OP_VMUSTDEF)
972 val = SSA_NAME_VAR (val);
973 bitmap_set_bit (vars_in_vops_to_rename, var_ann (val)->uid);
976 /* Now force an operand re-scan on the statement and mark any newly
977 exposed variables. */
979 get_stmt_operands (stmt);
981 v_may_defs_after = NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt));
982 v_must_defs_after = NUM_V_MUST_DEFS (STMT_V_MUST_DEF_OPS (stmt));
984 FOR_EACH_SSA_TREE_OPERAND (val, stmt, iter, SSA_OP_ALL_OPERANDS)
988 found_exposed_symbol = true;
989 bitmap_set_bit (vars_to_rename, var_ann (val)->uid);
993 /* If we found any newly exposed symbols, or if there are fewer VDEF
994 operands in the statement, add the variables we had set in
995 VARS_IN_VOPS_TO_RENAME to VARS_TO_RENAME. We need to check for
996 vanishing VDEFs because in those cases, the names that were formerly
997 generated by this statement are not going to be available anymore. */
998 if (found_exposed_symbol
999 || v_may_defs_before > v_may_defs_after
1000 || v_must_defs_before > v_must_defs_after)
1001 bitmap_a_or_b (vars_to_rename, vars_to_rename, vars_in_vops_to_rename);
1003 BITMAP_XFREE (vars_in_vops_to_rename);
1006 /* Find all variables within the gimplified statement that were not previously
1007 visible to the function and add them to the referenced variables list. */
1010 find_new_referenced_vars_1 (tree *tp, int *walk_subtrees,
1011 void *data ATTRIBUTE_UNUSED)
1015 if (TREE_CODE (t) == VAR_DECL && !var_ann (t))
1016 add_referenced_tmp_var (t);
1018 if (IS_TYPE_OR_DECL_P (t))
1025 find_new_referenced_vars (tree *stmt_p)
1027 walk_tree (stmt_p, find_new_referenced_vars_1, NULL, NULL);