diff mbox

[UPC,06/22] target hooks

Message ID 20151201060236.GA31098@intrepid.com
State New
Headers show

Commit Message

Gary Funck Dec. 1, 2015, 6:02 a.m. UTC
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
--------

Four new target hooks are defined for UPC.  They relate to naming
the various linker sections used by UPC as well as testing for
the availability of the "UPC linker script" feature.

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

	gcc/
	* defaults.h (UPC_SHARED_SECTION_NAME): New macro.
	(UPC_PGM_INFO_SECTION_NAME): New macro.
	(UPC_INIT_ARRAY_SECTION_NAME): New macro.
	* target.def (upc): New hook prefix.
	(link_script_p, shared_section_name,
	pgm_info_section_name, init_array_section_name):
	New target hook definitions.
	* targhooks.c (default_upc_link_script_p,
	default_upc_shared_section_name, default_upc_pgm_info_section_name,
	default_upc_init_array_section_name): New default target hooks.
	* targhooks.h (default_upc_link_script_p,
	default_upc_shared_section_name, default_upc_pgm_info_section_name,
	default_upc_init_array_section_name): New target hook prototypes.
diff mbox

Patch

Index: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(.../trunk)	(revision 231059)
+++ gcc/defaults.h	(.../branches/gupc)	(revision 231080)
@@ -1488,4 +1488,23 @@  see the files COPYING3 and COPYING.RUNTI
 
 #endif /* GCC_INSN_FLAGS_H  */
 
+/* UPC section names.  */
+
+/* Name of section used to assign addresses to shared data items.  */
+#ifndef UPC_SHARED_SECTION_NAME
+#define UPC_SHARED_SECTION_NAME "upc_shared"
+#endif
+
+/* Name of section used to hold info. describing how
+   a UPC source file was compiled.  */
+#ifndef UPC_PGM_INFO_SECTION_NAME
+#define UPC_PGM_INFO_SECTION_NAME "upc_pgm_info"
+#endif
+
+/* Name of section that holds an array of addresses that points to 
+   the UPC initialization routines.  */
+#ifndef UPC_INIT_ARRAY_SECTION_NAME
+#define UPC_INIT_ARRAY_SECTION_NAME "upc_init_array"
+#endif
+
 #endif  /* ! GCC_DEFAULTS_H */
Index: gcc/target.def
===================================================================
--- gcc/target.def	(.../trunk)	(revision 231059)
+++ gcc/target.def	(.../branches/gupc)	(revision 231080)
@@ -5496,6 +5496,41 @@  DEFHOOK
 
 HOOK_VECTOR_END (cxx)
 
+/* Functions and data for UPC support.  */
+#undef HOOK_PREFIX
+#define HOOK_PREFIX "TARGET_UPC_"
+HOOK_VECTOR (TARGET_UPC, upc)
+
+DEFHOOK
+(link_script_p,
+"This hook returns true if a linker script will be used to\
+ origin the UPC shared section at 0.",
+ bool, (void),
+ default_upc_link_script_p)
+
+DEFHOOK
+(shared_section_name,
+"This hook returns the name of the section used to assign addresses to\
+ UPC shared data items.",
+ const char *, (void),
+ default_upc_shared_section_name)
+
+DEFHOOK
+(pgm_info_section_name,
+"This hook returns the name of the section used to hold information\
+ describing how a UPC source file was compiled.",
+ const char *, (void),
+ default_upc_pgm_info_section_name)
+
+DEFHOOK
+(init_array_section_name,
+"This hook returns the name of the section used to hold an array\
+ of addresses of UPC initialization routines.",
+ const char *, (void),
+ default_upc_init_array_section_name)
+
+HOOK_VECTOR_END (upc)
+
 /* Functions and data for emulated TLS support.  */
 #undef HOOK_PREFIX
 #define HOOK_PREFIX "TARGET_EMUTLS_"
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(.../trunk)	(revision 231059)
+++ gcc/targhooks.c	(.../branches/gupc)	(revision 231080)
@@ -1955,4 +1955,32 @@  can_use_doloop_if_innermost (const wides
   return loop_depth == 1;
 }
 
+bool
+default_upc_link_script_p (void)
+{
+#ifdef HAVE_UPC_LINK_SCRIPT
+  return true;
+#else
+  return false;
+#endif
+}
+
+const char *
+default_upc_shared_section_name (void)
+{
+  return UPC_SHARED_SECTION_NAME;
+}
+
+const char *
+default_upc_pgm_info_section_name (void)
+{
+  return UPC_PGM_INFO_SECTION_NAME;
+}
+
+const char *
+default_upc_init_array_section_name (void)
+{
+  return UPC_INIT_ARRAY_SECTION_NAME;
+}
+
 #include "gt-targhooks.h"
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(.../trunk)	(revision 231059)
+++ gcc/targhooks.h	(.../branches/gupc)	(revision 231080)
@@ -250,4 +250,9 @@  extern void default_setup_incoming_varar
 						  tree type ATTRIBUTE_UNUSED,
 						  int *pretend_arg_size ATTRIBUTE_UNUSED,
 						  int second_time ATTRIBUTE_UNUSED);
+extern bool default_upc_link_script_p (void);
+extern const char *default_upc_shared_section_name (void);
+extern const char *default_upc_pgm_info_section_name (void);
+extern const char *default_upc_init_array_section_name (void);
+
 #endif /* GCC_TARGHOOKS_H */