+2004-01-28 Kazu Hirata <kazu@cs.umass.edu>
+
+ * 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 <kazu@cs.umass.edu>
* config/m32r/m32r-protos.h: Remove the prototype for
/* 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.
#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 */
/* 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.
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);
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);
+
\f
/* 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
#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;
\f
/* Adjust the stack and return the number of bytes taken to do it. */
/* 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. */
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;
+}
/* 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.
(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
#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.
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)
#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) \
{ \
/* 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
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