This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[UPC 16/22] gimple/gimplify changes


Background
----------

An overview email, describing the UPC-related changes is here:
  https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00005.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
--------

In gimple-expr.c, logic is added to useless_type_conversion_p() to
handle conversions involving UPC pointers-to-shared.
lang_hooks.types_compatible_p() is called to check conversions
between UPC pointers-to-shared.  This will in turn call c_types_compatible_p()
which will call upc_types_compatible_p() if -fupc is asserted.

The hook is needed here because the gimple-related routines are
defined at the top-level of the GCC tree and can be linked with
other front-ends.

In gimplify.c, flag_instrument_functions_exclude_p() is exported
as an external function rather than being defined as a static function.
It is called from upc_genericize_function() defined in c/c-upc-low.c,
when -fupc-instrument-functions is asserted.

2015-11-30  Gary Funck  <gary@intrepid.com>

	gcc/
	* gimple-expr.c: #include "langhooks.h".
	(useless_type_conversion_p): Retain conversions from UPC
	pointer-to-shared and a regular C pointer.
	Retain conversions between incompatible UPC pointers-to-shared.
	Call lang_hooks.types_compatible_p() to check type
	compatibility between UPC pointers-to-shared.
	* gimplify.c (flag_instrument_functions_exclude_p): Make it into
	an external function.
	* gimplify.h (flag_instrument_functions_exclude_p): New prototype.

Index: gcc/gimple-expr.c
===================================================================
--- gcc/gimple-expr.c	(.../trunk)	(revision 231059)
+++ gcc/gimple-expr.c	(.../branches/gupc)	(revision 231080)
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3.
 #include "gimple-ssa.h"
 #include "fold-const.h"
 #include "tree-eh.h"
+#include "langhooks.h"
 #include "gimplify.h"
 #include "stor-layout.h"
 #include "demangle.h"
@@ -67,6 +68,19 @@ useless_type_conversion_p (tree outer_ty
   if (POINTER_TYPE_P (inner_type)
       && POINTER_TYPE_P (outer_type))
     {
+      int i_shared = SHARED_TYPE_P (TREE_TYPE (inner_type));
+      int o_shared = SHARED_TYPE_P (TREE_TYPE (outer_type));
+
+      /* Retain conversions from a UPC shared pointer to
+         a regular C pointer.  */
+      if (!o_shared && i_shared)
+        return false;
+
+      /* Retain conversions between incompatible UPC shared pointers.  */
+      if (o_shared && i_shared
+	  && !lang_hooks.types_compatible_p (inner_type, outer_type))
+        return false;
+
       /* Do not lose casts between pointers to different address spaces.  */
       if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
 	  != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	(.../trunk)	(revision 231059)
+++ gcc/gimplify.c	(.../branches/gupc)	(revision 231080)
@@ -11269,7 +11269,7 @@ typedef char *char_p; /* For DEF_VEC_P.
 
 /* Return whether we should exclude FNDECL from instrumentation.  */
 
-static bool
+bool
 flag_instrument_functions_exclude_p (tree fndecl)
 {
   vec<char_p> *v;
Index: gcc/gimplify.h
===================================================================
--- gcc/gimplify.h	(.../trunk)	(revision 231059)
+++ gcc/gimplify.h	(.../branches/gupc)	(revision 231080)
@@ -77,6 +77,7 @@ extern enum gimplify_status gimplify_exp
 extern void gimplify_type_sizes (tree, gimple_seq *);
 extern void gimplify_one_sizepos (tree *, gimple_seq *);
 extern gbind *gimplify_body (tree, bool);
+extern bool flag_instrument_functions_exclude_p (tree);
 extern enum gimplify_status gimplify_arg (tree *, gimple_seq *, location_t);
 extern void gimplify_function_tree (tree);
 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]