* config/alpha/alpha.c (alpha_return_in_memory): On VMS, ensure
authorrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Aug 2009 16:33:41 +0000 (16:33 +0000)
committerrupp <rupp@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Aug 2009 16:33:41 +0000 (16:33 +0000)
that records that fit in 64 bits are returned by immediate value,
as required by OpenVMS Calling Standard.
(function_value): Adjust for above modification.
(alpha_va_start) <TARGET_ABI_OPEN_VMS>: Use
virtual_incoming_args_rtx as base object, not next_arg.
* config/alpha/vms.h: (DEFAULT_PCC_STRUCT_RETURN): Define as 0.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150652 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/vms.h

index 8aaa865..74736d6 100644 (file)
@@ -1,3 +1,15 @@
+2009-08-11  Vasiliy Fofanov  <fofanov@adacore.com>
+            Eric Botcazou  <botcazou@adacore.com>
+            Douglas B Rupp  <rupp@gnat.com>
+
+       * config/alpha/alpha.c (alpha_return_in_memory): On VMS, ensure
+       that records that fit in 64 bits are returned by immediate value,
+       as required by OpenVMS Calling Standard.
+       (function_value): Adjust for above modification.
+       (alpha_va_start) <TARGET_ABI_OPEN_VMS>: Use
+       virtual_incoming_args_rtx as base object, not next_arg.
+       * config/alpha/vms.h: (DEFAULT_PCC_STRUCT_RETURN): Define as 0.
+
 2009-08-11  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        * reload.c (find_reloads_subreg_address): Check the original
index a1ec736..ccf9288 100644 (file)
@@ -5771,7 +5771,14 @@ alpha_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
     {
       mode = TYPE_MODE (type);
 
-      /* All aggregates are returned in memory.  */
+      /* All aggregates are returned in memory, except on OpenVMS where
+        records that fit 64 bits should be returned by immediate value
+        as required by section 3.8.7.1 of the OpenVMS Calling Standard.  */
+      if (TARGET_ABI_OPEN_VMS
+         && TREE_CODE (type) != ARRAY_TYPE
+         && (unsigned HOST_WIDE_INT) int_size_in_bytes(type) <= 8)
+       return false;
+
       if (AGGREGATE_TYPE_P (type))
        return true;
     }
@@ -5842,7 +5849,10 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
   switch (mclass)
     {
     case MODE_INT:
-      PROMOTE_MODE (mode, dummy, valtype);
+      /* Do the same thing as PROMOTE_MODE except for libcalls on VMS,
+        where we have them returning both SImode and DImode.  */
+      if (!(TARGET_ABI_OPEN_VMS && valtype && AGGREGATE_TYPE_P (valtype)))
+        PROMOTE_MODE (mode, dummy, valtype);
       /* FALLTHRU */
 
     case MODE_COMPLEX_INT:
@@ -5867,6 +5877,12 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
                                         GEN_INT (GET_MODE_SIZE (cmode)))));
       }
 
+    case MODE_RANDOM:
+      /* We should only reach here for BLKmode on VMS.  */
+      gcc_assert (TARGET_ABI_OPEN_VMS && mode == BLKmode);
+      regnum = 0;
+      break;
+
     default:
       gcc_unreachable ();
     }
@@ -6260,12 +6276,11 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
 
   if (TARGET_ABI_OPEN_VMS)
     {
-      nextarg = plus_constant (nextarg, offset);
-      nextarg = plus_constant (nextarg, NUM_ARGS * UNITS_PER_WORD);
-      t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist,
-                 make_tree (ptr_type_node, nextarg));
+      t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
+      t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t,
+                size_int (offset + NUM_ARGS * UNITS_PER_WORD));
+      t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
       TREE_SIDE_EFFECTS (t) = 1;
-
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
   else
index 3aff33c..819dee4 100644 (file)
@@ -191,9 +191,7 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
      (CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED);             \
     }
 
-/* ABI has stack checking, but it's broken.  */
-#undef STACK_CHECK_BUILTIN
-#define STACK_CHECK_BUILTIN 0
+#define DEFAULT_PCC_STRUCT_RETURN 0
 
 #undef  ASM_WEAKEN_LABEL
 #define ASM_WEAKEN_LABEL(FILE, NAME)                            \