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]

[patch] cris: Hookize some target macros.


Hi,

Attached is a patch to hookize some target macros.

Since I am planning to poison STRUCT_VALUE_REGNUM once I complete the
migration, I renamed STRUCT_VALUE_REGNUM to CRIS_STRUCT_VALUE_REGNUM.

Built cc1 of cris-elf.  OK to apply?

Kazu Hirata

2004-01-24  Kazu Hirata  <kazu@cs.umass.edu>

	* config/cris/cris.c (TARGET_PROMOTE_FUNCTION_ARGS): New.
	(TARGET_STRUCT_VALUE_RTX): Likewise.
	(cris_struct_value_rtx): Likewise.
	* config/cris/cris.h (PROMOTE_FUNCTION_ARGS): Remove.
	(CRIS_STACKADJ_REG): Use CRIS_STRUCT_VALUE_REGNUM instead of
	STRUCT_VALUE_REGNUM.
	(STRUCT_VALUE_REGNUM): Rename to CRIS_STRUCT_VALUE_REGNUM.

Index: cris.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.c,v
retrieving revision 1.47
diff -u -r1.47 cris.c
--- cris.c	18 Jan 2004 22:37:28 -0000	1.47
+++ cris.c	24 Jan 2004 21:04:03 -0000
@@ -92,6 +92,8 @@
 
 static struct machine_function * cris_init_machine_status (void);
 
+static rtx cris_struct_value_rtx (tree, int);
+
 static int cris_initial_frame_pointer_offset (void);
 
 static int saved_regs_mentioned (rtx);
@@ -176,6 +178,12 @@
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST cris_address_cost
 
+#undef TARGET_PROMOTE_FUNCTION_ARGS
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+
+#undef TARGET_STRUCT_VALUE_RTX
+#define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Predicate functions.  */
@@ -3175,6 +3183,13 @@
     default:
       LOSE_AND_RETURN ("unexpected address expression", x);
     }
+}
+
+static rtx
+cris_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
+		       int incoming ATTRIBUTE_UNUSED)
+{
+  return gen_rtx_REG (Pmode, CRIS_STRUCT_VALUE_REGNUM);
 }
 
 #if 0
Index: cris.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.h,v
retrieving revision 1.60
diff -u -r1.60 cris.h
--- cris.h	13 Dec 2003 04:44:04 -0000	1.60
+++ cris.h	24 Jan 2004 21:04:04 -0000
@@ -476,7 +476,8 @@
 
 #define UNITS_PER_WORD 4
 
-/* A combination of defining PROMOTE_MODE, PROMOTE_FUNCTION_ARGS,
+/* A combination of defining PROMOTE_MODE,
+   TARGET_PROMOTE_FUNCTION_ARGS that always returns true,
    PROMOTE_FOR_CALL_ONLY and *not* defining PROMOTE_PROTOTYPES gives the
    best code size and speed for gcc, ipps and products in gcc-2.7.2.  */
 #define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \
@@ -486,14 +487,12 @@
 #define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE)  \
   (MODE) = CRIS_PROMOTED_MODE (MODE, UNSIGNEDP, TYPE)
 
-#define PROMOTE_FUNCTION_ARGS
-
 /* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovers bug 981110 (even
    if defining FUNCTION_VALUE with MODE as PROMOTED_MODE ;-)
 
    FIXME: Report this when cris.h is part of GCC, so others can easily
    see the problem.  Maybe check other systems that define
-   PROMOTE_FUNCTION_RETURN.  */
+   TARGET_PROMOTE_FUNCTION_RETURN that always returns true.  */
 #define PROMOTE_FOR_CALL_ONLY
 
 /* We will be using prototype promotion, so they will be 32 bit.  */
@@ -832,7 +831,7 @@
   (IN_RANGE ((N), 0, 3) ? (CRIS_FIRST_ARG_REG + 3 - (N)) : INVALID_REGNUM)
 
 /* Store the stack adjustment in the structure-return-address register.  */
-#define CRIS_STACKADJ_REG STRUCT_VALUE_REGNUM
+#define CRIS_STACKADJ_REG CRIS_STRUCT_VALUE_REGNUM
 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, CRIS_STACKADJ_REG)
 
 #define EH_RETURN_HANDLER_RTX \
@@ -897,8 +896,9 @@
 /* Node: Stack Arguments */
 
 /* Since many parameters take up one register each in any case,
-   PROMOTE_PROTOTYPES would seem like a good idea, but measurements
-   indicate that a combination using PROMOTE_MODE is better.  */
+   defining TARGET_PROMOTE_PROTOTYPES that always returns true would
+   seem like a good idea, but measurements indicate that a combination
+   using PROMOTE_MODE is better.  */
 
 #define ACCUMULATE_OUTGOING_ARGS 1
 
@@ -992,7 +992,7 @@
  ((unsigned) int_size_in_bytes (TYPE) > CRIS_MAX_ARGS_IN_REGS * UNITS_PER_WORD)
 #endif
 
-#define STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
+#define CRIS_STRUCT_VALUE_REGNUM ((CRIS_FIRST_ARG_REG) - 1)
 
 
 /* Node: Caller Saves */


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