From 9e2e22831c491761f64c8a44c68c77b8e6bc21ad Mon Sep 17 00:00:00 2001 From: amacleod Date: Thu, 12 Sep 2013 13:30:31 +0000 Subject: [PATCH] * tree-flow.h (FREE_SSANAMES): Move to tree-ssanames.c (SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS, ptr_info_def, num_ssa_names, ssa_name): Move to tree-ssanames.h + prototypes. * tree-flow-inline.h (make_ssa_name, copy_ssa_name, duplicate_ssa_name, make_temp_ssa_name): move to tree-ssanames.h * tree-ssa-alias.h: Move prototype. * tree-ssa.h: Include tree-ssanames.h. * tree-ssanames.c (FREE_SSANAMES): Move to here. * tree-ssanames.h: New. Move items from tree-flow*.h * Makefile.in (tree-ssanames.h): Add to tree-ssanames.o and GTFILES. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202527 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++++ gcc/Makefile.in | 3 +- gcc/tree-flow-inline.h | 40 ----------------- gcc/tree-flow.h | 64 -------------------------- gcc/tree-ssa-alias.h | 1 - gcc/tree-ssa.h | 1 + gcc/tree-ssanames.c | 3 ++ gcc/tree-ssanames.h | 119 +++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 138 insertions(+), 106 deletions(-) create mode 100644 gcc/tree-ssanames.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a0d375..82c4c08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2013-09-12 Andrew MacLeod + + * tree-flow.h (FREE_SSANAMES): Move to tree-ssanames.c + (SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS, ptr_info_def, + num_ssa_names, ssa_name): Move to tree-ssanames.h + prototypes. + * tree-flow-inline.h (make_ssa_name, copy_ssa_name, duplicate_ssa_name, + make_temp_ssa_name): move to tree-ssanames.h + * tree-ssa-alias.h: Move prototype. + * tree-ssa.h: Include tree-ssanames.h. + * tree-ssanames.c (FREE_SSANAMES): Move to here. + * tree-ssanames.h: New. Move items from tree-flow*.h + * Makefile.in (tree-ssanames.h): Add to tree-ssanames.o and GTFILES. + 2013-09-12 Richard Biener PR tree-optimization/58404 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index c1113a6..b02d61d 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2379,7 +2379,7 @@ tree-ssa-threadupdate.o : tree-ssa-threadupdate.c $(TREE_SSA_H) $(CONFIG_H) \ $(DIAGNOSTIC_H) $(FUNCTION_H) $(TM_H) coretypes.h $(DUMPFILE_H) \ $(BASIC_BLOCK_H) $(FLAGS_H) $(CFGLOOP_H) tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(TREE_H) $(TREE_SSA_H) $(TREE_PASS_H) + $(TM_H) $(TREE_H) $(TREE_SSA_H) $(TREE_PASS_H) tree-ssanames.h tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_SSA_H) \ gt-tree-phinodes.h $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) @@ -3837,6 +3837,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/tree-ssa-propagate.c \ $(srcdir)/tree-phinodes.c \ $(srcdir)/tree-ssa-alias.h \ + $(srcdir)/tree-ssanames.h \ $(srcdir)/ipa-prop.h \ $(srcdir)/trans-mem.c \ $(srcdir)/lto-streamer.h \ diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 24f3f44..03c4840 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -1159,46 +1159,6 @@ gimple_ssa_operands (const struct function *fun) } -/* Return an SSA_NAME node for variable VAR defined in statement STMT - in function cfun. */ - -static inline tree -make_ssa_name (tree var, gimple stmt) -{ - return make_ssa_name_fn (cfun, var, stmt); -} - -/* Return an SSA_NAME node using the template SSA name NAME defined in - statement STMT in function cfun. */ - -static inline tree -copy_ssa_name (tree var, gimple stmt) -{ - return copy_ssa_name_fn (cfun, var, stmt); -} - -/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT - in function cfun. */ - -static inline tree -duplicate_ssa_name (tree var, gimple stmt) -{ - return duplicate_ssa_name_fn (cfun, var, stmt); -} - -/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT - in function cfun. Arrange so that it uses NAME in dumps. */ - -static inline tree -make_temp_ssa_name (tree type, gimple stmt, const char *name) -{ - tree ssa_name; - gcc_checking_assert (TYPE_P (type)); - ssa_name = make_ssa_name_fn (cfun, type, stmt); - SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name)); - return ssa_name; -} - /* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that denotes the starting address of the memory access EXP. Returns NULL_TREE if the offset is not constant or any component diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 0d52974..9c5d979 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -92,12 +92,6 @@ struct GTY(()) gimple_df { htab_t GTY ((param_is (struct tm_restart_node))) tm_restart; }; -/* Accessors for internal use only. Generic code should use abstraction - provided by tree-flow-inline.h or specific modules. */ -#define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames -#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 typedef struct { @@ -113,41 +107,6 @@ typedef struct !end_htab_p (&(ITER)); \ RESULT = (TYPE) next_htab_element (&(ITER))) -/*--------------------------------------------------------------------------- - Attributes for SSA_NAMEs. - - NOTE: These structures are stored in struct tree_ssa_name - but are only used by the tree optimizers, so it makes better sense - to declare them here to avoid recompiling unrelated files when - making changes. ----------------------------------------------------------------------------*/ - -/* Aliasing information for SSA_NAMEs representing pointer variables. */ - -struct GTY(()) ptr_info_def -{ - /* 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; -}; - - /* It is advantageous to avoid things like life analysis for variables which do not need PHI nodes. This enum describes whether or not a particular variable may need a PHI node. */ @@ -282,9 +241,6 @@ struct int_tree_map { tree to; }; -#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names)) -#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)]) - /* Macros for showing usage statistics. */ #define SCALE(x) ((unsigned long) ((x) < 1024*10 \ ? (x) \ @@ -479,26 +435,6 @@ void mark_virtual_operands_for_renaming (struct function *); tree get_current_def (tree); void set_current_def (tree, tree); -/* In tree-ssanames.c */ -extern void init_ssanames (struct function *, int); -extern void fini_ssanames (void); -extern tree make_ssa_name_fn (struct function *, 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); - -extern void ssanames_print_statistics (void); - /* In tree-ssa-ccp.c */ tree fold_const_aggregate_ref (tree); tree gimple_fold_stmt_to_constant (gimple, tree (*)(tree)); diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h index 96d0192..e560685 100644 --- a/gcc/tree-ssa-alias.h +++ b/gcc/tree-ssa-alias.h @@ -116,7 +116,6 @@ extern void *walk_non_aliased_vuses (ao_ref *, tree, extern unsigned int walk_aliased_vdefs (ao_ref *, tree, bool (*)(ao_ref *, tree, void *), void *, bitmap *); -extern struct ptr_info_def *get_ptr_info (tree); extern void dump_alias_info (FILE *); extern void debug_alias_info (void); extern void dump_points_to_solution (FILE *, struct pt_solution *); diff --git a/gcc/tree-ssa.h b/gcc/tree-ssa.h index c6e458a..457fd6b 100644 --- a/gcc/tree-ssa.h +++ b/gcc/tree-ssa.h @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see #define GCC_TREE_SSA_H #include "tree-flow.h" +#include "tree-ssanames.h" /* Mapping for redirected edges. */ struct _edge_var_map { diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index efc08e9..e64bd65 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -60,6 +60,9 @@ along with GCC; see the file COPYING3. If not see unsigned int ssa_name_nodes_reused; unsigned int ssa_name_nodes_created; +#define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames + + /* Initialize management of SSA_NAMEs to default SIZE. If SIZE is zero use default. */ diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h new file mode 100644 index 0000000..8cc3efd --- /dev/null +++ b/gcc/tree-ssanames.h @@ -0,0 +1,119 @@ +/* SSA name expresssons routines + Copyright (C) 2013 Free Software Foundation, Inc. + +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 +. */ + +#ifndef GCC_TREE_SSANAMES_H +#define GCC_TREE_SSANAMES_H + +/* Aliasing information for SSA_NAMEs representing pointer variables. */ + +struct GTY(()) ptr_info_def +{ + /* 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; +}; + + +#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 num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names)) +#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)]) + + +extern void init_ssanames (struct function *, int); +extern void fini_ssanames (void); +extern void ssanames_print_statistics (void); +extern tree make_ssa_name_fn (struct function *, tree, gimple); +extern void release_ssa_name (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); +extern struct ptr_info_def *get_ptr_info (tree); + +extern tree copy_ssa_name_fn (struct function *, tree, gimple); +extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *); +extern tree duplicate_ssa_name_fn (struct function *, tree, gimple); +extern void release_defs (gimple); +extern void replace_ssa_name_symbol (tree, tree); + + +/* Return an SSA_NAME node for variable VAR defined in statement STMT + in function cfun. */ + +static inline tree +make_ssa_name (tree var, gimple stmt) +{ + return make_ssa_name_fn (cfun, var, stmt); +} + +/* Return an SSA_NAME node using the template SSA name NAME defined in + statement STMT in function cfun. */ + +static inline tree +copy_ssa_name (tree var, gimple stmt) +{ + return copy_ssa_name_fn (cfun, var, stmt); +} + +/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT + in function cfun. */ + +static inline tree +duplicate_ssa_name (tree var, gimple stmt) +{ + return duplicate_ssa_name_fn (cfun, var, stmt); +} + +/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT + in function cfun. Arrange so that it uses NAME in dumps. */ + +static inline tree +make_temp_ssa_name (tree type, gimple stmt, const char *name) +{ + tree ssa_name; + gcc_checking_assert (TYPE_P (type)); + ssa_name = make_ssa_name_fn (cfun, type, stmt); + SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name)); + return ssa_name; +} + + +#endif /* GCC_TREE_SSANAMES_H */ -- 2.7.4