This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
- From: Anatoly Sokolov <aesok at post dot ru>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 25 Oct 2009 15:12:47 +0300
- Subject: [FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
Hello.
This patch removes obsolete FUNCTION_VALUE and LIBCALL_VALUE macros from
FRV back end in the GCC and introduces equivalent TARGET_FUNCTION_VALUE and
TARGET_LIBCALL_VALUE target hooks. Also this patch convert
FUNCTION_VALUE_REGNO_P macro to frv_function_value_regno_p function, this
should simplify hookize FUNCTION_VALUE_REGNO_P macro in the future.
Regression tested on frv-unknown-elf.
* config/frv/frv.c (frv_function_value, frv_libcall_value,
frv_function_value_regno_p): New functions.
(TARGET_FUNCTION_VALUE, TARGET_LIBCALL_VALUE): Declare.
* config/frv/frv.h: (FUNCTION_VALUE, LIBCALL_VALUE): Remove.
(FUNCTION_VALUE_REGNO_P): Redefine, use frv_function_value_regno_p.
* config/frv/frv-protos.h (frv_function_value_regno_p): Declare.
OK to install?
Index: gcc/config/frv/frv.h
===================================================================
--- gcc/config/frv/frv.h (revision 153538)
+++ gcc/config/frv/frv.h (working copy)
@@ -1746,49 +1746,8 @@
function call. */
#define RETURN_VALUE_REGNUM (GPR_FIRST + 8)
-/* A C expression to create an RTX representing the place where a function
- returns a value of data type VALTYPE. VALTYPE is a tree node representing a
- data type. Write `TYPE_MODE (VALTYPE)' to get the machine mode used to
- represent that type. On many machines, only the mode is relevant.
- (Actually, on most machines, scalar values are returned in the same place
- regardless of mode).
+#define FUNCTION_VALUE_REGNO_P(REGNO) frv_function_value_regno_p (REGNO)
- If the precise function being called is known, FUNC is a tree node
- (`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it
- possible to use a different value-returning convention for specific
- functions when all their calls are known.
-
- `FUNCTION_VALUE' is not used for return vales with aggregate data types,
- because these are returned in another way. See
- `TARGET_STRUCT_VALUE_RTX' and related macros, below. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- gen_rtx_REG (TYPE_MODE (VALTYPE), RETURN_VALUE_REGNUM)
-
-/* A C expression to create an RTX representing the place where a library
- function returns a value of mode MODE.
-
- Note that "library function" in this context means a compiler support
- routine, used to perform arithmetic, whose name is known specially by the
- compiler and was not mentioned in the C code being compiled.
-
- The definition of `LIBRARY_VALUE' need not be concerned aggregate data
- types, because none of the library functions returns such types. */
-#define LIBCALL_VALUE(MODE) gen_rtx_REG (MODE, RETURN_VALUE_REGNUM)
-
-/* A C expression that is nonzero if REGNO is the number of a hard register in
- which the values of called function may come back.
-
- A register whose use for returning values is limited to serving as the
- second of a pair (for a value of type `double', say) need not be recognized
- by this macro. So for most machines, this definition suffices:
-
- #define FUNCTION_VALUE_REGNO_P(N) ((N) == RETURN)
-
- If the machine has register windows, so that the caller and the called
- function use different registers for the return value, this macro should
- recognize only the caller's register numbers. */
-#define FUNCTION_VALUE_REGNO_P(REGNO) ((REGNO) == RETURN_VALUE_REGNUM)
-
/* How Large Values are Returned. */
Index: gcc/config/frv/frv-protos.h
===================================================================
--- gcc/config/frv/frv-protos.h (revision 153538)
+++ gcc/config/frv/frv-protos.h (working copy)
@@ -62,6 +62,7 @@
extern void frv_function_arg_advance (CUMULATIVE_ARGS *,
enum machine_mode,
tree, int);
+extern bool frv_function_value_regno_p (const unsigned int);
#endif /* TREE_CODE */
extern int frv_expand_block_move (rtx *);
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c (revision 153538)
+++ gcc/config/frv/frv.c (working copy)
@@ -273,6 +273,10 @@
static void frv_print_operand_memory_reference (FILE *, rtx, int);
static int frv_print_operand_jump_hint (rtx);
static const char *comparison_string (enum rtx_code, rtx);
+static rtx frv_function_value (const_tree, const_tree,
+ bool);
+static rtx frv_libcall_value (enum machine_mode,
+ const_rtx);
static FRV_INLINE int frv_regno_ok_for_base_p (int, int);
static rtx single_set_pattern (rtx);
static int frv_function_contains_far_jump (void);
@@ -483,6 +487,11 @@
#undef TARGET_TRAMPOLINE_INIT
#define TARGET_TRAMPOLINE_INIT frv_trampoline_init
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE frv_function_value
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE frv_libcall_value
+
struct gcc_target targetm = TARGET_INITIALIZER;
#define FRV_SYMBOL_REF_TLS_P(RTX) \
@@ -3291,6 +3300,35 @@
}
+/* Implements TARGET_FUNCTION_VALUE. */
+
+static rtx
+frv_function_value (const_tree valtype,
+ const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (TYPE_MODE (valtype), RETURN_VALUE_REGNUM);
+}
+
+
+/* Implements TARGET_LIBCALL_VALUE. */
+
+static rtx
+frv_libcall_value (enum machine_mode mode,
+ const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, RETURN_VALUE_REGNUM);
+}
+
+
+/* Implements FUNCTION_VALUE_REGNO_P. */
+
+bool
+frv_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == RETURN_VALUE_REGNUM);
+}
+
/* Return true if a register is ok to use as a base or index register. */
static FRV_INLINE int
Anatoly.