Commit cc524fc7 by Andrew MacLeod Committed by Andrew Macleod

tree-flow.h (tm_restart_node, gimple_df): Move to gimple-ssa.h.



	* tree-flow.h (tm_restart_node, gimple_df): Move to gimple-ssa.h.
	(struct int_tree_map): Move to tree-hasher.h
	(SCALE, LABEL, PERCENT): Move to gimple.h
	* tree-flow-inline.h: Delete.  Move functions to other files.
	(unmodifiable_var_p, ref_contains_array_ref): Unused, so delete.
	* gimple-ssa.h (tm_restart_node, gimple_df): Relocate from tree-flow.h.
	(gimple_in_ssa_p, gimple_vop): Relocate from tree-flow-inline.h
	* gimple.h (imple_stmt_max_uid, set_gimple_stmt_max_uid,
	inc_gimple_stmt_max_uid, get_lineno): Relocate from tree-flow-inline.h.
	(SCALE, LABEL, PERCENT): Relocate from tree-flow.h
	* tree-hasher.h: Don't include tree-flow.h.
	(struct int_tree_map): Relocate from tree-flow.h.
	* tree-sra.c (contains_view_convert_expr_p): Relocate from
	tree-flow-inline.h and make static.
	* tree-ssa-alias.h (ranges_overlap_p): Relocate from tree-flow-inline.h.
	* tree-ssa-operands.c (gimple_ssa_operands): Relocate from
	tree-flow-inline.h and make static.
	* tree.h (is_global_var, may_be_aliased): Relocate from
	tree-flow-inline.h.
	* Makefile.in (GTFILES): Remove tree-flow.h and add gimple-ssa.h.
	* value-prof.c: No longer include tree-flow-inline.h.
	* tree-switch-conversion.c: No longer include tree-flow-inline.h.

From-SVN: r203318
parent 71343877
2013-10-09 Andrew MacLeod <amacleod@redhat.com>
* tree-flow.h (tm_restart_node, gimple_df): Move to gimple-ssa.h.
(struct int_tree_map): Move to tree-hasher.h
(SCALE, LABEL, PERCENT): Move to gimple.h
* tree-flow-inline.h: Delete. Move functions to other files.
(unmodifiable_var_p, ref_contains_array_ref): Unused, so delete.
* gimple-ssa.h (tm_restart_node, gimple_df): Relocate from tree-flow.h.
(gimple_in_ssa_p, gimple_vop): Relocate from tree-flow-inline.h
* gimple.h (imple_stmt_max_uid, set_gimple_stmt_max_uid,
inc_gimple_stmt_max_uid, get_lineno): Relocate from tree-flow-inline.h.
(SCALE, LABEL, PERCENT): Relocate from tree-flow.h
* tree-hasher.h: Don't include tree-flow.h.
(struct int_tree_map): Relocate from tree-flow.h.
* tree-sra.c (contains_view_convert_expr_p): Relocate from
tree-flow-inline.h and make static.
* tree-ssa-alias.h (ranges_overlap_p): Relocate from tree-flow-inline.h.
* tree-ssa-operands.c (gimple_ssa_operands): Relocate from
tree-flow-inline.h and make static.
* tree.h (is_global_var, may_be_aliased): Relocate from
tree-flow-inline.h.
* Makefile.in (GTFILES): Remove tree-flow.h and add gimple-ssa.h.
* value-prof.c: No longer include tree-flow-inline.h.
* tree-switch-conversion.c: No longer include tree-flow-inline.h.
2013-10-09 Andrew MacLeod <amacleod@redhat.com>
* tree-flow.h: Move some protoypes. Include new tree-ssa-loop.h.
(struct affine_iv, struct tree_niter_desc): Move to tree-ssa-loop.h.
(enum move_pos): Move to tree-ssa-loop-im.h
......
......@@ -2241,7 +2241,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
$(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
$(srcdir)/gimple.h $(srcdir)/gimple.c \
$(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
$(srcdir)/tree-mudflap.c $(srcdir)/gimple-ssa.h \
$(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
$(srcdir)/tree-cfg.c \
$(srcdir)/tree-dfa.c \
......
......@@ -21,6 +21,88 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GIMPLE_SSA_H
#define GCC_GIMPLE_SSA_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, all publicly modifiable fields should have
gimple_set accessor. */
struct GTY(()) gimple_df {
/* 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
happens, all the instructions after the call are no longer
reachable and must be deleted as dead. */
vec<gimple, va_gc> *modified_noreturn_calls;
/* Array of all SSA_NAMEs used in the function. */
vec<tree, va_gc> *ssa_names;
/* Artificial variable used for the virtual operand FUD chain. */
tree vop;
/* The PTA solution for the ESCAPED artificial variable. */
struct pt_solution escaped;
/* A map of decls to artificial ssa-names that point to the partition
of the decl. */
struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
/* Free list of SSA_NAMEs. */
vec<tree, va_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
USE or a VUSE. In those cases, the SSA renamer creates an SSA name
for this variable with an empty defining statement. */
htab_t GTY((param_is (union tree_node))) default_defs;
/* 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;
};
/* Return true when gimple SSA form was built.
gimple_in_ssa_p is queried by gimplifier in various early stages before SSA
infrastructure is initialized. Check for presence of the datastructures
at first place. */
static inline bool
gimple_in_ssa_p (const struct function *fun)
{
return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
}
/* Inline functions for manipulating various data structures defined in
tree-flow.h. See tree-flow.h for documentation. */
/* Artificial variable used for the virtual operand FUD chain. */
static inline tree
gimple_vop (const struct function *fun)
{
gcc_checking_assert (fun && fun->gimple_df);
return fun->gimple_df->vop;
}
/* Return the set of VUSE operand for statement G. */
static inline use_operand_p
......
......@@ -1028,6 +1028,27 @@ is_gimple_sizepos (tree expr)
|| CONTAINS_PLACEHOLDER_P (expr));
}
/* Get the number of the next statement uid to be allocated. */
static inline unsigned int
gimple_stmt_max_uid (struct function *fn)
{
return fn->last_stmt_uid;
}
/* Set the number of the next statement uid to be allocated. */
static inline void
set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
{
fn->last_stmt_uid = maxid;
}
/* Set the number of the next statement uid to be allocated. */
static inline unsigned int
inc_gimple_stmt_max_uid (struct function *fn)
{
return fn->last_stmt_uid++;
}
extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
bool (*) (tree), fallback_t);
extern void gimplify_type_sizes (tree, gimple_seq *);
......@@ -1055,6 +1076,7 @@ extern tree gimple_boolify (tree);
extern gimple_predicate rhs_predicate_for (tree);
extern tree canonicalize_cond_expr_cond (tree);
extern void dump_decl_set (FILE *, bitmap);
extern bool gimple_can_coalesce_p (tree, tree);
extern bool nonfreeing_call_p (gimple);
/* In omp-low.c. */
......@@ -1077,9 +1099,6 @@ extern tree gimple_assign_rhs_to_tree (gimple);
/* In builtins.c */
extern bool validate_gimple_arglist (const_gimple, ...);
/* In tree-ssa-coalesce.c */
extern bool gimple_can_coalesce_p (tree, tree);
/* Return the first node in GIMPLE sequence S. */
static inline gimple_seq_node
......@@ -3910,6 +3929,23 @@ gimple_debug_source_bind_set_value (gimple dbg, tree value)
gimple_set_op (dbg, 1, value);
}
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int
get_lineno (const_gimple stmt)
{
location_t loc;
if (!stmt)
return -1;
loc = gimple_location (stmt);
if (loc == UNKNOWN_LOCATION)
return -1;
return LOCATION_LINE (loc);
}
/* Return a pointer to the body for the OMP statement GS. */
static inline gimple_seq *
......@@ -5431,4 +5467,16 @@ gimple_seq_set_location (gimple_seq seq, location_t loc)
gimple_set_location (gsi_stmt (i), loc);
}
/* Macros for showing usage statistics. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
: ((x) < 1024*1024*10 \
? (x) / 1024 \
: (x) / (1024*1024))))
#define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
#endif /* GCC_GIMPLE_H */
/* Inline functions for tree-flow.h
Copyright (C) 2001-2013 Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.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 _TREE_FLOW_INLINE_H
#define _TREE_FLOW_INLINE_H 1
/* Inline functions for manipulating various data structures defined in
tree-flow.h. See tree-flow.h for documentation. */
/* Return true when gimple SSA form was built.
gimple_in_ssa_p is queried by gimplifier in various early stages before SSA
infrastructure is initialized. Check for presence of the datastructures
at first place. */
static inline bool
gimple_in_ssa_p (const struct function *fun)
{
return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
}
/* Artificial variable used for the virtual operand FUD chain. */
static inline tree
gimple_vop (const struct function *fun)
{
gcc_checking_assert (fun && fun->gimple_df);
return fun->gimple_df->vop;
}
/* Get the number of the next statement uid to be allocated. */
static inline unsigned int
gimple_stmt_max_uid (struct function *fn)
{
return fn->last_stmt_uid;
}
/* Set the number of the next statement uid to be allocated. */
static inline void
set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
{
fn->last_stmt_uid = maxid;
}
/* Set the number of the next statement uid to be allocated. */
static inline unsigned int
inc_gimple_stmt_max_uid (struct function *fn)
{
return fn->last_stmt_uid++;
}
/* Return the line number for EXPR, or return -1 if we have no line
number information for it. */
static inline int
get_lineno (const_gimple stmt)
{
location_t loc;
if (!stmt)
return -1;
loc = gimple_location (stmt);
if (loc == UNKNOWN_LOCATION)
return -1;
return LOCATION_LINE (loc);
}
/* Return true if T (assumed to be a DECL) is a global variable.
A variable is considered global if its storage is not automatic. */
static inline bool
is_global_var (const_tree t)
{
return (TREE_STATIC (t) || DECL_EXTERNAL (t));
}
/* Return true if VAR may be aliased. A variable is considered as
maybe aliased if it has its address taken by the local TU
or possibly by another TU and might be modified through a pointer. */
static inline bool
may_be_aliased (const_tree var)
{
return (TREE_CODE (var) != CONST_DECL
&& !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
&& TREE_READONLY (var)
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
&& (TREE_PUBLIC (var)
|| DECL_EXTERNAL (var)
|| TREE_ADDRESSABLE (var)));
}
/* Return true if VAR cannot be modified by the program. */
static inline bool
unmodifiable_var_p (const_tree var)
{
if (TREE_CODE (var) == SSA_NAME)
var = SSA_NAME_VAR (var);
return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
}
/* Return true if REF, a handled component reference, has an ARRAY_REF
somewhere in it. */
static inline bool
ref_contains_array_ref (const_tree ref)
{
gcc_checking_assert (handled_component_p (ref));
do {
if (TREE_CODE (ref) == ARRAY_REF)
return true;
ref = TREE_OPERAND (ref, 0);
} while (handled_component_p (ref));
return false;
}
/* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it. */
static inline bool
contains_view_convert_expr_p (const_tree ref)
{
while (handled_component_p (ref))
{
if (TREE_CODE (ref) == VIEW_CONVERT_EXPR)
return true;
ref = TREE_OPERAND (ref, 0);
}
return false;
}
/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
overlap. SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the
range is open-ended. Otherwise return false. */
static inline bool
ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
unsigned HOST_WIDE_INT size1,
unsigned HOST_WIDE_INT pos2,
unsigned HOST_WIDE_INT size2)
{
if (pos1 >= pos2
&& (size2 == (unsigned HOST_WIDE_INT)-1
|| pos1 < (pos2 + size2)))
return true;
if (pos2 >= pos1
&& (size1 == (unsigned HOST_WIDE_INT)-1
|| pos2 < (pos1 + size1)))
return true;
return false;
}
/* Accessor to tree-ssa-operands.c caches. */
static inline struct ssa_operands *
gimple_ssa_operands (const struct function *fun)
{
return &fun->gimple_df->ssa_operands;
}
#endif /* _TREE_FLOW_INLINE_H */
......@@ -37,87 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-into-ssa.h"
#include "tree-ssa-loop.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 {
/* 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
happens, all the instructions after the call are no longer
reachable and must be deleted as dead. */
vec<gimple, va_gc> *modified_noreturn_calls;
/* Array of all SSA_NAMEs used in the function. */
vec<tree, va_gc> *ssa_names;
/* Artificial variable used for the virtual operand FUD chain. */
tree vop;
/* The PTA solution for the ESCAPED artificial variable. */
struct pt_solution escaped;
/* A map of decls to artificial ssa-names that point to the partition
of the decl. */
struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
/* Free list of SSA_NAMEs. */
vec<tree, va_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
USE or a VUSE. In those cases, the SSA renamer creates an SSA name
for this variable with an empty defining statement. */
htab_t GTY((param_is (union tree_node))) default_defs;
/* 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;
};
static inline int get_lineno (const_gimple);
/*---------------------------------------------------------------------------
Global declarations
---------------------------------------------------------------------------*/
struct int_tree_map {
unsigned int uid;
tree to;
};
/* Macros for showing usage statistics. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
: ((x) < 1024*1024*10 \
? (x) / 1024 \
: (x) / (1024*1024))))
#define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
/*---------------------------------------------------------------------------
OpenMP Region Tree
---------------------------------------------------------------------------*/
......@@ -323,6 +242,4 @@ void warn_function_noreturn (tree);
/* In tree-parloops.c */
bool parallelized_function_p (tree);
#include "tree-flow-inline.h"
#endif /* _TREE_FLOW_H */
......@@ -22,7 +22,11 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_HASHER_H 1
#include "hash-table.h"
#include "tree-flow.h"
struct int_tree_map {
unsigned int uid;
tree to;
};
/* Hashtable helpers. */
......
......@@ -1009,6 +1009,21 @@ completely_scalarize_var (tree var)
completely_scalarize_record (var, var, 0, var);
}
/* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it. */
static inline bool
contains_view_convert_expr_p (const_tree ref)
{
while (handled_component_p (ref))
{
if (TREE_CODE (ref) == VIEW_CONVERT_EXPR)
return true;
ref = TREE_OPERAND (ref, 0);
}
return false;
}
/* Search the given tree for a declaration by skipping handled components and
exclude it from the candidates. */
......
......@@ -141,5 +141,28 @@ extern void dump_pta_stats (FILE *);
extern GTY(()) struct pt_solution ipa_escaped_pt;
/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
overlap. SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the
range is open-ended. Otherwise return false. */
static inline bool
ranges_overlap_p (unsigned HOST_WIDE_INT pos1,
unsigned HOST_WIDE_INT size1,
unsigned HOST_WIDE_INT pos2,
unsigned HOST_WIDE_INT size2)
{
if (pos1 >= pos2
&& (size2 == (unsigned HOST_WIDE_INT)-1
|| pos1 < (pos2 + size2)))
return true;
if (pos2 >= pos1
&& (size1 == (unsigned HOST_WIDE_INT)-1
|| pos2 < (pos1 + size1)))
return true;
return false;
}
#endif /* TREE_SSA_ALIAS_H */
......@@ -122,6 +122,13 @@ static void get_expr_operands (gimple, tree *, int);
/* Number of functions with initialized ssa_operands. */
static int n_initialized = 0;
/* Accessor to tree-ssa-operands.c caches. */
static inline struct ssa_operands *
gimple_ssa_operands (const struct function *fun)
{
return &fun->gimple_df->ssa_operands;
}
/* Return true if the SSA operands cache is active. */
......
......@@ -32,7 +32,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree.h"
#include "basic-block.h"
#include "tree-ssa.h"
#include "tree-flow-inline.h"
#include "tree-ssa-operands.h"
#include "tree-pass.h"
#include "gimple-pretty-print.h"
......
......@@ -4951,6 +4951,31 @@ builtin_decl_implicit_p (enum built_in_function fncode)
&& builtin_info.implicit_p[uns_fncode]);
}
/* Return true if T (assumed to be a DECL) is a global variable.
A variable is considered global if its storage is not automatic. */
static inline bool
is_global_var (const_tree t)
{
return (TREE_STATIC (t) || DECL_EXTERNAL (t));
}
/* Return true if VAR may be aliased. A variable is considered as
maybe aliased if it has its address taken by the local TU
or possibly by another TU and might be modified through a pointer. */
static inline bool
may_be_aliased (const_tree var)
{
return (TREE_CODE (var) != CONST_DECL
&& !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
&& TREE_READONLY (var)
&& !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
&& (TREE_PUBLIC (var)
|| DECL_EXTERNAL (var)
|| TREE_ADDRESSABLE (var)));
}
/* For anonymous aggregate types, we need some sort of name to
hold on to. In practice, this should not appear, but it should
not be harmful if it does. */
......
......@@ -33,7 +33,6 @@ along with GCC; see the file COPYING3. If not see
#include "regs.h"
#include "ggc.h"
#include "tree-ssa.h"
#include "tree-flow-inline.h"
#include "diagnostic.h"
#include "gimple-pretty-print.h"
#include "coverage.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment