Commit 219d92a4 by Anatoly Sokolov Committed by Anatoly Sokolov

frv.c (frv_function_value, [...]): New functions.

	* 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.

From-SVN: r153783
parent 34732b0a
2009-10-31 Anatoly Sokolov <aesok@post.ru>
* 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.
2009-10-31 Anatoly Sokolov <aesok@post.ru>
* config/mn10300/mn10300.c (mn10300_function_value): Make static, add
new 'outgoing' argument.
(mn10300_libcall_value, mn10300_function_value_regno_p): New
......@@ -62,6 +62,7 @@ extern rtx frv_function_arg (CUMULATIVE_ARGS *,
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 *);
......
......@@ -273,6 +273,10 @@ static void frv_print_operand_memory_reference_reg
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 @@ static void frv_trampoline_init (rtx, tree, rtx);
#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 @@ frv_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
}
/* 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
......
......@@ -1746,48 +1746,7 @@ typedef struct frv_stack {
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).
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)
#define FUNCTION_VALUE_REGNO_P(REGNO) frv_function_value_regno_p (REGNO)
/* How Large Values are Returned. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment