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]

alpha target hook updates


        * config/alpha/alpha.c (alpha_return_in_memory): Rename from
        return_in_memory, make static, change signature to match target hook.
        (alpha_setup_incoming_varargs): Make static, change signature to
        match target hook, add code for vms and unicos.
        (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
        TARGET_PROMOTE_PROTOTYPES, TARGET_STRUCT_VALUE_RTX,
        TARGET_RETURN_IN_MEMORY, TARGET_SETUP_INCOMING_VARARGS,
        TARGET_STRICT_ARGUMENT_NAMING,
        TARGET_PRETEND_OUTGOING_VARARGS_NAMED): New.
        * config/alpha/alpha-protos.h: Update.
        * config/alpha/alpha.h (PROMOTE_FUNCTION_ARGS,
        PROMOTE_FUNCTION_RETURN, RETURN_IN_MEMORY,
        SETUP_INCOMING_VARARGS): Remove.
        * config/alpha/unicosmk.h (SETUP_INCOMING_VARARGS): Remove.
        * config/alpha/vms.h (SETUP_INCOMING_VARARGS): Remove.

Index: alpha-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha-protos.h,v
retrieving revision 1.50
diff -c -p -d -r1.50 alpha-protos.h
*** alpha-protos.h	27 Sep 2003 04:48:11 -0000	1.50
--- alpha-protos.h	11 Oct 2003 16:14:48 -0000
*************** extern void print_operand_address (FILE 
*** 130,142 ****
  extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int);
  
  extern tree alpha_build_va_list (void);
- extern void alpha_setup_incoming_varargs (CUMULATIVE_ARGS, enum machine_mode,
- 					  tree, int *, int);
  extern void alpha_va_start (tree, rtx);
  extern rtx alpha_va_arg (tree, tree);
  extern rtx function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int);
  extern rtx function_value (tree, tree, enum machine_mode);
- extern bool return_in_memory (tree, enum machine_mode);
  
  extern void alpha_start_function (FILE *, const char *, tree);
  extern void alpha_end_function (FILE *, const char *, tree);
--- 130,139 ----
Index: alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.331
diff -c -p -d -r1.331 alpha.c
*** alpha.c	10 Oct 2003 18:25:26 -0000	1.331
--- alpha.c	11 Oct 2003 16:14:55 -0000
*************** function_arg (CUMULATIVE_ARGS cum, enum 
*** 5983,5991 ****
  
  /* Return true if TYPE must be returned in memory, instead of in registers.  */
  
! bool
! return_in_memory (tree type, enum machine_mode mode)
  {
    int size;
  
    if (type)
--- 5983,5992 ----
  
  /* Return true if TYPE must be returned in memory, instead of in registers.  */
  
! static bool
! alpha_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
  {
+   enum machine_mode mode = VOIDmode;
    int size;
  
    if (type)
*************** function_value (tree valtype, tree func 
*** 6043,6049 ****
    enum mode_class class;
  
  #ifdef ENABLE_CHECKING
!   if (return_in_memory (valtype, mode))
      abort ();
  #endif
  
--- 6044,6050 ----
    enum mode_class class;
  
  #ifdef ENABLE_CHECKING
!   if (alpha_return_in_memory (valtype, func))
      abort ();
  #endif
  
*************** alpha_build_va_list (void)
*** 6118,6144 ****
  }
  
  /* Perform any needed actions needed for a function that is receiving a
!    variable number of arguments. 
  
!    On the Alpha, we allocate space for all 12 arg registers, but only
!    push those that are remaining.  However, if NO registers need to be
!    saved, don't allocate any space.  This is not only because we won't
!    need the space, but because AP includes the current_pretend_args_size
!    and we don't want to mess up any ap-relative addresses already made.
  
!    If we are not to use the floating-point registers, save the integer
!    registers where we would put the floating-point registers.  This is
!    not the most efficient way to implement varargs with just one register
!    class, but it isn't worth doing anything more efficient in this rare
!    case.  */
  
- #if TARGET_ABI_OSF
- void
- alpha_setup_incoming_varargs(CUMULATIVE_ARGS cum,
- 			     enum machine_mode mode ATTRIBUTE_UNUSED,
- 			     tree type ATTRIBUTE_UNUSED,
- 			     int *pretend_size, int no_rtl)
- {
    if (cum >= 6)
      return;
  
--- 6119,6177 ----
  }
  
  /* Perform any needed actions needed for a function that is receiving a
!    variable number of arguments.  */
  
! static void
! alpha_setup_incoming_varargs (CUMULATIVE_ARGS *pcum,
! 			      enum machine_mode mode ATTRIBUTE_UNUSED,
! 			      tree type ATTRIBUTE_UNUSED,
! 			      int *pretend_size, int no_rtl)
! {
! #if TARGET_ABI_UNICOSMK
!   /* On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register
!      arguments on the stack. Unfortunately, it doesn't always store the first
!      one (i.e. the one that arrives in $16 or $f16). This is not a problem
!      with stdargs as we always have at least one named argument there.  */
!   int num_reg_words = pcum->num_reg_words;
!   if (num_reg_words < 6)
!     {
!       if (!no_rtl)
! 	{
! 	  emit_insn (gen_umk_mismatch_args (GEN_INT (num_reg_words + 1)));
! 	  emit_insn (gen_arg_home_umk ());
! 	}
!       *pretend_size = 0;
!     }
! #elif TARGET_ABI_OPEN_VMS
!   /* For VMS, we allocate space for all 6 arg registers plus a count.
  
!      However, if NO registers need to be saved, don't allocate any space.
!      This is not only because we won't need the space, but because AP
!      includes the current_pretend_args_size and we don't want to mess up
!      any ap-relative addresses already made.  */
!   if (pcum->num_args < 6)
!     {
!       if (!no_rtl)
! 	{
! 	  emit_move_insn (gen_rtx_REG (DImode, 1), virtual_incoming_args_rtx);
! 	  emit_insn (gen_arg_home ());
! 	}
!       *pretend_size = 7 * UNITS_PER_WORD;
!     }
! #else
!   /* On OSF/1 and friends, we allocate space for all 12 arg registers, but
!      only push those that are remaining.  However, if NO registers need to
!      be saved, don't allocate any space.  This is not only because we won't
!      need the space, but because AP includes the current_pretend_args_size
!      and we don't want to mess up any ap-relative addresses already made.
! 
!      If we are not to use the floating-point registers, save the integer
!      registers where we would put the floating-point registers.  This is
!      not the most efficient way to implement varargs with just one register
!      class, but it isn't worth doing anything more efficient in this rare
!      case.  */
!   CUMULATIVE_ARGS cum = *pcum;
  
    if (cum >= 6)
      return;
  
*************** alpha_setup_incoming_varargs(CUMULATIVE_
*** 6161,6168 ****
  			   6 - cum);
       }
    *pretend_size = 12 * UNITS_PER_WORD;
- }
  #endif
  
  void
  alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
--- 6194,6201 ----
  			   6 - cum);
       }
    *pretend_size = 12 * UNITS_PER_WORD;
  #endif
+ }
  
  void
  alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
*************** alpha_init_libfuncs (void)
*** 10145,10150 ****
--- 10178,10200 ----
  
  #undef TARGET_MACHINE_DEPENDENT_REORG
  #define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg
+ 
+ #undef TARGET_PROMOTE_FUNCTION_ARGS
+ #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+ #undef TARGET_PROMOTE_FUNCTION_RETURN
+ #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+ #undef TARGET_PROMOTE_PROTOTYPES
+ #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false
+ #undef TARGET_STRUCT_VALUE_RTX
+ #define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
+ #undef TARGET_RETURN_IN_MEMORY
+ #define TARGET_RETURN_IN_MEMORY alpha_return_in_memory
+ #undef TARGET_SETUP_INCOMING_VARARGS
+ #define TARGET_SETUP_INCOMING_VARARGS alpha_setup_incoming_varargs
+ #undef TARGET_STRICT_ARGUMENT_NAMING
+ #define TARGET_STRICT_ARGUMENT_NAMING hook_bool_CUMULATIVE_ARGS_true
+ #undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED
+ #define TARGET_PRETEND_OUTGOING_VARARGS_NAMED hook_bool_CUMULATIVE_ARGS_true
  
  struct gcc_target targetm = TARGET_INITIALIZER;
  
Index: alpha.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.h,v
retrieving revision 1.206
diff -c -p -d -r1.206 alpha.h
*** alpha.h	1 Oct 2003 06:01:47 -0000	1.206
--- alpha.h	11 Oct 2003 16:14:56 -0000
*************** extern const char *alpha_tls_size_string
*** 461,475 ****
        (MODE) = DImode;				\
      }
  
- /* Define this if function arguments should also be promoted using the above
-    procedure.  */
- 
- #define PROMOTE_FUNCTION_ARGS
- 
- /* Likewise, if the function return value is promoted.  */
- 
- #define PROMOTE_FUNCTION_RETURN
- 
  /* Define this if most significant bit is lowest numbered
     in instructions that operate on numbered bit-fields.
  
--- 461,466 ----
*************** extern int alpha_memory_latency;
*** 1003,1017 ****
  #define LIBCALL_VALUE(MODE) \
    function_value (NULL, NULL, MODE)
  
- /* The definition of this macro implies that there are cases where
-    a scalar value cannot be returned in registers.
- 
-    For the Alpha, any structure or union type is returned in memory, as
-    are integers whose size is larger than 64 bits.  */
- 
- #define RETURN_IN_MEMORY(TYPE) \
-   return_in_memory (TYPE, VOIDmode)
- 
  /* 1 if N is a possible register number for a function value
     as seen by the caller.  */
  
--- 994,999 ----
*************** extern int alpha_memory_latency;
*** 1095,1105 ****
  #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED)	\
  ((CUM) < 6 && 6 < (CUM) + ALPHA_ARG_SIZE (MODE, TYPE, NAMED)	\
   ? 6 - (CUM) : 0)
- 
- /* Perform any needed actions needed for a function that is receiving a
-    variable number of arguments.  */
- #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
-   alpha_setup_incoming_varargs(CUM,MODE,TYPE,&(PRETEND_SIZE),NO_RTL)
  
  /* Try to output insns to set TARGET equal to the constant C if it can be
     done in less than N insns.  Do all computations in MODE.  Returns the place
--- 1077,1082 ----
Index: unicosmk.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/unicosmk.h,v
retrieving revision 1.24
diff -c -p -d -r1.24 unicosmk.h
*** unicosmk.h	2 Oct 2003 00:44:14 -0000	1.24
--- unicosmk.h	11 Oct 2003 16:14:57 -0000
*************** do {								\
*** 223,252 ****
  #undef FUNCTION_ARG_PARTIAL_NREGS
  /* #define FUNCTION_ARG_PARTIAL_NREGS(CUM,MODE,TYPE,NAMED) 0 */
  
- /* Perform any needed actions needed for a function that is receiving a
-    variable number of arguments.
- 
-    On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register
-    arguments on the stack. Unfortunately, it doesn't always store the first
-    one (i.e. the one that arrives in $16 or $f16). This is not a problem
-    with stdargs as we always have at least one named argument there.  */
- 
- #undef SETUP_INCOMING_VARARGS
- #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL)	\
- { if ((CUM).num_reg_words < 6)						\
-     {									\
-       if (! (NO_RTL))							\
-         {								\
- 	  int start = (CUM).num_reg_words + 1;				\
- 									\
-           emit_insn (gen_umk_mismatch_args (GEN_INT (start)));		\
- 	  emit_insn (gen_arg_home_umk ());				\
-         }								\
- 									\
-       PRETEND_SIZE = 0;							\
-     }									\
- }
- 
  /* This ensures that $15 increments/decrements in leaf functions won't get
     eliminated.  */
  
--- 223,228 ----
Index: vms.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/vms.h,v
retrieving revision 1.75
diff -c -p -d -r1.75 vms.h
*** vms.h	2 Oct 2003 00:44:14 -0000	1.75
--- vms.h	11 Oct 2003 16:14:57 -0000
*************** typedef struct {int num_args; enum avms_
*** 202,243 ****
     + ALPHA_ARG_SIZE (MODE, TYPE, NAMED)					\
   ? 6 - (CUM).num_args : 0)
  
- /* Perform any needed actions needed for a function that is receiving a
-    variable number of arguments. 
- 
-    CUM is as for INIT_CUMULATIVE_ARGS.
- 
-    MODE and TYPE are the mode and type of the current parameter.
- 
-    PRETEND_SIZE is a variable that should be set to the amount of stack
-    that must be pushed by the prolog to pretend that our caller pushed
-    it.
- 
-    Normally, this macro will push all remaining incoming registers on the
-    stack and set PRETEND_SIZE to the length of the registers pushed. 
- 
-    For VMS, we allocate space for all 6 arg registers plus a count.
- 
-    However, if NO registers need to be saved, don't allocate any space.
-    This is not only because we won't need the space, but because AP includes
-    the current_pretend_args_size and we don't want to mess up any
-    ap-relative addresses already made.  */
- 
- #undef SETUP_INCOMING_VARARGS
- #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL)	\
- { if ((CUM).num_args < 6)				\
-     {							\
-       if (! (NO_RTL))					\
- 	{						\
- 	  emit_move_insn (gen_rtx_REG (DImode, 1),	\
- 			  virtual_incoming_args_rtx);	\
- 	  emit_insn (gen_arg_home ());			\
- 	}						\
- 						        \
-       PRETEND_SIZE = 7 * UNITS_PER_WORD;		\
-     }							\
- }
- 
  /* ABI has stack checking, but it's broken.  */
  #undef STACK_CHECK_BUILTIN
  #define STACK_CHECK_BUILTIN 0
--- 202,207 ----


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