/* Prototypes for exported functions defined in mcore.c
Copyright (C) 2000 Free Software Foundation, Inc.
- Contributed by Nick Clifton (nickc@cygnus.com)
+ Contributed by Nick Clifton (nickc@redhat.com)
This file is part of GNU CC.
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern char * mcore_output_jump_label_table PARAMS ((void));
-extern void mcore_expand_prolog PARAMS ((void));
-extern void mcore_expand_epilog PARAMS ((void));
-extern int mcore_const_ok_for_inline PARAMS ((long));
-extern int mcore_num_ones PARAMS ((int));
-extern int mcore_num_zeros PARAMS ((int));
-extern int mcore_initial_elimination_offset PARAMS ((int, int));
-extern int mcore_byte_offset PARAMS ((unsigned int));
-extern int mcore_halfword_offset PARAMS ((unsigned int));
-extern int mcore_const_trick_uses_not PARAMS ((long));
-extern void mcore_override_options PARAMS ((void));
-extern int mcore_dllexport_name_p PARAMS ((const char *));
-extern int mcore_dllimport_name_p PARAMS ((const char *));
-extern int mcore_naked_function_p PARAMS ((void));
+extern const char * mcore_output_jump_label_table PARAMS ((void));
+extern void mcore_expand_prolog PARAMS ((void));
+extern void mcore_expand_epilog PARAMS ((void));
+extern int mcore_const_ok_for_inline PARAMS ((long));
+extern int mcore_num_ones PARAMS ((int));
+extern int mcore_num_zeros PARAMS ((int));
+extern int mcore_initial_elimination_offset PARAMS ((int, int));
+extern int mcore_byte_offset PARAMS ((unsigned int));
+extern int mcore_halfword_offset PARAMS ((unsigned int));
+extern int mcore_const_trick_uses_not PARAMS ((long));
+extern void mcore_override_options PARAMS ((void));
+extern int mcore_dllexport_name_p PARAMS ((const char *));
+extern int mcore_dllimport_name_p PARAMS ((const char *));
+extern int mcore_naked_function_p PARAMS ((void));
#ifdef TREE_CODE
-extern void mcore_unique_section PARAMS ((tree, int));
-extern void mcore_encode_section_info PARAMS ((tree));
-extern int mcore_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree));
-extern tree mcore_merge_machine_decl_attributes PARAMS ((tree, tree));
+extern void mcore_unique_section PARAMS ((tree, int));
+extern void mcore_encode_section_info PARAMS ((tree));
+extern int mcore_valid_machine_decl_attribute PARAMS ((tree, tree, tree, tree));
+extern tree mcore_merge_machine_decl_attributes PARAMS ((tree, tree));
#ifdef HAVE_MACHINE_MODES
-extern int mcore_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
-extern void mcore_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int *));
-extern int mcore_num_arg_regs PARAMS ((enum machine_mode, tree));
-extern int mcore_must_pass_on_stack PARAMS ((enum machine_mode, tree));
+extern int mcore_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
+extern void mcore_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int *));
+extern int mcore_num_arg_regs PARAMS ((enum machine_mode, tree));
+extern int mcore_must_pass_on_stack PARAMS ((enum machine_mode, tree));
#endif /* HAVE_MACHINE_MODES */
#ifdef RTX_CODE
-extern rtx mcore_function_value PARAMS ((tree, tree));
+extern rtx mcore_function_value PARAMS ((tree, tree));
#endif /* RTX_CODE */
#endif /* TREE_CODE */
extern rtx arch_compare_op0;
extern rtx arch_compare_op1;
-extern char * mcore_output_bclri PARAMS ((rtx, int));
-extern char * mcore_output_bseti PARAMS ((rtx, int));
-extern char * mcore_output_cmov PARAMS ((rtx *, int, char *));
-extern char * mcore_output_call PARAMS ((rtx *, int));
-extern int mcore_is_dead PARAMS ((rtx, rtx));
-extern int mcore_expand_insv PARAMS ((rtx *));
-extern int mcore_modify_comparison PARAMS ((RTX_CODE));
-extern void mcore_expand_block_move PARAMS ((rtx, rtx, rtx *));
-extern rtx mcore_dependent_simplify_rtx PARAMS ((rtx, int, int, int, int *));
-extern void mcore_dependent_reorg PARAMS ((rtx));
-extern int mcore_const_costs PARAMS ((rtx, RTX_CODE));
-extern int mcore_and_cost PARAMS ((rtx));
-extern int mcore_ior_cost PARAMS ((rtx));
-extern char * mcore_output_andn PARAMS ((rtx, rtx *));
-extern void mcore_print_operand_address PARAMS ((FILE *, rtx));
-extern void mcore_print_operand PARAMS ((FILE *, rtx, int));
-extern rtx mcore_gen_compare_reg PARAMS ((RTX_CODE));
-extern int mcore_symbolic_address_p PARAMS ((rtx));
-extern enum reg_class mcore_reload_class PARAMS ((rtx, enum reg_class));
-extern int mcore_is_same_reg PARAMS ((rtx, rtx));
-extern int mcore_arith_S_operand PARAMS ((rtx));
+extern const char * mcore_output_bclri PARAMS ((rtx, int));
+extern const char * mcore_output_bseti PARAMS ((rtx, int));
+extern const char * mcore_output_cmov PARAMS ((rtx *, int, char *));
+extern char * mcore_output_call PARAMS ((rtx *, int));
+extern int mcore_is_dead PARAMS ((rtx, rtx));
+extern int mcore_expand_insv PARAMS ((rtx *));
+extern int mcore_modify_comparison PARAMS ((RTX_CODE));
+extern void mcore_expand_block_move PARAMS ((rtx, rtx, rtx *));
+extern rtx mcore_dependent_simplify_rtx PARAMS ((rtx, int, int, int, int *));
+extern void mcore_dependent_reorg PARAMS ((rtx));
+extern int mcore_const_costs PARAMS ((rtx, RTX_CODE));
+extern int mcore_and_cost PARAMS ((rtx));
+extern int mcore_ior_cost PARAMS ((rtx));
+extern const char * mcore_output_andn PARAMS ((rtx, rtx *));
+extern void mcore_print_operand_address PARAMS ((FILE *, rtx));
+extern void mcore_print_operand PARAMS ((FILE *, rtx, int));
+extern rtx mcore_gen_compare_reg PARAMS ((RTX_CODE));
+extern int mcore_symbolic_address_p PARAMS ((rtx));
+extern enum reg_class mcore_reload_class PARAMS ((rtx, enum reg_class));
+extern int mcore_is_same_reg PARAMS ((rtx, rtx));
+extern int mcore_arith_S_operand PARAMS ((rtx));
#ifdef HAVE_MACHINE_MODES
-extern char * mcore_output_move PARAMS ((rtx, rtx *, enum machine_mode));
-extern char * mcore_output_movedouble PARAMS ((rtx *, enum machine_mode));
-extern char * mcore_output_inline_const_forced PARAMS ((rtx, rtx *, enum machine_mode));
-extern int mcore_arith_reg_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_general_movsrc_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_general_movdst_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_reload_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_J_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_K_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_K_operand_not_0 PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_M_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_K_S_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_imm_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_any_imm_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_arith_O_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_literal_K_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_addsub_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_compare_operand PARAMS ((rtx, enum machine_mode));
-extern int mcore_load_multiple_operation PARAMS ((rtx, enum machine_mode));
-extern int mcore_store_multiple_operation PARAMS ((rtx, enum machine_mode));
-extern int mcore_call_address_operand PARAMS ((rtx, enum machine_mode));
+extern const char * mcore_output_move PARAMS ((rtx, rtx *, enum machine_mode));
+extern const char * mcore_output_movedouble PARAMS ((rtx *, enum machine_mode));
+extern const char * mcore_output_inline_const_forced PARAMS ((rtx, rtx *, enum machine_mode));
+extern int mcore_arith_reg_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_general_movsrc_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_general_movdst_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_reload_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_J_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_K_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_K_operand_not_0 PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_M_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_K_S_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_imm_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_any_imm_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_arith_O_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_literal_K_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_addsub_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_compare_operand PARAMS ((rtx, enum machine_mode));
+extern int mcore_load_multiple_operation PARAMS ((rtx, enum machine_mode));
+extern int mcore_store_multiple_operation PARAMS ((rtx, enum machine_mode));
+extern int mcore_call_address_operand PARAMS ((rtx, enum machine_mode));
#ifdef TREE_CODE
-extern rtx mcore_function_arg PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
+extern rtx mcore_function_arg PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int));
#endif /* TREE_CODE */
#endif /* HAVE_MACHINE_MODES */
#endif /* RTX_CODE */
#include "toplev.h"
#include "mcore-protos.h"
-static int const_ok_for_mcore PARAMS ((int));
-static int try_constant_tricks PARAMS ((long, int *, int *));
-
/* Maximum size we are allowed to grow the stack in a single operation.
If we want more, we must do it in increments of at most this size.
If this value is 0, we don't check at all. */
/* y */ NO_REGS, /* z */ NO_REGS
};
+struct mcore_frame
+{
+ int arg_size; /* stdarg spills (bytes) */
+ int reg_size; /* non-volatile reg saves (bytes) */
+ int reg_mask; /* non-volatile reg saves */
+ int local_size; /* locals */
+ int outbound_size; /* arg overflow on calls out */
+ int pad_outbound;
+ int pad_local;
+ int pad_reg;
+ /* Describe the steps we'll use to grow it. */
+#define MAX_STACK_GROWS 4 /* gives us some spare space */
+ int growth[MAX_STACK_GROWS];
+ int arg_offset;
+ int reg_offset;
+ int reg_growth;
+ int local_growth;
+};
+
+typedef enum
+{
+ COND_NO,
+ COND_MOV_INSN,
+ COND_CLR_INSN,
+ COND_INC_INSN,
+ COND_DEC_INSN,
+ COND_BRANCH_INSN
+}
+cond_type;
+
+static void output_stack_adjust PARAMS ((int, int));
+static int calc_live_regs PARAMS ((int *));
+static int const_ok_for_mcore PARAMS ((int));
+static int try_constant_tricks PARAMS ((long, int *, int *));
+static const char * output_inline_const PARAMS ((enum machine_mode, rtx *));
+static void block_move_sequence PARAMS ((rtx, rtx, rtx, rtx, int, int, int));
+static void layout_mcore_frame PARAMS ((struct mcore_frame *));
+static cond_type is_cond_candidate PARAMS ((rtx));
+static rtx emit_new_cond_insn PARAMS ((rtx, int));
+static rtx conditionalize_block PARAMS ((rtx));
+static void conditionalize_optimization PARAMS ((rtx));
+static void mcore_add_gc_roots PARAMS ((void));
+static rtx handle_structs_in_regs PARAMS ((enum machine_mode, tree, int));
+static void mcore_mark_dllexport PARAMS ((tree));
+static void mcore_mark_dllimport PARAMS ((tree));
+static int mcore_dllexport_p PARAMS ((tree));
+static int mcore_dllimport_p PARAMS ((tree));
+\f
/* Adjust the stack and return the number of bytes taken to do it. */
static void
output_stack_adjust (direction, size)
}
/* Functions to output assembly code for a function call. */
+
char *
mcore_output_call (operands, index)
rtx operands[];
}
/* Output a series of bseti's corresponding to mask. */
-char *
+const char *
mcore_output_bseti (dst, mask)
rtx dst;
int mask;
}
/* Output a series of bclri's corresponding to mask. */
-char *
+const char *
mcore_output_bclri (dst, mask)
rtx dst;
int mask;
/* Output a conditional move of two constants that are +/- 1 within each
other. See the "movtK" patterns in mcore.md. I'm not sure this is
really worth the effort. */
-char *
+const char *
mcore_output_cmov (operands, cmp_t, test)
rtx operands[];
int cmp_t;
/* Outputs the peephole for moving a constant that gets not'ed followed
by an and (i.e. combine the not and the and into andn) BRC */
-char *
+const char *
mcore_output_andn (insn, operands)
rtx insn ATTRIBUTE_UNUSED;
rtx operands[];
{
int x, y;
rtx out_operands[3];
- char * load_op;
+ const char * load_op;
char buf[256];
if (try_constant_tricks (INTVAL (operands[1]), &x, &y) != 2)
}
/* Output an inline constant. */
-static char *
+static const char *
output_inline_const (mode, operands)
enum machine_mode mode;
rtx operands[];
rtx out_operands[3];
char buf[256];
char load_op[256];
- char *dst_fmt;
+ const char *dst_fmt;
int value;
value = INTVAL (operands[1]);
}
/* Output a move of a word or less value. */
-char *
+const char *
mcore_output_move (insn, operands, mode)
rtx insn ATTRIBUTE_UNUSED;
rtx operands[];
Useful for things where we've gotten into trouble and think we'd
be doing an lrw into r15 (forbidden). This lets us get out of
that pickle even after register allocation. */
-char *
+const char *
mcore_output_inline_const_forced (insn, operands, mode)
rtx insn ATTRIBUTE_UNUSED;
rtx operands[];
/* Return a sequence of instructions to perform DI or DF move.
Since the MCORE cannot move a DI or DF in one instruction, we have
to take care when we see overlapping source and dest registers. */
-char *
+const char *
mcore_output_movedouble (operands, mode)
rtx operands[];
enum machine_mode mode ATTRIBUTE_UNUSED;
We don't have to mask if we're shifting this up against the
MSB of the register (e.g., the shift will push out any hi-order
bits. */
- if (width + posn != GET_MODE_SIZE (SImode))
+ if (width + posn != (int) GET_MODE_SIZE (SImode))
{
ereg = force_reg (SImode, GEN_INT ((1 << width) - 1));
emit_insn (gen_rtx (SET, SImode, sreg,
if (GET_CODE (elt) != SET
|| GET_CODE (SET_DEST (elt)) != REG
|| GET_MODE (SET_DEST (elt)) != SImode
- || REGNO (SET_DEST (elt)) != dest_regno + i
- || GET_CODE (SET_SRC (elt)) != MEM
- || GET_MODE (SET_SRC (elt)) != SImode
+ || REGNO (SET_DEST (elt)) != (unsigned) (dest_regno + i)
+ || GET_CODE (SET_SRC (elt)) != MEM
+ || GET_MODE (SET_SRC (elt)) != SImode
|| GET_CODE (XEXP (SET_SRC (elt), 0)) != PLUS
|| ! rtx_equal_p (XEXP (XEXP (SET_SRC (elt), 0), 0), src_addr)
|| GET_CODE (XEXP (XEXP (SET_SRC (elt), 0), 1)) != CONST_INT
if (GET_CODE (elt) != SET
|| GET_CODE (SET_SRC (elt)) != REG
|| GET_MODE (SET_SRC (elt)) != SImode
- || REGNO (SET_SRC (elt)) != src_regno + i
+ || REGNO (SET_SRC (elt)) != (unsigned) (src_regno + i)
|| GET_CODE (SET_DEST (elt)) != MEM
|| GET_MODE (SET_DEST (elt)) != SImode
|| GET_CODE (XEXP (SET_DEST (elt), 0)) != PLUS
for a varargs function. */
static int current_function_anonymous_args;
-
#define STACK_BYTES (STACK_BOUNDARY/BITS_PER_UNIT)
#define STORE_REACH (64) /* Maximum displace of word store + 4. */
#define ADDI_REACH (32) /* Maximum addi operand. */
-struct mcore_frame
-{
- int arg_size; /* stdarg spills (bytes) */
- int reg_size; /* non-volatile reg saves (bytes) */
- int reg_mask; /* non-volatile reg saves */
- int local_size; /* locals */
- int outbound_size; /* arg overflow on calls out */
- int pad_outbound;
- int pad_local;
- int pad_reg;
-
- /* describe the steps we'll use to grow it */
-#define MAX_STACK_GROWS 4 /* gives us some spare space */
- int growth[MAX_STACK_GROWS];
- int arg_offset;
- int reg_offset;
- int reg_growth;
- int local_growth;
-};
-
static void
layout_mcore_frame (infp)
struct mcore_frame * infp;
infp->local_growth = growths;
}
- /* Anything else that we've forgotten?, plus a few consistency checks. */
+ /* Anything else that we've forgotten?, plus a few consistency checks. */
finish:
assert (infp->reg_offset >= 0);
assert (growths <= MAX_STACK_GROWS);
int offs;
int growth = MAX_STACK_GROWS - 1 ;
+
/* Find out what we're doing. */
layout_mcore_frame(&fi);
if (mcore_naked_function_p ())
return;
-
+
/* If we had a frame pointer, restore the sp from that. */
if (frame_pointer_needed)
{
/* Dump out any constants accumulated in the final pass. These
will only be labels. */
-char *
+const char *
mcore_output_jump_label_table ()
{
int i;
}
#endif
-typedef enum
-{
- COND_NO,
- COND_MOV_INSN,
- COND_CLR_INSN,
- COND_INC_INSN,
- COND_DEC_INSN,
- COND_BRANCH_INSN
-}
-cond_type;
-
/* Check whether insn is a candidate for a conditional. */
static cond_type
is_cond_candidate (insn)
int len;
char * name;
char * string;
- char * prefix;
+ const char * prefix;
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));