On Mon, 30 Nov 2015, Gary Funck wrote: > > 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.
Like I said elsewhere this is purely middle-end code and thus may not call langhooks. > 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 <g...@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))) As the addr-space check is right below the place you change - why are incompatible UPC shared pointers not using different address-spaces then? That is, why are you introducing a different kind of "address space" representation? Richard. > 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 *, > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)