From 09a2b93aa8ca704d47cd4d0d0cd4386ff30a1e50 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 29 Jan 2004 02:13:52 +0000 Subject: [PATCH] mcore-protos.h: Remove the prototype for mcore_setup_incoming_varargs. * config/mcore/mcore-protos.h: Remove the prototype for mcore_setup_incoming_varargs. * config/mcore/mcore.c (TARGET_ASM_EXTERNAL_LIBCALL): New. (TARGET_PROMOTE_FUNCTION_ARGS): Likewise. (TARGET_PROMOTE_FUNCTION_RETURN): Likewise. (TARGET_PROMOTE_PROTOTYPES): Likewise. (TARGET_STRUCT_VALUE_RTX): Likewise. (TARGET_RETURN_IN_MEMORY): Likewise. (TARGET_SETUP_INCOMING_VARARGS): Likewise. (mcore_setup_incoming_varargs): Make it static. Receive the first argument by reference. Add argument second_time. (mcore_external_libcall): New. (mcore_return_in_memory): Likewise. * config/mcore/mcore.h (PROMOTE_FUNCTION_ARGS): New. (PROMOTE_FUNCTION_RETURN): Likewise. (STRUCT_VALUE): Likewise. (RETURN_IN_MEMORY): Likewise. (SETUP_INCOMING_VARARGS): Likewise. (PROMOTE_PROTOTYPES): Likewise. (ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise. From-SVN: r76835 --- gcc/ChangeLog | 23 +++++++++++++++ gcc/config/mcore/mcore-protos.h | 3 +- gcc/config/mcore/mcore.c | 50 +++++++++++++++++++++++++++++---- gcc/config/mcore/mcore.h | 32 +-------------------- 4 files changed, 69 insertions(+), 39 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cdcc3611f1..ad1d1f441da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,26 @@ +2004-01-28 Kazu Hirata + + * config/mcore/mcore-protos.h: Remove the prototype for + mcore_setup_incoming_varargs. + * config/mcore/mcore.c (TARGET_ASM_EXTERNAL_LIBCALL): New. + (TARGET_PROMOTE_FUNCTION_ARGS): Likewise. + (TARGET_PROMOTE_FUNCTION_RETURN): Likewise. + (TARGET_PROMOTE_PROTOTYPES): Likewise. + (TARGET_STRUCT_VALUE_RTX): Likewise. + (TARGET_RETURN_IN_MEMORY): Likewise. + (TARGET_SETUP_INCOMING_VARARGS): Likewise. + (mcore_setup_incoming_varargs): Make it static. Receive the + first argument by reference. Add argument second_time. + (mcore_external_libcall): New. + (mcore_return_in_memory): Likewise. + * config/mcore/mcore.h (PROMOTE_FUNCTION_ARGS): New. + (PROMOTE_FUNCTION_RETURN): Likewise. + (STRUCT_VALUE): Likewise. + (RETURN_IN_MEMORY): Likewise. + (SETUP_INCOMING_VARARGS): Likewise. + (PROMOTE_PROTOTYPES): Likewise. + (ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise. + 2004-01-28 Kazu Hirata * config/m32r/m32r-protos.h: Remove the prototype for diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index fedb3f8347c..05272e7d9b7 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -1,5 +1,5 @@ /* Prototypes for exported functions defined in mcore.c - Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Nick Clifton (nickc@redhat.com) This file is part of GCC. @@ -37,7 +37,6 @@ extern int mcore_naked_function_p (void); #ifdef TREE_CODE #ifdef HAVE_MACHINE_MODES extern int mcore_function_arg_partial_nregs (CUMULATIVE_ARGS, enum machine_mode, tree, int); -extern void mcore_setup_incoming_varargs (CUMULATIVE_ARGS, enum machine_mode, tree, int *); extern int mcore_num_arg_regs (enum machine_mode, tree); extern int mcore_must_pass_on_stack (enum machine_mode, tree); #endif /* HAVE_MACHINE_MODES */ diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 53ceea3d554..16786281440 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -1,5 +1,6 @@ /* Output routines for Motorola MCore processor - Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of GCC. @@ -123,6 +124,7 @@ static int try_constant_tricks (long, int *, int *); static const char * output_inline_const (enum machine_mode, rtx *); static void block_move_sequence (rtx, rtx, rtx, rtx, int, int, int); static void layout_mcore_frame (struct mcore_frame *); +static void mcore_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int); static cond_type is_cond_candidate (rtx); static rtx emit_new_cond_insn (rtx, int); static rtx conditionalize_block (rtx); @@ -146,8 +148,14 @@ static int mcore_const_costs (rtx, RTX_CODE); static int mcore_and_cost (rtx); static int mcore_ior_cost (rtx); static bool mcore_rtx_costs (rtx, int, int, int *); +static void mcore_external_libcall (rtx); +static bool mcore_return_in_memory (tree, tree); + /* Initialize the GCC target structure. */ +#undef TARGET_ASM_EXTERNAL_LIBCALL +#define TARGET_ASM_EXTERNAL_LIBCALL mcore_external_libcall + #ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES #undef TARGET_MERGE_DECL_ATTRIBUTES #define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes @@ -175,6 +183,21 @@ static bool mcore_rtx_costs (rtx, int, int, int *); #undef TARGET_MACHINE_DEPENDENT_REORG #define TARGET_MACHINE_DEPENDENT_REORG mcore_reorg +#undef TARGET_PROMOTE_FUNCTION_ARGS +#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true +#undef TARGET_PROMOTE_FUNCTION_RETURN +#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true +#undef TARGET_PROMOTE_PROTOTYPES +#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true + +#undef TARGET_STRUCT_VALUE_RTX +#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null +#undef TARGET_RETURN_IN_MEMORY +#define TARGET_RETURN_IN_MEMORY mcore_return_in_memory + +#undef TARGET_SETUP_INCOMING_VARARGS +#define TARGET_SETUP_INCOMING_VARARGS mcore_setup_incoming_varargs + struct gcc_target targetm = TARGET_INITIALIZER; /* Adjust the stack and return the number of bytes taken to do it. */ @@ -2188,22 +2211,23 @@ mcore_initial_elimination_offset (int from, int to) /* Keep track of some information about varargs for the prolog. */ -void -mcore_setup_incoming_varargs (CUMULATIVE_ARGS args_so_far, +static void +mcore_setup_incoming_varargs (CUMULATIVE_ARGS *args_so_far, enum machine_mode mode, tree type, - int * ptr_pretend_size ATTRIBUTE_UNUSED) + int * ptr_pretend_size ATTRIBUTE_UNUSED, + int second_time ATTRIBUTE_UNUSED) { current_function_anonymous_args = 1; /* We need to know how many argument registers are used before the varargs start, so that we can push the remaining argument registers during the prologue. */ - number_of_regs_before_varargs = args_so_far + mcore_num_arg_regs (mode, type); + number_of_regs_before_varargs = *args_so_far + mcore_num_arg_regs (mode, type); /* There is a bug somewhere in the arg handling code. Until I can find it this workaround always pushes the last named argument onto the stack. */ - number_of_regs_before_varargs = args_so_far; + number_of_regs_before_varargs = *args_so_far; /* The last named argument may be split between argument registers and the stack. Allow for this here. */ @@ -3428,3 +3452,17 @@ mcore_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED) fprintf (asm_out_file, "\t.section %s\n", name); } #endif /* OBJECT_FORMAT_ELF */ + +static void +mcore_external_libcall (rtx fun) +{ + fprintf (asm_out_file, "\t.import\t"); + assemble_name (asm_out_file, XSTR (fun, 0)); + fprintf (asm_out_file, "\n"); +} + +static bool +mcore_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED) +{ + return int_size_in_bytes (type) > 2 * UNITS_PER_WORD; +} diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index b19104f9cf1..4d79e088ce0 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for Motorola M*CORE Processor. - Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003 + Copyright (C) 1993, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -216,10 +216,6 @@ extern const char * mcore_stack_increment_string; (UNSIGNEDP) = 1; \ } -#define PROMOTE_FUNCTION_ARGS - -#define PROMOTE_FUNCTION_RETURN - /* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. */ #define BITS_BIG_ENDIAN 0 @@ -435,9 +431,6 @@ extern int mcore_stack_increment; #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ OFFSET = mcore_initial_elimination_offset (FROM, TO) -/* Place that structure value return address is placed. */ -#define STRUCT_VALUE 0 - /* Define the classes of registers for register constraints in the machine description. Also define ranges of constants. @@ -661,9 +654,6 @@ extern const enum reg_class reg_class_from_letter[]; we want to retain compatibility with older gcc versions. */ #define DEFAULT_PCC_STRUCT_RETURN 0 -/* How many registers to use for struct return. */ -#define RETURN_IN_MEMORY(TYPE) (int_size_in_bytes (TYPE) > 2 * UNITS_PER_WORD) - /* Define how to find the value returned by a library function assuming the value has mode MODE. */ #define LIBCALL_VALUE(MODE) gen_rtx (REG, MODE, FIRST_RET_REG) @@ -741,11 +731,6 @@ extern const enum reg_class reg_class_from_letter[]; #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \ mcore_function_arg_partial_nregs (CUM, MODE, TYPE, NAMED) -/* Perform any needed actions needed for a function that is receiving a - variable number of arguments. */ -#define SETUP_INCOMING_VARARGS(ASF, MODE, TYPE, PAS, ST) \ - mcore_setup_incoming_varargs (ASF, MODE, TYPE, & PAS) - /* Call the function profiler with a given profile label. */ #define FUNCTION_PROFILER(STREAM,LABELNO) \ { \ @@ -962,9 +947,6 @@ extern const enum reg_class reg_class_from_letter[]; /* Why is this defined??? -- dac */ #define NO_FUNCTION_CSE 1 -/* Chars and shorts should be passed as ints. */ -#define PROMOTE_PROTOTYPES 1 - /* The machine modes of pointers and functions. */ #define Pmode SImode #define FUNCTION_MODE Pmode @@ -1164,18 +1146,6 @@ extern long mcore_current_compilation_timestamp; regardless of whether any call sites remain. This makes this aspect of the compiler non-ABI compliant. */ -/* Similar, but for libcall. FUN is an rtx. */ -#undef ASM_OUTPUT_EXTERNAL_LIBCALL -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - do \ - { \ - fprintf (FILE, "\t.import\t"); \ - assemble_name (FILE, XSTR (FUN, 0)); \ - fprintf (FILE, "\n"); \ - } \ - while (0) - - /* This says how to output an assembler line to define a local common symbol.... */ #undef ASM_OUTPUT_LOCAL -- 2.30.2