/* Data and Control Flow Analysis for Trees.
- Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
#define _TREE_FLOW_H 1
#include "bitmap.h"
-#include "hard-reg-set.h"
+#include "sbitmap.h"
#include "basic-block.h"
#include "hashtab.h"
#include "gimple.h"
#include "tree-ssa-alias.h"
+/* This structure is used to map a gimple statement to a label,
+ or list of labels to represent transaction restart. */
+
+struct GTY(()) tm_restart_node {
+ gimple stmt;
+ tree label_or_list;
+};
+
/* Gimple dataflow datastructure. All publicly available fields shall have
gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
fields should have gimple_set accessor. */
struct GTY(()) gimple_df {
- /* Array of all variables referenced in the function. */
- htab_t GTY((param_is (union tree_node))) referenced_vars;
-
/* A vector of all the noreturn calls passed to modify_stmt.
cleanup_control_flow uses it to detect cases where a mid-block
indirect call has been turned into a noreturn call. When this
struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
/* Free list of SSA_NAMEs. */
- tree free_ssanames;
+ VEC(tree,gc) *free_ssanames;
/* Hashtable holding definition for symbol. If this field is not NULL, it
means that the first reference to this variable in the function is a
for this variable with an empty defining statement. */
htab_t GTY((param_is (union tree_node))) default_defs;
- /* Symbols whose SSA form needs to be updated or created for the first
- time. */
- bitmap syms_to_rename;
+ /* True if there are any symbols that need to be renamed. */
+ unsigned int ssa_renaming_needed : 1;
+
+ /* True if all virtual operands need to be renamed. */
+ unsigned int rename_vops : 1;
/* True if the code is in ssa form. */
unsigned int in_ssa_p : 1;
+ /* True if IPA points-to information was computed for this function. */
+ unsigned int ipa_pta : 1;
+
struct ssa_operands ssa_operands;
+
+ /* Map gimple stmt to tree label (or list of labels) for transaction
+ restart and abort. */
+ htab_t GTY ((param_is (struct tm_restart_node))) tm_restart;
};
/* Accessors for internal use only. Generic code should use abstraction
#define SSANAMES(fun) (fun)->gimple_df->ssa_names
#define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
-#define SYMS_TO_RENAME(fun) (fun)->gimple_df->syms_to_rename
typedef struct
{
---------------------------------------------------------------------------*/
/* Aliasing information for SSA_NAMEs representing pointer variables. */
+
struct GTY(()) ptr_info_def
{
- /* The points-to solution, TBAA-pruned if the pointer is dereferenced. */
+ /* The points-to solution. */
struct pt_solution pt;
+
+ /* Alignment and misalignment of the pointer in bytes. Together
+ align and misalign specify low known bits of the pointer.
+ ptr & (align - 1) == misalign. */
+
+ /* When known, this is the power-of-two byte alignment of the object this
+ pointer points into. This is usually DECL_ALIGN_UNIT for decls and
+ MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not
+ known, it is zero. Do not access directly but use functions
+ get_ptr_info_alignment, set_ptr_info_alignment,
+ mark_ptr_info_alignment_unknown and similar. */
+ unsigned int align;
+
+ /* When alignment is known, the byte offset this pointer differs from the
+ above alignment. Access only through the same helper functions as align
+ above. */
+ unsigned int misalign;
};
};
-/* The "no alias" attribute allows alias analysis to make more
- aggressive assumptions when assigning alias sets, computing
- points-to information and memory partitions. These attributes
- are the result of user annotations or flags (e.g.,
- -fargument-noalias). */
-enum noalias_state {
- /* Default state. No special assumptions can be made about this
- symbol. */
- MAY_ALIAS = 0,
-
- /* The symbol does not alias with other symbols that have a
- NO_ALIAS* attribute. */
- NO_ALIAS,
-
- /* The symbol does not alias with other symbols that have a
- NO_ALIAS*, and it may not alias with global symbols. */
- NO_ALIAS_GLOBAL,
-
- /* The symbol does not alias with any other symbols. */
- NO_ALIAS_ANYTHING
-};
-
-
-struct GTY(()) var_ann_d {
- /* Used when building base variable structures in a var_map. */
- unsigned base_var_processed : 1;
-
- /* Nonzero if this variable was used after SSA optimizations were
- applied. We set this when translating out of SSA form. */
- unsigned used : 1;
-
- /* This field indicates whether or not the variable may need PHI nodes.
- See the enum's definition for more detailed information about the
- states. */
- ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
-
- /* True for HEAP artificial variables. These variables represent
- the memory area allocated by a call to malloc. */
- unsigned is_heapvar : 1;
-
- /* This field describes several "no alias" attributes that some
- symbols are known to have. See the enum's definition for more
- information on each attribute. */
- ENUM_BITFIELD (noalias_state) noalias_state : 2;
-
- /* Used by var_map for the base index of ssa base variables. */
- unsigned base_index;
-
- /* During into-ssa and the dominator optimizer, this field holds the
- current version of this variable (an SSA_NAME). */
- tree current_def;
-};
-
-
/* Immediate use lists are used to directly access all uses for an SSA
name and get pointers to the statement for each use.
-typedef struct var_ann_d *var_ann_t;
-
-static inline var_ann_t var_ann (const_tree);
-static inline var_ann_t get_var_ann (tree);
static inline void update_stmt (gimple);
static inline int get_lineno (const_gimple);
-/*---------------------------------------------------------------------------
- Structure representing predictions in tree level.
----------------------------------------------------------------------------*/
-struct GTY((chain_next ("%h.ep_next"))) edge_prediction {
- struct edge_prediction *ep_next;
- edge ep_edge;
- enum br_predictor ep_predictor;
- int ep_probability;
-};
-
/* Accessors for basic block annotations. */
static inline gimple_seq phi_nodes (const_basic_block);
static inline void set_phi_nodes (basic_block, gimple_seq);
/*---------------------------------------------------------------------------
Global declarations
---------------------------------------------------------------------------*/
-struct GTY(()) int_tree_map {
-
+struct int_tree_map {
unsigned int uid;
tree to;
};
extern unsigned int uid_decl_map_hash (const void *);
extern int uid_decl_map_eq (const void *, const void *);
-typedef struct
-{
- htab_iterator hti;
-} referenced_var_iterator;
-
-/* This macro loops over all the referenced vars, one at a time, putting the
- current var in VAR. Note: You are not allowed to add referenced variables
- to the hashtable while using this macro. Doing so may cause it to behave
- erratically. */
-
-#define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
- for ((VAR) = first_referenced_var (&(ITER)); \
- !end_referenced_vars_p (&(ITER)); \
- (VAR) = next_referenced_var (&(ITER)))
-
-extern tree referenced_var_lookup (unsigned int);
-extern bool referenced_var_check_and_insert (tree);
-#define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
-#define referenced_var(i) referenced_var_lookup (i)
-
#define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
#define ssa_name(i) (VEC_index (tree, cfun->gimple_df->ssa_names, (i)))
/* If this is a combined parallel+workshare region, this is a list
of additional arguments needed by the combined parallel+workshare
library call. */
- tree ws_args;
+ VEC(tree,gc) *ws_args;
/* The code for the omp directive of this region. */
enum gimple_code type;
extern bool simple_goto_p (gimple);
extern bool stmt_can_make_abnormal_goto (gimple);
extern basic_block single_noncomplex_succ (basic_block bb);
-extern void gimple_dump_bb (basic_block, FILE *, int, int);
+extern void gimple_dump_bb (FILE *, basic_block, int, int);
extern void gimple_debug_bb (basic_block);
extern basic_block gimple_debug_bb_n (int);
extern void gimple_dump_cfg (FILE *, int);
extern void print_loops (FILE *, int);
extern void print_loops_bb (FILE *, basic_block, int, int);
extern void cleanup_dead_labels (void);
+extern void group_case_labels_stmt (gimple);
extern void group_case_labels (void);
extern gimple first_stmt (basic_block);
extern gimple last_stmt (basic_block);
#define label_to_block(t) (label_to_block_fn (cfun, t))
extern void notice_special_calls (gimple);
extern void clear_special_calls (void);
-extern void verify_stmts (void);
-extern void verify_gimple (void);
-extern void verify_types_in_gimple_seq (gimple_seq);
+extern void verify_gimple_in_seq (gimple_seq);
+extern void verify_gimple_in_cfg (struct function *);
extern tree gimple_block_label (basic_block);
extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
VEC(basic_block,heap) **bbs_p);
extern void add_phi_args_after_copy_bb (basic_block);
extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
-extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
extern bool gimple_purge_dead_eh_edges (basic_block);
extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
+extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
+extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap);
extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
tree, tree);
extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code,
extern basic_block move_sese_region_to_fn (struct function *, basic_block,
basic_block, tree);
void remove_edge_and_dominated_blocks (edge);
-void mark_virtual_ops_in_bb (basic_block);
bool tree_node_can_be_shared (tree);
/* In tree-cfgcleanup.c */
extern const char *op_symbol_code (enum tree_code);
/* In tree-dfa.c */
-extern var_ann_t create_var_ann (tree);
extern void renumber_gimple_stmt_uids (void);
extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
-extern void debug_referenced_vars (void);
-extern void dump_referenced_vars (FILE *);
extern void dump_variable (FILE *, tree);
extern void debug_variable (tree);
-extern tree get_virtual_var (tree);
-extern bool add_referenced_var (tree);
-extern void remove_referenced_var (tree);
-extern void mark_symbols_for_renaming (gimple);
-extern void find_new_referenced_vars (gimple);
-extern tree make_rename_temp (tree, const char *);
-extern void set_default_def (tree, tree);
-extern tree gimple_default_def (struct function *, tree);
+extern void set_ssa_default_def (struct function *, tree, tree);
+extern tree ssa_default_def (struct function *, tree);
+extern tree get_or_create_ssa_default_def (struct function *, tree);
extern bool stmt_references_abnormal_ssa_name (gimple);
-extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
- HOST_WIDE_INT *, HOST_WIDE_INT *);
-extern void find_referenced_vars_in (gimple);
+extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
+extern void dump_enumerated_decls (FILE *, int);
/* In tree-phinodes.c */
extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple phi, basic_block bb);
-extern gimple make_phi_node (tree var, int len);
extern gimple create_phi_node (tree, basic_block);
extern void add_phi_arg (gimple, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
-extern void init_phinodes (void);
-extern void fini_phinodes (void);
extern void release_phi_node (gimple);
-#ifdef GATHER_STATISTICS
extern void phinodes_print_statistics (void);
-#endif
/* In gimple-low.c */
extern void record_vars_into (tree, tree);
extern void record_vars (tree);
-extern bool block_may_fallthru (const_tree);
extern bool gimple_seq_may_fallthru (gimple_seq);
extern bool gimple_stmt_may_fallthru (gimple);
-extern bool gimple_check_call_args (gimple);
+extern bool gimple_check_call_matching_types (gimple, tree);
/* In tree-ssa.c */
/* Mapping for redirected edges. */
-struct GTY(()) _edge_var_map {
+struct _edge_var_map {
tree result; /* PHI result. */
tree def; /* PHI arg definition. */
source_location locus; /* PHI arg location. */
extern void verify_ssa (bool);
extern void delete_tree_ssa (void);
extern bool ssa_undefined_value_p (tree);
-extern void execute_update_addresses_taken (bool);
+extern void warn_uninit (enum opt_code, tree, tree, tree, const char *, void *);
+extern unsigned int warn_uninitialized_vars (bool);
+extern void execute_update_addresses_taken (void);
/* Call-back function for walk_use_def_chains(). At each reaching
definition, a function with this prototype is called. */
void insert_debug_temps_for_defs (gimple_stmt_iterator *);
void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree);
+void reset_debug_uses (gimple);
void release_defs_bitset (bitmap toremove);
/* In tree-into-ssa.c */
void update_ssa (unsigned);
void delete_update_ssa (void);
-void register_new_name_mapping (tree, tree);
tree create_new_def_for (tree, gimple, def_operand_p);
bool need_ssa_update_p (struct function *);
-bool name_mappings_registered_p (void);
bool name_registered_for_update_p (tree);
-bitmap ssa_names_to_replace (void);
void release_ssa_name_after_update_ssa (tree);
-void compute_global_livein (bitmap, bitmap);
-void mark_sym_for_renaming (tree);
-void mark_set_for_renaming (bitmap);
+void mark_virtual_operands_for_renaming (struct function *);
tree get_current_def (tree);
void set_current_def (tree, tree);
extern void init_ssanames (struct function *, int);
extern void fini_ssanames (void);
extern tree make_ssa_name_fn (struct function *, tree, gimple);
-extern tree duplicate_ssa_name (tree, gimple);
+extern tree copy_ssa_name_fn (struct function *, tree, gimple);
+extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
extern void release_ssa_name (tree);
extern void release_defs (gimple);
extern void replace_ssa_name_symbol (tree, tree);
+extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
+ unsigned int *);
+extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
+extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
+ unsigned int);
+extern void adjust_ptr_info_misalignment (struct ptr_info_def *,
+ unsigned int);
-#ifdef GATHER_STATISTICS
extern void ssanames_print_statistics (void);
-#endif
/* In tree-ssa-ccp.c */
tree fold_const_aggregate_ref (tree);
+tree gimple_fold_stmt_to_constant (gimple, tree (*)(tree));
/* In tree-ssa-dom.c */
extern void dump_dominator_optimization_stats (FILE *);
extern void debug_dominator_optimization_stats (void);
int loop_depth_of_name (tree);
tree degenerate_phi_result (gimple);
+bool simple_iv_increment_p (gimple);
/* In tree-ssa-copy.c */
extern void propagate_value (use_operand_p, tree);
extern bool may_propagate_copy_into_stmt (gimple, tree);
extern bool may_propagate_copy_into_asm (tree);
+/* In tree-ssa-loop-ch.c */
+bool do_while_loop_p (struct loop *);
+
/* Affine iv. */
typedef struct
/* In tree-ssa-loop*.c */
-void tree_ssa_lim (void);
+unsigned int tree_ssa_lim (void);
unsigned int tree_ssa_unswitch_loops (void);
unsigned int canonicalize_induction_variables (void);
unsigned int tree_unroll_loops_completely (bool, bool);
tree loop_niter_by_eval (struct loop *, edge);
tree find_loop_niter_by_eval (struct loop *, edge *);
void estimate_numbers_of_iterations (void);
-bool array_at_struct_end_p (tree);
bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool);
struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
void rename_variables_in_loop (struct loop *);
void rename_variables_in_bb (basic_block bb);
-struct loop *tree_ssa_loop_version (struct loop *, tree,
- basic_block *);
tree expand_simple_operations (tree);
void substitute_in_loop_info (struct loop *, tree, tree);
edge single_dom_exit (struct loop *);
transform_callback, void *);
bool contains_abnormal_ssa_name_p (tree);
bool stmt_dominates_stmt_p (gimple, gimple);
-void mark_virtual_ops_for_renaming (gimple);
/* In tree-ssa-dce.c */
+void mark_virtual_operand_for_renaming (tree);
void mark_virtual_phi_result_for_renaming (gimple);
/* In tree-ssa-threadedge.c */
char *get_lsm_tmp_name (tree, unsigned);
/* In tree-flow-inline.h */
-static inline bool is_call_clobbered (const_tree);
-static inline void set_is_used (tree);
static inline bool unmodifiable_var_p (const_tree);
static inline bool ref_contains_array_ref (const_tree);
-static inline bool array_ref_contains_indirect_ref (const_tree);
/* In tree-eh.c */
extern void make_eh_edges (gimple);
extern bool make_eh_dispatch_edges (gimple);
extern edge redirect_eh_edge (edge, basic_block);
extern void redirect_eh_dispatch_edge (gimple, edge, basic_block);
-extern bool tree_could_trap_p (tree);
-extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool,
- bool, tree, bool *);
-extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
extern bool stmt_could_throw_p (gimple);
-extern bool tree_could_throw_p (tree);
extern bool stmt_can_throw_internal (gimple);
extern bool stmt_can_throw_external (gimple);
extern void add_stmt_to_eh_lp_fn (struct function *, gimple, int);
extern bool maybe_duplicate_eh_stmt (gimple, gimple);
extern bool verify_eh_edges (gimple);
extern bool verify_eh_dispatch_edge (gimple);
+extern void maybe_remove_unreachable_handlers (void);
/* In tree-ssa-pre.c */
-struct pre_expr_d;
-void add_to_value (unsigned int, struct pre_expr_d *);
void debug_value_expressions (unsigned int);
-void print_value_expressions (FILE *, unsigned int);
-
-/* In tree-ssa-sink.c */
-bool is_hidden_global_store (gimple);
/* In tree-loop-linear.c */
extern void linear_transform_loops (void);
bool stmt_invariant_in_loop_p (struct loop *, gimple);
bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
addr_space_t);
-unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode, bool);
+bool may_be_nonaddressable_p (tree expr);
/* In tree-ssa-threadupdate.c. */
extern bool thread_through_all_blocks (bool);
-extern void register_jump_thread (edge, edge);
+extern void register_jump_thread (edge, edge, edge);
/* In gimplify.c */
+tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
tree force_gimple_operand (tree, gimple_seq *, bool, tree);
+tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree,
+ gimple_predicate, tree,
+ bool, enum gsi_iterator_update);
tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
bool, enum gsi_iterator_update);
tree gimple_fold_indirect_ref (tree);
struct affine_tree_combination;
tree create_mem_ref (gimple_stmt_iterator *, tree,
- struct affine_tree_combination *, tree, bool);
+ struct affine_tree_combination *, tree, tree, tree, bool);
rtx addr_for_mem_ref (struct mem_address *, addr_space_t, bool);
void get_address_description (tree, struct mem_address *);
tree maybe_fold_tmr (tree);
-unsigned int execute_free_datastructures (void);
unsigned int execute_fixup_cfg (void);
+bool fixup_noreturn_call (gimple stmt);
+
+/* In ipa-pure-const.c */
+void warn_function_noreturn (tree);
+
+/* In tree-ssa-ter.c */
+bool stmt_is_replaceable_p (gimple);
+
+/* In tree-parloops.c */
+bool parallelized_function_p (tree);
#include "tree-flow-inline.h"
void swap_tree_operands (gimple, tree *, tree *);
-int least_common_multiple (int, int);
-
#endif /* _TREE_FLOW_H */