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]

Update VMS varargs handling for Alpha


Tested on alpha/vms.

Wed Dec  5 07:41:13 2001  Douglas B. Rupp  <rupp@gnat.com>

	* config/alpha/alpha.c (alpha_va_start): Update VMS case.

*** config/alpha/alpha.c	2001/11/18 12:43:14	1.206
--- config/alpha/alpha.c	2001/12/05 12:46:02
*************** alpha_va_start (stdarg_p, valist, nextar
*** 5483,5487 ****
      return;
  
!   if (TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK)
      std_expand_builtin_va_start (stdarg_p, valist, nextarg);
  
--- 5483,5487 ----
      return;
  
!   if (TARGET_ABI_UNICOSMK)
      std_expand_builtin_va_start (stdarg_p, valist, nextarg);
  
*************** alpha_va_start (stdarg_p, valist, nextar
*** 5496,5521 ****
  
    if (NUM_ARGS <= 5 + stdarg_p)
!     offset = 6 * UNITS_PER_WORD;
    else
      offset = -6 * UNITS_PER_WORD;
  
!   base_field = TYPE_FIELDS (TREE_TYPE (valist));
!   offset_field = TREE_CHAIN (base_field);
  
!   base_field = build (COMPONENT_REF, TREE_TYPE (base_field),
! 		      valist, base_field);
!   offset_field = build (COMPONENT_REF, TREE_TYPE (offset_field),
! 			valist, offset_field);
! 
!   t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
!   t = build (PLUS_EXPR, ptr_type_node, t, build_int_2 (offset, 0));
!   t = build (MODIFY_EXPR, TREE_TYPE (base_field), base_field, t);
!   TREE_SIDE_EFFECTS (t) = 1;
!   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
! 
!   t = build_int_2 (NUM_ARGS*UNITS_PER_WORD, 0);
!   t = build (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t);
!   TREE_SIDE_EFFECTS (t) = 1;
!   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
  }
  
--- 5496,5534 ----
  
    if (NUM_ARGS <= 5 + stdarg_p)
!     offset = TARGET_ABI_OPEN_VMS ? UNITS_PER_WORD : 6 * UNITS_PER_WORD;
    else
      offset = -6 * UNITS_PER_WORD;
  
!   if (TARGET_ABI_OPEN_VMS)
!     {
!       nextarg = plus_constant (nextarg, offset);
!       nextarg = plus_constant (nextarg, NUM_ARGS * UNITS_PER_WORD);
!       t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
! 		 make_tree (ptr_type_node, nextarg));
!       TREE_SIDE_EFFECTS (t) = 1;
  
!       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
!     }
!   else
!     {
!       base_field = TYPE_FIELDS (TREE_TYPE (valist));
!       offset_field = TREE_CHAIN (base_field);
! 
!       base_field = build (COMPONENT_REF, TREE_TYPE (base_field),
! 			  valist, base_field);
!       offset_field = build (COMPONENT_REF, TREE_TYPE (offset_field),
! 			    valist, offset_field);
! 
!       t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
!       t = build (PLUS_EXPR, ptr_type_node, t, build_int_2 (offset, 0));
!       t = build (MODIFY_EXPR, TREE_TYPE (base_field), base_field, t);
!       TREE_SIDE_EFFECTS (t) = 1;
!       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
! 
!       t = build_int_2 (NUM_ARGS * UNITS_PER_WORD, 0);
!       t = build (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t);
!       TREE_SIDE_EFFECTS (t) = 1;
!       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
!     }
  }
  


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