* gcc/cgraph.h (cgraph_node_set_iterator, varpool_node_set_iterator): Remove typedef. (cgraph_inline_failed_enum, cgraph_inline_failed_t): Remove typedef and rename to cgraph_inline_failed_t. * gcc/tree-ssa-alias.h (ao_ref_s, ao_ref): Remove typedef and rename to ao_ref. * gcc/reload.h (reg_equivs_s, reg_equivs_t): Remove typedef and rename to reg_equivs_t. * gcc/conditions.h (CC_STATUS): Remove typedef. * gcc/bitmap.h (bitmap_obstack): Remove typedef. (bitmap_element_def, bitmap_element): Remove typedef and rename to bitmap_element. (bitmap_head_def, bitmap_head): Remove typedef and rename to bitmap_head. (bitmap_iterator): Remove typedef. * gcc/target.h (cumulative_args_t, print_switch_type, secondary_reload_info): Remove typedef. * gcc/dwarf2out.h (dw_cfi_oprnd_struct, dw_cfi_oprnd): Remove dw_cfi_oprnd_struct alias. (dw_cfi_struct, dw_cfi_node): Remove typedef and rename to dw_cfi_node. (dw_fde_struct, dw_fde_node): Remove typedef and rename to dw_fde_node. (cfa_loc, dw_cfa_location): Remove typedef and rename to dw_cfa_location. (dw_vec_struct, dw_vec_const): Remove typedef and rename to dw_vec_const. (dw_val_struct, dw_val_node): Remove typedef and rename to dw_val_node. (dw_loc_descr_struct, dw_loc_descr_node): Remove typedef and rename to dw_loc_descr_node. * gcc/params.h (param_info, compiler_param): Remove typedef. * gcc/opts.h (cl_deferred_param): Remove typedef. * gcc/sreal.h (sreal): Remove typedef. * gcc/ddg.h (dep_type, dep_data_type): Remove typedef. * gcc/graphite-clast-to-gimple.h (cloog_prog_clast, bb_pbb_def): Remove typedef. * gcc/lto-streamer.h (lto_decl_stream_e_t, lto_encoder_entry, lto_symtab_encoder_iterator, res_pair): Remove typedef. * gcc/tree-affine.h (affine_tree_combination, aff_tree): Remove typedef and rename to aff_tree. * gcc/sched-int.h (region): Remove typedef. * gcc/diagnostic.h (diagnostic_info, diagnostic_classification_change_t): Remove typedef. * gcc/tree-ssa-loop.h (affine_iv_d): Remove typedef and rename to affine_iv. * gcc/sbitmap.h (sbitmap_iterator): Remove typedef. * gcc/ssa-iterators.h (immediate_use_iterator_d, imm_use_iterator): Remove typedef and rename to imm_use_iterator. (ssa_operand_iterator_d, ssa_op_iter): Remove typedef and rename to ssa_op_iter. * gcc/ggc-internal.h (ggc_statistics): Remove typedef. * gcc/cselib.h (cselib_val_struct, cselib_val): Remove typedef and rename to cselib_val. * gcc/tree-core.h (alias_pair): Remove typedef. (constructor_elt_d, constructor_elt): Remove typedef and rename to constructor_elt. (ssa_use_operand_d, ssa_use_operand_t): Remove typedef and rename to ssa_use_operand_t. * gcc/graphite-sese-to-poly.h (base_alias_pair): Remove typedef. * gcc/tree-data-ref.h (conflict_function): Remove typedef. * gcc/tree-inline.h (copy_body_data): Remove typedef. * gcc/ipa-inline.h (condition, size_time_entry, inline_param_summary_t, edge_growth_cache_entry): Remove typedef. * gcc/regrename.h (operand_rr_info, insn_rr_info): Remove typedef. * gcc/gimple-iterator.h (gimple_stmt_iterator_d, gimple_stmt_iterator): Remove typedef and rename to gimple_stmt_iterator. * gcc/basic-block.h (ce_if_block, ce_if_block_t): Remove typedef and rename to ce_if_block. (edge_iterator): Remove typedef. * gcc/ipa-prop.h (ipa_agg_jf_item, ipa_agg_jf_item_t): Remove typedef and rename to ipa_agg_jf_item. (ipa_agg_jump_function_t, ipa_param_descriptor_t, ipa_node_params_t, ipa_parm_adjustment_t): Remove typedef. (ipa_jump_func, ipa_jump_func_t): Remove typedef and rename to ipa_jump_func. (ipa_edge_args, ipa_edge_args_t): Remove typedef and rename to ipa_edge_args. * gcc/gcov-io.h (gcov_bucket_type): Remove typedef. (gcov_working_set_info, gcov_working_set_t): Remove typedef and rename to gcov_working_set_t. * gcc/ira-int.h (minmax_set_iterator, ira_allocno_iterator, ira_object_iterator, ira_allocno_object_iterator, ira_pref_iterator, ira_copy_iterator, ira_object_conflict_iterator): Remove typedef. * gcc/tree-iterator.h (tree_stmt_iterator): Remove typedef. * gcc/rtl.h (addr_diff_vec_flags, mem_attrs, reg_attrs, replace_label_data): Remove typedef. (rtunion_def, rtunion): Remove typedef and rename to rtunion. * gcc/hard-reg-set.h (hard_reg_set_iterator): Remove typedef. * gcc/sel-sched-ir.h (_list_iterator, sel_global_bb_info_def, sel_region_bb_info_def, succ_iterator): Remove typedef. (deps_where_def, deps_where_t): Remove typedef and rename to deps_where_t. * gcc/coretypes.h: Adapt forward declarations. * gcc/tree-scalar-evolution.h: Likewise. * gcc/tree-ssa-address.h: Likewise. * gcc/tree-ssa-operands.h: Likewise. * gcc/function.h: Likewise. * gcc/config/frv/frv-protos.h: Likewise. * gcc/targhooks.h: Likewise. * gcc/basic_block.h: Likewise. * gcc/rtl.def: Adapt documentation. * gcc/doc/tm.texi: Likewise. * gcc/ipa-cp.c: Adapt uses. * gcc/bitmap.c: Likewise. * gcc/dwarf2out.c: Likewise. * gcc/target.def: Likewise. * gcc/ipa-inline-analysis.c: Likewise. * gcc/dwarf2cfi.c: Likewise. * gcc/tree-ssa-loop-ivopts.c: Likewise. * gcc/lto-cgraph.c: Likewise. * gcc/config/frv/frv.c: Likewise. * gcc/ifcvt.c: Likewise. * gcc/ipa-prop.c: Likewise. From-SVN: r205863
190 lines
5.5 KiB
C
190 lines
5.5 KiB
C
/* DDG - Data Dependence Graph - interface.
|
||
Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||
Contributed by Ayal Zaks and Mustafa Hagog <zaks,mustafa@il.ibm.com>
|
||
|
||
This file is part of GCC.
|
||
|
||
GCC is free software; you can redistribute it and/or modify it under
|
||
the terms of the GNU General Public License as published by the Free
|
||
Software Foundation; either version 3, or (at your option) any later
|
||
version.
|
||
|
||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||
for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with GCC; see the file COPYING3. If not see
|
||
<http://www.gnu.org/licenses/>. */
|
||
|
||
#ifndef GCC_DDG_H
|
||
#define GCC_DDG_H
|
||
|
||
/* For sbitmap. */
|
||
#include "sbitmap.h"
|
||
/* For basic_block. */
|
||
#include "basic-block.h"
|
||
#include "df.h"
|
||
|
||
typedef struct ddg_node *ddg_node_ptr;
|
||
typedef struct ddg_edge *ddg_edge_ptr;
|
||
typedef struct ddg *ddg_ptr;
|
||
typedef struct ddg_scc *ddg_scc_ptr;
|
||
typedef struct ddg_all_sccs *ddg_all_sccs_ptr;
|
||
|
||
enum dep_type {TRUE_DEP, OUTPUT_DEP, ANTI_DEP};
|
||
enum dep_data_type {REG_OR_MEM_DEP, REG_DEP, MEM_DEP, REG_AND_MEM_DEP};
|
||
|
||
/* The following two macros enables direct access to the successors and
|
||
predecessors bitmaps held in each ddg_node. Do not make changes to
|
||
these bitmaps, unless you want to change the DDG. */
|
||
#define NODE_SUCCESSORS(x) ((x)->successors)
|
||
#define NODE_PREDECESSORS(x) ((x)->predecessors)
|
||
|
||
/* A structure that represents a node in the DDG. */
|
||
struct ddg_node
|
||
{
|
||
/* Each node has a unique CUID index. These indices increase monotonically
|
||
(according to the order of the corresponding INSN in the BB), starting
|
||
from 0 with no gaps. */
|
||
int cuid;
|
||
|
||
/* The insn represented by the node. */
|
||
rtx insn;
|
||
|
||
/* A note preceding INSN (or INSN itself), such that all insns linked
|
||
from FIRST_NOTE until INSN (inclusive of both) are moved together
|
||
when reordering the insns. This takes care of notes that should
|
||
continue to precede INSN. */
|
||
rtx first_note;
|
||
|
||
/* Incoming and outgoing dependency edges. */
|
||
ddg_edge_ptr in;
|
||
ddg_edge_ptr out;
|
||
|
||
/* Each bit corresponds to a ddg_node according to its cuid, and is
|
||
set iff the node is a successor/predecessor of "this" node. */
|
||
sbitmap successors;
|
||
sbitmap predecessors;
|
||
|
||
/* For general use by algorithms manipulating the ddg. */
|
||
union {
|
||
int count;
|
||
void *info;
|
||
} aux;
|
||
};
|
||
|
||
/* A structure that represents an edge in the DDG. */
|
||
struct ddg_edge
|
||
{
|
||
/* The source and destination nodes of the dependency edge. */
|
||
ddg_node_ptr src;
|
||
ddg_node_ptr dest;
|
||
|
||
/* TRUE, OUTPUT or ANTI dependency. */
|
||
dep_type type;
|
||
|
||
/* REG or MEM dependency. */
|
||
dep_data_type data_type;
|
||
|
||
/* Latency of the dependency. */
|
||
int latency;
|
||
|
||
/* The distance: number of loop iterations the dependency crosses. */
|
||
int distance;
|
||
|
||
/* The following two fields are used to form a linked list of the in/out
|
||
going edges to/from each node. */
|
||
ddg_edge_ptr next_in;
|
||
ddg_edge_ptr next_out;
|
||
|
||
/* For general use by algorithms manipulating the ddg. */
|
||
union {
|
||
int count;
|
||
void *info;
|
||
} aux;
|
||
};
|
||
|
||
/* This structure holds the Data Dependence Graph for a basic block. */
|
||
struct ddg
|
||
{
|
||
/* The basic block for which this DDG is built. */
|
||
basic_block bb;
|
||
|
||
/* Number of instructions in the basic block. */
|
||
int num_nodes;
|
||
|
||
/* Number of load/store instructions in the BB - statistics. */
|
||
int num_loads;
|
||
int num_stores;
|
||
|
||
/* Number of debug instructions in the BB. */
|
||
int num_debug;
|
||
|
||
/* This array holds the nodes in the graph; it is indexed by the node
|
||
cuid, which follows the order of the instructions in the BB. */
|
||
ddg_node_ptr nodes;
|
||
|
||
/* The branch closing the loop. */
|
||
ddg_node_ptr closing_branch;
|
||
|
||
/* Build dependence edges for closing_branch, when set. In certain cases,
|
||
the closing branch can be dealt with separately from the insns of the
|
||
loop, and then no such deps are needed. */
|
||
int closing_branch_deps;
|
||
|
||
/* Array and number of backarcs (edges with distance > 0) in the DDG. */
|
||
int num_backarcs;
|
||
ddg_edge_ptr *backarcs;
|
||
};
|
||
|
||
|
||
/* Holds information on an SCC (Strongly Connected Component) of the DDG. */
|
||
struct ddg_scc
|
||
{
|
||
/* A bitmap that represents the nodes of the DDG that are in the SCC. */
|
||
sbitmap nodes;
|
||
|
||
/* Array and number of backarcs (edges with distance > 0) in the SCC. */
|
||
ddg_edge_ptr *backarcs;
|
||
int num_backarcs;
|
||
|
||
/* The maximum of (total_latency/total_distance) over all cycles in SCC. */
|
||
int recurrence_length;
|
||
};
|
||
|
||
/* This structure holds the SCCs of the DDG. */
|
||
struct ddg_all_sccs
|
||
{
|
||
/* Array that holds the SCCs in the DDG, and their number. */
|
||
ddg_scc_ptr *sccs;
|
||
int num_sccs;
|
||
|
||
ddg_ptr ddg;
|
||
};
|
||
|
||
|
||
ddg_ptr create_ddg (basic_block, int closing_branch_deps);
|
||
void free_ddg (ddg_ptr);
|
||
|
||
void print_ddg (FILE *, ddg_ptr);
|
||
void vcg_print_ddg (FILE *, ddg_ptr);
|
||
void print_ddg_edge (FILE *, ddg_edge_ptr);
|
||
void print_sccs (FILE *, ddg_all_sccs_ptr, ddg_ptr);
|
||
|
||
ddg_node_ptr get_node_of_insn (ddg_ptr, rtx);
|
||
|
||
void find_successors (sbitmap result, ddg_ptr, sbitmap);
|
||
void find_predecessors (sbitmap result, ddg_ptr, sbitmap);
|
||
|
||
ddg_all_sccs_ptr create_ddg_all_sccs (ddg_ptr);
|
||
void free_ddg_all_sccs (ddg_all_sccs_ptr);
|
||
|
||
int find_nodes_on_paths (sbitmap result, ddg_ptr, sbitmap from, sbitmap to);
|
||
int longest_simple_path (ddg_ptr, int from, int to, sbitmap via);
|
||
|
||
bool autoinc_var_is_used_p (rtx, rtx);
|
||
|
||
#endif /* GCC_DDG_H */
|