diff mbox

[UPC,09/22] target - x86

Message ID 20151201060236.GA31156@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
--------

UPC pointers-to-shared use a struct to describe their internal
representation.  For efficiency and correctness, ensure that if the struct's
mode is TIMode that a pointer-to-shared parameter is passed in registers.  
Note that the parameter passing logic forces "C" pointer type parameters
to be 'word mode', but that rule doesn't apply to UPC pointers-to-shared
due to their "fat" struct representation.

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

	gcc/config/i386/
	* i386.c (classify_argument): check for UPC pointer-to-shared,
	on 64-bit target.
	(function_value_64): Do not force UPC pointers-to-shared
	to be returned in word mode.
diff mbox

Patch

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(.../trunk)	(revision 231059)
+++ gcc/config/i386/i386.c	(.../branches/gupc)	(revision 231080)
@@ -7943,6 +7943,15 @@  classify_argument (machine_mode mode, co
       && targetm.calls.must_pass_in_stack (mode, type))
     return 0;
 
+  /* Special case check for pointer to shared, on 64-bit target.  */
+  if (TARGET_64BIT && mode == TImode
+      && type && TREE_CODE (type) == POINTER_TYPE
+      && SHARED_TYPE_P (TREE_TYPE (type)))
+    {
+      classes[0] = classes[1] = X86_64_INTEGER_CLASS;
+      return 2;
+    }
+
   if (type && AGGREGATE_TYPE_P (type))
     {
       int i;
@@ -9536,7 +9545,8 @@  function_value_64 (machine_mode orig_mod
 
       return gen_rtx_REG (mode, regno);
     }
-  else if (POINTER_TYPE_P (valtype))
+  else if (POINTER_TYPE_P (valtype)
+           && !SHARED_TYPE_P (TREE_TYPE (valtype)))
     {
       /* Pointers are always returned in word_mode.  */
       mode = word_mode;
@@ -9680,6 +9690,11 @@  ix86_promote_function_mode (const_tree t
 {
   if (type != NULL_TREE && POINTER_TYPE_P (type))
     {
+      if (SHARED_TYPE_P (TREE_TYPE (type)))
+        {
+          *punsignedp = 1;
+          return TYPE_MODE (upc_pts_rep_type_node);
+	}
       *punsignedp = POINTERS_EXTEND_UNSIGNED;
       return word_mode;
     }