Re: [UPC 05/22] language hooks changes

2015-12-02 Thread Richard Biener
On Tue, Dec 1, 2015 at 7:02 AM, Gary Funck  wrote:
>
> Background
> --
>
> An overview email, describing the UPC-related changes is here:
>   https://gcc.gnu.org/ml/gcc-patches/2015-12/msg5.html
>
> The GUPC branch is described here:
>   http://gcc.gnu.org/projects/gupc.html
>
> The UPC-related source code differences are summarized here:
>   http://gccupc.org/gupc-changes
>
> All languages (c, c++, fortran, go, lto, objc, obj-c++) have been
> bootstrapped; no test suite regressions were introduced,
> relative to the GCC trunk.
>
> If you are on the cc-list, your name was chosen either
> because you are listed as a maintainer for the area that
> applies to the patches described in this email, or you
> were a frequent contributor of patches made to files listed
> in this email.
>
> In the change log entries included in each patch, the directory
> containing the affected files is listed, followed by the files.
> When the patches are applied, the change log entries will be
> distributed to the appropriate ChangeLog file.
>
> Overview
> 
>
> Two new UPC-specific 'decl' language hooks are defined and then called from
> layout_decl() in stor-layout.c.  The layout_decl_p() function tests if
> this is a UPC shared array declaration that requires special handling.
> If it does, then layout_decl() is called.
>
> A few new UPC-specific language hooks are defined in a 'upc' sub-structure
> of the language hooks structure.  They are defined as
> hooks because they are called from code in the 'c-family/' directory,
> but are implemented in the 'c/' directory.

Please post these together with the langhook uses, otherwise it's really hard
to review.

I'll note that whatever "special" layout you want for your pointer
representation
should be better ensured via attributes if possible.

Richard.

> 2015-11-30  Gary Funck  
>
> gcc/
> * langhooks-def.h (lhd_do_nothing_b, lhd_do_nothing_t_t):
> New do nothing hook prototypes.
> (LANG_HOOKS_UPC_TOGGLE_KEYWORDS,
> LANG_HOOKS_UPC_PTS_INIT_TYPE, LANG_HOOKS_UPC_BUILD_INIT_FUNC,
> LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS): New default UPC hooks.
> * langhooks-def.h (LANG_HOOKS_LAYOUT_DECL_P, LANG_HOOKS_LAYOUT_DECL):
> New language hook defaults.
> (LANG_HOOKS_UPC): New.  Define UPC hooks structure.
> * langhooks.c (lhd_do_nothing_b, lhd_do_nothing_t_t):
> New do nothing hooks.
> * langhooks.h (layout_decl_p, layout_decl): New language hooks.
> (lang_hooks_for_upc): New UPC language hooks structure.
> * stor-layout.c (layout_decl): Call the layout_decl_p() and
> and layout_decl() hooks.
> gcc/c/
> * c-lang.c: #include "c-upc-lang.h".
> #include "c-upc-low.h".
> (LANG_HOOKS_UPC_TOGGLE_KEYWORDS, LANG_HOOKS_UPC_PTS_INIT_TYPE,
> LANG_HOOKS_UPC_BUILD_INIT_FUNC, LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS,
> LANG_HOOKS_LAYOUT_DECL_P, LANG_HOOKS_LAYOUT_DECL):
> Override defaults.  Define UPC-specific hook routines.
> * c-upc-lang.c: New.  Implement UPC-specific hook routines.
> * c-upc-lang.h: New.  Define UPC-specific hook prototypes.
>
> Index: gcc/langhooks-def.h
> ===
> --- gcc/langhooks-def.h (.../trunk) (revision 231059)
> +++ gcc/langhooks-def.h (.../branches/gupc) (revision 231080)
> @@ -35,7 +35,9 @@ struct diagnostic_info;
>  /* See langhooks.h for the definition and documentation of each hook.  */
>
>  extern void lhd_do_nothing (void);
> +extern void lhd_do_nothing_b (bool);
>  extern void lhd_do_nothing_t (tree);
> +extern void lhd_do_nothing_t_t (tree, tree);
>  extern void lhd_do_nothing_f (struct function *);
>  extern tree lhd_pass_through_t (tree);
>  extern bool lhd_post_options (const char **);
> @@ -175,6 +177,10 @@ extern tree lhd_make_node (enum tree_cod
>  #define LANG_HOOKS_GET_SUBRANGE_BOUNDS NULL
>  #define LANG_HOOKS_DESCRIPTIVE_TYPENULL
>  #define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
> +#define LANG_HOOKS_UPC_TOGGLE_KEYWORDS  lhd_do_nothing_b
> +#define LANG_HOOKS_UPC_PTS_INIT_TYPE  lhd_do_nothing
> +#define LANG_HOOKS_UPC_BUILD_INIT_FUNC lhd_do_nothing_t
> +#define LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS lhd_do_nothing
>  #define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE lhd_enum_underlying_base_type
>
>  #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
> @@ -219,6 +225,8 @@ extern tree lhd_make_node (enum tree_cod
>  #define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR NULL
>  #define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null
>  #define LANG_HOOKS_OMP_FINISH_CLAUSE lhd_omp_finish_clause
> +#define LANG_HOOKS_LAYOUT_DECL_P hook_bool_tree_tree_false
> +#define LANG_HOOKS_LAYOUT_DECL lhd_do_nothing_t_t
>
>  #define LANG_HOOKS_DECLS { \
>LANG_HOOKS_GLOBAL_BINDINGS_P, \
> @@ -243,7 +251,9 @@ extern tree lhd_make_node (enum tree_cod
>

[UPC 05/22] language hooks changes

2015-11-30 Thread Gary Funck

Background
--

An overview email, describing the UPC-related changes is here:
  https://gcc.gnu.org/ml/gcc-patches/2015-12/msg5.html

The GUPC branch is described here:
  http://gcc.gnu.org/projects/gupc.html

The UPC-related source code differences are summarized here:
  http://gccupc.org/gupc-changes

All languages (c, c++, fortran, go, lto, objc, obj-c++) have been
bootstrapped; no test suite regressions were introduced,
relative to the GCC trunk.

If you are on the cc-list, your name was chosen either
because you are listed as a maintainer for the area that
applies to the patches described in this email, or you
were a frequent contributor of patches made to files listed
in this email.

In the change log entries included in each patch, the directory
containing the affected files is listed, followed by the files.
When the patches are applied, the change log entries will be
distributed to the appropriate ChangeLog file.

Overview


Two new UPC-specific 'decl' language hooks are defined and then called from
layout_decl() in stor-layout.c.  The layout_decl_p() function tests if
this is a UPC shared array declaration that requires special handling.
If it does, then layout_decl() is called.

A few new UPC-specific language hooks are defined in a 'upc' sub-structure
of the language hooks structure.  They are defined as
hooks because they are called from code in the 'c-family/' directory,
but are implemented in the 'c/' directory.

2015-11-30  Gary Funck  

gcc/
* langhooks-def.h (lhd_do_nothing_b, lhd_do_nothing_t_t):
New do nothing hook prototypes.
(LANG_HOOKS_UPC_TOGGLE_KEYWORDS,
LANG_HOOKS_UPC_PTS_INIT_TYPE, LANG_HOOKS_UPC_BUILD_INIT_FUNC,
LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS): New default UPC hooks.
* langhooks-def.h (LANG_HOOKS_LAYOUT_DECL_P, LANG_HOOKS_LAYOUT_DECL):
New language hook defaults.
(LANG_HOOKS_UPC): New.  Define UPC hooks structure.
* langhooks.c (lhd_do_nothing_b, lhd_do_nothing_t_t):
New do nothing hooks.
* langhooks.h (layout_decl_p, layout_decl): New language hooks.
(lang_hooks_for_upc): New UPC language hooks structure.
* stor-layout.c (layout_decl): Call the layout_decl_p() and
and layout_decl() hooks.
gcc/c/
* c-lang.c: #include "c-upc-lang.h".
#include "c-upc-low.h".
(LANG_HOOKS_UPC_TOGGLE_KEYWORDS, LANG_HOOKS_UPC_PTS_INIT_TYPE,
LANG_HOOKS_UPC_BUILD_INIT_FUNC, LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS,
LANG_HOOKS_LAYOUT_DECL_P, LANG_HOOKS_LAYOUT_DECL):
Override defaults.  Define UPC-specific hook routines.
* c-upc-lang.c: New.  Implement UPC-specific hook routines.
* c-upc-lang.h: New.  Define UPC-specific hook prototypes.

Index: gcc/langhooks-def.h
===
--- gcc/langhooks-def.h (.../trunk) (revision 231059)
+++ gcc/langhooks-def.h (.../branches/gupc) (revision 231080)
@@ -35,7 +35,9 @@ struct diagnostic_info;
 /* See langhooks.h for the definition and documentation of each hook.  */
 
 extern void lhd_do_nothing (void);
+extern void lhd_do_nothing_b (bool);
 extern void lhd_do_nothing_t (tree);
+extern void lhd_do_nothing_t_t (tree, tree);
 extern void lhd_do_nothing_f (struct function *);
 extern tree lhd_pass_through_t (tree);
 extern bool lhd_post_options (const char **);
@@ -175,6 +177,10 @@ extern tree lhd_make_node (enum tree_cod
 #define LANG_HOOKS_GET_SUBRANGE_BOUNDS NULL
 #define LANG_HOOKS_DESCRIPTIVE_TYPENULL
 #define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
+#define LANG_HOOKS_UPC_TOGGLE_KEYWORDS  lhd_do_nothing_b
+#define LANG_HOOKS_UPC_PTS_INIT_TYPE  lhd_do_nothing
+#define LANG_HOOKS_UPC_BUILD_INIT_FUNC lhd_do_nothing_t
+#define LANG_HOOKS_UPC_WRITE_GLOBAL_DECLS lhd_do_nothing
 #define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE lhd_enum_underlying_base_type
 
 #define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
@@ -219,6 +225,8 @@ extern tree lhd_make_node (enum tree_cod
 #define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR NULL
 #define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null
 #define LANG_HOOKS_OMP_FINISH_CLAUSE lhd_omp_finish_clause
+#define LANG_HOOKS_LAYOUT_DECL_P hook_bool_tree_tree_false
+#define LANG_HOOKS_LAYOUT_DECL lhd_do_nothing_t_t
 
 #define LANG_HOOKS_DECLS { \
   LANG_HOOKS_GLOBAL_BINDINGS_P, \
@@ -243,7 +251,9 @@ extern tree lhd_make_node (enum tree_cod
   LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, \
   LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR, \
   LANG_HOOKS_OMP_CLAUSE_DTOR, \
-  LANG_HOOKS_OMP_FINISH_CLAUSE \
+  LANG_HOOKS_OMP_FINISH_CLAUSE, \
+  LANG_HOOKS_LAYOUT_DECL_P, \
+  LANG_HOOKS_LAYOUT_DECL \
 }
 
 /* LTO hooks.  */
@@ -261,6 +271,13 @@ extern void lhd_end_section (void);
   LANG_HOOKS_END_SECTION \
 }
 
+#define LANG_HOOKS_UPC { \
+  LANG_HOOKS_UPC_TOGGLE_KEYWORDS, \
+  LANG_HOOKS_UPC_PTS_INIT_TYPE, \
+  LANG_HOOKS_UPC_BUILD_INIT_FUNC, \
+