picochip-protos.h (picochip_function_arg): Delete.

* config/picochip/picochip-protos.h (picochip_function_arg): Delete.
	(picochip_incoming_function_arg): Delete.
	(picochip_arg_advance): Delete.
	* config/picochip/picochip.h (FUNCTION_ARG): Delete.
	(FUNCTION_INCOMING_ARG): Delete.
	(FUNCTION_ARG_ADVANCE): Delete.
	* config/picochip/picochip.c (picochip_function_arg): Take a
	const_tree and a bool.
	(picochip_incoming_function_arg): Likewise.
	(picochip_arg_advance): Likewise.
	(TARGET_FUNCTION_ARG, TARGET_FUNCTION_INCOMING_ARG): Define.
	(TARGET_FUNCTION_ARG_ADVANCE): Define.

From-SVN: r165312
This commit is contained in:
Hariharan Sandanagobalane 2010-10-11 14:52:16 +00:00 committed by Hariharan Sandanagobalane
parent 3414bf5384
commit c159751bf5
4 changed files with 53 additions and 46 deletions

View File

@ -1,3 +1,19 @@
2010-10-11 Hariharan Sandanagobalane <hariharan@picochip.com>
Nathan Froyds patch to hooks FUNCTION_ARG etc.
* config/picochip/picochip-protos.h (picochip_function_arg): Delete.
(picochip_incoming_function_arg): Delete.
(picochip_arg_advance): Delete.
* config/picochip/picochip.h (FUNCTION_ARG): Delete.
(FUNCTION_INCOMING_ARG): Delete.
(FUNCTION_ARG_ADVANCE): Delete.
* config/picochip/picochip.c (picochip_function_arg): Take a
const_tree and a bool.
(picochip_incoming_function_arg): Likewise.
(picochip_arg_advance): Likewise.
(TARGET_FUNCTION_ARG, TARGET_FUNCTION_INCOMING_ARG): Define.
(TARGET_FUNCTION_ARG_ADVANCE): Define.
2010-10-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR middle-end/45955

View File

@ -54,13 +54,6 @@ extern bool ok_to_peephole_ldw(rtx opnd0, rtx opnd1, rtx opnd2, rtx opnd3);
extern rtx gen_min_reg(rtx opnd1,rtx opnd2);
extern rtx picochip_function_arg (CUMULATIVE_ARGS cum, int mode, tree type,
int named);
extern rtx picochip_incoming_function_arg (CUMULATIVE_ARGS, int, tree, int);
extern CUMULATIVE_ARGS picochip_arg_advance (CUMULATIVE_ARGS cum, int mode,
tree type, int named);
extern int picochip_regno_nregs (int regno, int mode);
extern int picochip_class_max_nregs (int klass, int mode);

View File

@ -81,6 +81,14 @@ void picochip_reorg (void);
int picochip_arg_partial_bytes (CUMULATIVE_ARGS * p_cum,
enum machine_mode mode,
tree type, bool named);
rtx picochip_function_arg (CUMULATIVE_ARGS * p_cum,
enum machine_mode mode,
const_tree type, bool named);
rtx picochip_incoming_function_arg (CUMULATIVE_ARGS * p_cum,
enum machine_mode mode,
const_tree type, bool named);
void picochip_arg_advance (CUMULATIVE_ARGS * p_cum, enum machine_mode mode,
const_tree type, bool named);
int picochip_sched_lookahead (void);
int picochip_sched_issue_rate (void);
@ -262,6 +270,15 @@ static char picochip_get_vliw_alu_id (void);
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES picochip_arg_partial_bytes
#undef TARGET_FUNCTION_ARG
#define TARGET_FUNCTION_ARG picochip_function_arg
#undef TARGET_FUNCTION_INCOMING_ARG
#define TARGET_FUNCTION_INCOMING_ARG picochip_incoming_function_arg
#undef TARGET_FUNCTION_ARG_ADVANCE
#define TARGET_FUNCTION_ARG_ADVANCE picochip_arg_advance
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
@ -315,12 +332,6 @@ static char picochip_get_vliw_alu_id (void);
struct gcc_target targetm = TARGET_INITIALIZER;
enum unwind_info_type
picochip_except_unwind_info (void)
{
return UI_NONE;
}
/* Only return a value in memory if it is greater than 4 bytes.
int_size_in_bytes returns -1 for variable size objects, which go in
memory always. The cast to unsigned makes -1 > 8. */
@ -799,7 +810,7 @@ picochip_is_aligned (int byte_offset, int bit_alignment)
/* Compute the size of an argument in units. */
static int
picochip_compute_arg_size (tree type, enum machine_mode mode)
picochip_compute_arg_size (const_tree type, enum machine_mode mode)
{
int type_size_in_units = 0;
@ -814,8 +825,8 @@ picochip_compute_arg_size (tree type, enum machine_mode mode)
/* Determine where the next outgoing arg should be placed. */
rtx
picochip_function_arg (CUMULATIVE_ARGS cum, int mode, tree type,
int named ATTRIBUTE_UNUSED)
picochip_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
const_tree type, bool named ATTRIBUTE_UNUSED)
{
int reg = 0;
int type_align_in_units = 0;
@ -835,17 +846,17 @@ picochip_function_arg (CUMULATIVE_ARGS cum, int mode, tree type,
/* Compute the correct offset (i.e., ensure that the offset meets
the alignment requirements). */
offset_overflow = cum % type_align_in_units;
offset_overflow = *cum % type_align_in_units;
if (offset_overflow == 0)
new_offset = cum;
new_offset = *cum;
else
new_offset = (cum - offset_overflow) + type_align_in_units;
new_offset = (*cum - offset_overflow) + type_align_in_units;
if (TARGET_DEBUG)
{
printf ("Function arg:\n");
printf (" Type valid: %s\n", (type ? "yes" : "no"));
printf (" Cumulative Value: %d\n", cum);
printf (" Cumulative Value: %d\n", *cum);
printf (" Mode: %s\n", GET_MODE_NAME (mode));
printf (" Type size: %i units\n", type_size_in_units);
printf (" Alignment: %i units\n", type_align_in_units);
@ -879,7 +890,7 @@ picochip_function_arg (CUMULATIVE_ARGS cum, int mode, tree type,
case CSImode:
case SCmode:
case CQImode:
return gen_rtx_REG ((enum machine_mode) mode, reg);
return gen_rtx_REG (mode, reg);
case BLKmode:
{
@ -912,8 +923,9 @@ picochip_function_arg (CUMULATIVE_ARGS cum, int mode, tree type,
passed in registers, which are then pushed onto the stack by the
function prologue). */
rtx
picochip_incoming_function_arg (CUMULATIVE_ARGS cum, int mode,
tree type, int named)
picochip_incoming_function_arg (CUMULATIVE_ARGS *cum,
enum machine_mode mode,
const_tree type, bool named)
{
if (cfun->stdarg)
@ -998,10 +1010,10 @@ picochip_arg_partial_bytes (CUMULATIVE_ARGS * p_cum, enum machine_mode mode,
}
/* Advance the cumulative args counter, returning the new counter. */
CUMULATIVE_ARGS
picochip_arg_advance (const CUMULATIVE_ARGS cum, int mode,
tree type, int named ATTRIBUTE_UNUSED)
/* Advance the cumulative args counter CUM. */
void
picochip_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
const_tree type, bool named ATTRIBUTE_UNUSED)
{
int type_align_in_units = 0;
int type_size_in_units;
@ -1011,7 +1023,7 @@ picochip_arg_advance (const CUMULATIVE_ARGS cum, int mode,
/* VOIDmode is passed when computing the second argument to a `call'
pattern. This can be ignored. */
if (mode == VOIDmode)
return 0;
return;
/* Compute the alignment and size of the parameter. */
type_align_in_units =
@ -1020,17 +1032,16 @@ picochip_arg_advance (const CUMULATIVE_ARGS cum, int mode,
/* Compute the correct offset (i.e., ensure that the offset meets
the alignment requirements). */
offset_overflow = cum % type_align_in_units;
offset_overflow = *cum % type_align_in_units;
if (offset_overflow == 0)
new_offset = cum;
new_offset = *cum;
else
new_offset = (cum - offset_overflow) + type_align_in_units;
new_offset = (*cum - offset_overflow) + type_align_in_units;
/* Advance past the last argument. */
new_offset += type_size_in_units;
return new_offset;
*cum = new_offset;
}
/* Determine whether a register needs saving/restoring. It does if it

View File

@ -405,22 +405,9 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER];
/* Store the offset of the next argument. */
#define CUMULATIVE_ARGS unsigned
/* Decide how function arguments are handled. */
#define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
picochip_function_arg (CUM, MODE, TYPE, NAMED)
/* Incoming arguments are always the same as normal arguments, except
for a function which uses variadic arguments, in which case all
arguments are effectively passed on the stack. */
#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
picochip_incoming_function_arg(CUM, MODE, TYPE, NAMED)
#define INIT_CUMULATIVE_ARGS(CUM,FNTYPE,LIBNAME,INDIRECT,N_NAMED_ARGS) \
((CUM) = 0)
#define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \
(CUM) = picochip_arg_advance (CUM, MODE, TYPE, NAMED)
/* Originally this used TYPE_ALIGN to determine the
alignment. Unfortunately, this fails in some cases, because the
type is unknown (e.g., libcall's). Instead, use GET_MODE_ALIGNMENT