* [FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
@ 2009-10-25 13:37 Anatoly Sokolov
2009-10-26 17:24 ` Richard Henderson
0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Sokolov @ 2009-10-25 13:37 UTC (permalink / raw)
To: gcc-patches
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)
-
\f
/* 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 @@
}
\f
+/* 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);
+}
+
+\f
+/* 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);
+}
+
+\f
+/* Implements FUNCTION_VALUE_REGNO_P. */
+
+bool
+frv_function_value_regno_p (const unsigned int regno)
+{
+ return (regno == RETURN_VALUE_REGNUM);
+}
+\f
/* Return true if a register is ok to use as a base or index register. */
static FRV_INLINE int
Anatoly.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros.
2009-10-25 13:37 [FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros Anatoly Sokolov
@ 2009-10-26 17:24 ` Richard Henderson
0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2009-10-26 17:24 UTC (permalink / raw)
To: Anatoly Sokolov; +Cc: gcc-patches
On 10/25/2009 05:12 AM, Anatoly Sokolov wrote:
> * 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.
r~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-26 17:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-25 13:37 [FRV] Remove FUNCTION_VALUE and LIBCALL_VALUE macros Anatoly Sokolov
2009-10-26 17:24 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).