Commit efb6037d authored by bernds's avatar bernds
Browse files

Add the FRV port

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56029 138bc75d-0d04-0410-961f-82ee72b054a4
parent 3112c36a
2002-08-04 Bernd Schmidt <bernds@redhat.com>
Contribute a port developed primarily by Michael Meissner,
Catherine Moore, and Richard Sandiford <rsandifo@redhat.com>.
* config.gcc: Add frv-elf target.
* config/frv/cmovd.c: New file.
* config/frv/cmovh.c: New file.
* config/frv/cmovw.c: New file.
* config/frv/frv-abi.h: New file.
* config/frv/frv-asm.h: New file.
* config/frv/frv-modes.def: New file.
* config/frv/frv-protos.h: New file.
* config/frv/frv.c: New file.
* config/frv/frv.h: New file.
* config/frv/frv.md: New file.
* config/frv/frvbegin.c: New file.
* config/frv/frvend.c: New file.
* config/frv/lib1funcs.asm: New file.
* config/frv/media.h: New file.
* config/frv/modi.c: New file.
* config/frv/t-frv: New file.
* config/frv/uitod.c: New file.
* config/frv/uitof.c: New file.
* config/frv/ulltod.c: New file.
* config/frv/ulltof.c: New file.
* config/frv/umodi.c: New file.
* config/frv/xm-frv.h: New file.
2002-08-04 Nathan Sidwell <nathan@codesourcery.com>
 
* gcov.c (bb_file_time): New static variable.
......
......@@ -717,6 +717,10 @@ fr30-*-elf)
tmake_file=fr30/t-fr30
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
;;
frv-*-elf)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file} frv/frv-abi.h"
tmake_file=frv/t-frv
;;
h8300-*-rtems*)
xm_defines=POSIX
tmake_file="h8300/t-h8300 t-rtems"
......
/* Move double-word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
void
__cmovd (long long *dest, const long long *src, unsigned len)
{
unsigned i;
unsigned num = len >> 3;
unsigned xlen = len & ~7;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
while (len > xlen)
{
dest_byte[xlen] = src_byte[xlen];
xlen++;
}
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Move half-word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
void
__cmovh (short *dest, const short *src, unsigned len)
{
unsigned i;
unsigned num = len >> 1;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
if ((len & 1) != 0)
dest_byte[len-1] = src_byte[len-1];
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Move word library function.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
void
__cmovw (int *dest, const int *src, unsigned len)
{
unsigned i;
unsigned num = len >> 2;
unsigned xlen = len & ~3;
char *dest_byte = (char *)dest;
const char *src_byte = (const char *)src;
if (dest_byte < src_byte || dest_byte > src_byte+len)
{
for (i = 0; i < num; i++)
dest[i] = src[i];
while (len > xlen)
{
dest_byte[xlen] = src_byte[xlen];
xlen++;
}
}
else
{
while (len-- > 0)
dest_byte[len] = src_byte[len];
}
}
/* Frv map GCC names to FR-V ABI.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* For each of the functions in the library that has a corresponding name in
the ABI, add an equivalence between the GCC name and the ABI name. This is
in a separate file from frv.h so that fp-bit.c can be made to include it. */
#ifdef __GNUC__
#ifdef __FRV_UNDERSCORE__
#define RENAME_LIBRARY(OLD,NEW) \
__asm__ (".globl\t_" #NEW "\n" \
"_" #NEW "=_" #OLD "\n" \
"\t.type\t_" #NEW ",@function\n");
#else
#define RENAME_LIBRARY(OLD,NEW) \
__asm__ (".globl\t" #NEW "\n" \
#NEW "=" #OLD "\n" \
"\t.type\t" #NEW ",@function\n");
#endif
#define CREATE_DOUBLE_SHIFT(OLD,NEW) \
__asm__ (".text\n" \
"\t.globl\t" #NEW "\n" \
"\t.type\t" #NEW ",@function\n" \
#NEW ":\n" \
"\tor\tgr11, gr0, gr10\n" \
"\tbra\t" #OLD "\n");
#ifdef L_sf_to_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__extendsfdf2,__ftod)
#endif
#ifdef L_sf_to_si
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixsfsi,__ftoi)
#endif
#ifdef L_sf_to_usi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfsi,__ftoui)
#endif
#ifdef L_df_to_si
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixdfsi,__dtoi)
#endif
#ifdef L_fixunssfsi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfsi,__ftoui)
#endif
#ifdef L_fixunsdfsi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunsdfsi,__dtoui)
#endif
#ifdef L_fixsfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixsfdi,__ftoll)
#endif
#ifdef L_fixdfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixdfdi,__dtoll)
#endif
#ifdef L_fixunssfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunssfdi,__ftoull)
#endif
#ifdef L_fixunsdfdi
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__fixunsdfdi,__dtoull)
#endif
#ifdef L_si_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatsisf,__itof)
#endif
#ifdef L_di_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdisf,__lltof)
#endif
#ifdef L_df_to_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__truncdfsf2,__dtof)
#endif
#ifdef L_si_to_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatsidf,__itod)
#endif
#ifdef L_floatdisf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdisf,__lltof)
#endif
#ifdef L_floatdidf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__floatdidf,__lltod)
#endif
#ifdef L_addsub_df
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__adddf3,__addd)
RENAME_LIBRARY(__subdf3,__subd)
#endif
#ifdef L_mul_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__muldf3,__muld)
#endif
#ifdef L_div_df
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divdf3,__divd)
#endif
#ifdef L_addsub_sf
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__addsf3,__addf) \
RENAME_LIBRARY(__subsf3,__subf)
#endif
#ifdef L_mul_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__mulsf3,__mulf)
#endif
#ifdef L_div_sf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divsf3,__divf)
#endif
#ifdef L_ashldi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__ashldi3,__sllll)
#endif
#ifdef L_lshrdi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__lshrdi3,__srlll)
#endif
#ifdef L_ashrdi3
#define DECLARE_LIBRARY_RENAMES CREATE_DOUBLE_SHIFT (__ashrdi3,__srall)
#endif
#ifdef L_adddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__adddi3,__addll)
#endif
#ifdef L_subdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__subdi3,__subll)
#endif
#ifdef L_muldi3
#define DECLARE_LIBRARY_RENAMES \
RENAME_LIBRARY(__muldi3,__mulll)
RENAME_LIBRARY(__muldi3,__umulll)
#endif
#ifdef L_divdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__divdi3,__divll)
#endif
#ifdef L_udivdi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__udivdi3,__udivll)
#endif
#ifdef L_moddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__moddi3,__modll)
#endif
#ifdef L_umoddi3
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY(__umoddi3,__umodll)
#endif
#endif /* __GNUC__ */
/* Assembler Support.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* P(INSN): Emit INSN.P for VLIW machines, otherwise emit plain INSN.
P2(INSN): Emit INSN.P on the FR500 and above, otherwise emit plain INSN. */
#ifdef __FRV_VLIW__
#ifdef __STDC__
#define P(A) A##.p
#else
#define P(A) A/**/.p
#endif
#if __FRV_VLIW__ > 2
#define P2(A) P(A)
#else
#define P2(A) A
#endif
#else
#define P(A) A
#define P2(A) A
#endif
/* Add underscore if necessary to external name. */
#ifdef __FRV_UNDERSCORE__
#ifdef __STDC__
#define EXT(NAME) _##NAME
#else
#define EXT(NAME) _/**/NAME
#endif
#else
#define EXT(NAME) NAME
#endif
/* Definitions of target machine for GNU compiler for FRV.
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* On the FRV, the CC modes used are:
CCmode set ICC's from comparing signed integers
CC_UNSmode set ICC's from comparing unsigned integers
CC_FPmode set FCC's from comparing floating point
CC_CCRmode set CCR's to do conditional execution */
CC (CC_UNS)
CC (CC_FP)
CC (CC_CCR)
/* Frv prototypes.
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Define the information needed to generate branch and scc insns. This is
stored from the compare operation. Note that we can't use "rtx" here
since it hasn't been defined! */
/* Define global data defined in frv.c */
extern const char *frv_branch_cost_string; /* -mbranch-cost option */
extern int frv_branch_cost_int; /* value of -mbranch_cost */
extern const char *frv_cpu_string; /* -mcpu= option */
extern const char *frv_condexec_insns_str; /* -mcond-exec-insns= option */
extern int frv_condexec_insns; /* value of -mcond-exec-insns */
extern const char *frv_condexec_temps_str; /* -mcond-exec-temps= option */
extern int frv_condexec_temps; /* value of -mcond-exec-temps */
extern const char *frv_sched_lookahead_str; /* -msched-lookahead= option */
extern int frv_sched_lookahead; /* value -msched-lookahead= */
/* CPU type. This must be identical to the cpu enumeration in frv.md. */
typedef enum frv_cpu
{
FRV_CPU_GENERIC,
FRV_CPU_FR500,
FRV_CPU_FR400,
FRV_CPU_FR300,
FRV_CPU_SIMPLE,
FRV_CPU_TOMCAT
} frv_cpu_t;
extern frv_cpu_t frv_cpu_type; /* value of -mcpu= */
/* Define functions defined in frv.c */
extern void frv_expand_prologue PARAMS ((void));
extern void frv_expand_epilogue PARAMS ((int));
extern void frv_override_options PARAMS ((void));
extern void frv_optimization_options PARAMS ((int, int));
extern void frv_conditional_register_usage PARAMS ((void));
extern frv_stack_t *frv_stack_info PARAMS ((void));
extern void frv_debug_stack PARAMS ((frv_stack_t *));
extern int frv_frame_pointer_required PARAMS ((void));
extern int frv_initial_elimination_offset PARAMS ((int, int));
#ifdef RTX_CODE
extern int frv_legitimate_address_p PARAMS ((enum machine_mode, rtx,
int, int));
extern rtx frv_legitimize_address PARAMS ((rtx, rtx,
enum machine_mode));
#ifdef TREE_CODE
extern void frv_init_builtins PARAMS ((void));
extern rtx frv_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
extern void frv_init_cumulative_args PARAMS ((CUMULATIVE_ARGS *, tree,
rtx, int, int));
extern int frv_function_arg_boundary PARAMS ((enum machine_mode, tree));
extern rtx frv_function_arg PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int, int));
extern void frv_function_arg_advance PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern int frv_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern int frv_function_arg_pass_by_reference PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern int frv_function_arg_callee_copies PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern int frv_function_arg_keep_as_reference PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int));
extern rtx frv_expand_builtin_saveregs PARAMS ((void));
extern void frv_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode,
tree, int *, int));
extern void frv_expand_builtin_va_start PARAMS ((tree, rtx));
extern rtx frv_expand_builtin_va_arg PARAMS ((tree, tree));
#endif /* TREE_CODE */
extern int frv_expand_block_move PARAMS ((rtx *));
extern int frv_expand_block_clear PARAMS ((rtx *));
extern rtx frv_dynamic_chain_address PARAMS ((rtx));
extern rtx frv_return_addr_rtx PARAMS ((int, rtx));
extern rtx frv_index_memory PARAMS ((rtx,
enum machine_mode,
int));
#ifdef TREE_CODE
extern void frv_asm_output_mi_thunk PARAMS ((FILE *, tree, long,
tree));
#endif /* TREE_CODE */
extern const char *frv_asm_output_opcode
PARAMS ((FILE *, const char *));
extern void frv_final_prescan_insn PARAMS ((rtx, rtx *, int));
extern void frv_print_operand PARAMS ((FILE *, rtx, int));
extern void frv_print_operand_address PARAMS ((FILE *, rtx));
extern int frv_emit_movsi PARAMS ((rtx, rtx));
extern const char *output_move_single PARAMS ((rtx *, rtx));
extern const char *output_move_double PARAMS ((rtx *, rtx));
extern const char *output_condmove_single
PARAMS ((rtx *, rtx));
extern int frv_emit_cond_branch PARAMS ((enum rtx_code, rtx));
extern int frv_emit_scc PARAMS ((enum rtx_code, rtx));
extern rtx frv_split_scc PARAMS ((rtx, rtx, rtx, rtx,
HOST_WIDE_INT));
extern int frv_emit_cond_move PARAMS ((rtx, rtx, rtx, rtx));
extern rtx frv_split_cond_move PARAMS ((rtx *));
extern rtx frv_split_minmax PARAMS ((rtx *));
extern rtx frv_split_abs PARAMS ((rtx *));
extern void frv_split_double_load PARAMS ((rtx, rtx));
extern void frv_split_double_store PARAMS ((rtx, rtx));
#ifdef BLOCK_HEAD
extern void frv_ifcvt_init_extra_fields PARAMS ((ce_if_block_t *));
extern void frv_ifcvt_modify_tests PARAMS ((ce_if_block_t *,
rtx *, rtx *));
extern void frv_ifcvt_modify_multiple_tests
PARAMS ((ce_if_block_t *,
basic_block,
rtx *, rtx *));
extern rtx frv_ifcvt_modify_insn PARAMS ((ce_if_block_t *,
rtx, rtx));
extern void frv_ifcvt_modify_final PARAMS ((ce_if_block_t *));
extern void frv_ifcvt_modify_cancel PARAMS ((ce_if_block_t *));
#endif
extern int frv_trampoline_size PARAMS ((void));
extern void frv_initialize_trampoline PARAMS ((rtx, rtx, rtx));
extern enum reg_class frv_secondary_reload_class
PARAMS ((enum reg_class class,
enum machine_mode mode,
rtx x, int));
extern int frv_class_likely_spilled_p PARAMS ((enum reg_class class));
extern int frv_hard_regno_mode_ok PARAMS ((int, enum machine_mode));
extern int frv_hard_regno_nregs PARAMS ((int, enum machine_mode));
extern int frv_class_max_nregs PARAMS ((enum reg_class class,
enum machine_mode mode));
extern int frv_legitimate_constant_p PARAMS ((rtx));
#endif /* RTX_CODE */
extern int direct_return_p PARAMS ((void));
extern int frv_register_move_cost PARAMS ((enum reg_class, enum reg_class));
#ifdef TREE_CODE
extern int frv_adjust_field_align PARAMS ((tree, int));
extern void frv_select_section PARAMS ((tree, int));
#endif
#ifdef RTX_CODE
extern void frv_select_rtx_section PARAMS ((enum machine_mode, rtx));
#endif
#ifdef TREE_CODE
extern void frv_encode_section_info PARAMS ((tree));
extern void frv_unique_section PARAMS ((tree, int));
#endif
extern void fixup_section PARAMS ((void));
extern void sdata_section PARAMS ((void));
extern void sbss_section PARAMS ((void));
extern void const_section PARAMS ((void));
extern void data_section PARAMS ((void));
#ifdef RTX_CODE
extern int integer_register_operand PARAMS ((rtx, enum machine_mode));
extern int frv_load_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_fpr_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_no_subreg_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_int6_operand PARAMS ((rtx, enum machine_mode));
extern int fpr_or_int6_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_int_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_int12_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_fpr_or_int12_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_int10_operand PARAMS ((rtx, enum machine_mode));
extern int move_source_operand PARAMS ((rtx, enum machine_mode));
extern int move_destination_operand PARAMS ((rtx, enum machine_mode));
extern int condexec_source_operand PARAMS ((rtx, enum machine_mode));
extern int condexec_dest_operand PARAMS ((rtx, enum machine_mode));
extern int lr_operand PARAMS ((rtx, enum machine_mode));
extern int gpr_or_memory_operand PARAMS ((rtx, enum machine_mode));
extern int fpr_or_memory_operand PARAMS ((rtx, enum machine_mode));
extern int reg_or_0_operand PARAMS ((rtx, enum machine_mode));
extern int fcc_operand PARAMS ((rtx, enum machine_mode));
extern int icc_operand PARAMS ((rtx, enum machine_mode));
extern int cc_operand PARAMS ((rtx, enum machine_mode));
extern int fcr_operand PARAMS ((rtx, enum machine_mode));
extern int icr_operand PARAMS ((rtx, enum machine_mode));
extern int cr_operand PARAMS ((rtx, enum machine_mode));
extern int call_operand PARAMS ((rtx, enum machine_mode));
extern int fpr_operand PARAMS ((rtx, enum machine_mode));
extern int even_reg_operand PARAMS ((rtx, enum machine_mode));
extern int odd_reg_operand PARAMS ((rtx, enum machine_mode));
extern int even_gpr_operand PARAMS ((rtx, enum machine_mode));
extern int odd_gpr_operand PARAMS ((rtx, enum machine_mode));
extern int quad_fpr_operand PARAMS ((rtx, enum machine_mode));
extern int even_fpr_operand PARAMS ((rtx, enum machine_mode));
extern int odd_fpr_operand PARAMS ((rtx, enum machine_mode));
extern int dbl_memory_one_insn_operand PARAMS ((rtx, enum machine_mode));
extern int dbl_memory_two_insn_operand PARAMS ((rtx, enum machine_mode));
extern int int12_operand PARAMS ((rtx, enum machine_mode));
extern int int6_operand PARAMS ((rtx, enum machine_mode));
extern int int5_operand PARAMS ((rtx, enum machine_mode));
extern int uint5_operand PARAMS ((rtx, enum machine_mode));
extern int uint4_operand PARAMS ((rtx, enum machine_mode));
extern int uint1_operand PARAMS ((rtx, enum machine_mode));
extern int int_2word_operand PARAMS ((rtx, enum machine_mode));
extern int pic_register_operand PARAMS ((rtx, enum machine_mode));
extern int pic_symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int small_data_register_operand PARAMS ((rtx, enum machine_mode));
extern int small_data_symbolic_operand PARAMS ((rtx, enum machine_mode));
extern int upper_int16_operand PARAMS ((rtx, enum machine_mode));
extern int uint16_operand PARAMS ((rtx, enum machine_mode));
extern int relational_operator PARAMS ((rtx, enum machine_mode));
extern int signed_relational_operator PARAMS ((rtx, enum machine_mode));
extern int unsigned_relational_operator PARAMS ((rtx, enum machine_mode));
extern int float_relational_operator PARAMS ((rtx, enum machine_mode));
extern int ccr_eqne_operator PARAMS ((rtx, enum machine_mode));
extern int minmax_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_si_binary_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_si_media_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_si_divide_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_si_unary_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_sf_conv_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_sf_add_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_memory_operand PARAMS ((rtx, enum machine_mode));
extern int intop_compare_operator PARAMS ((rtx, enum machine_mode));
extern int condexec_intop_cmp_operator PARAMS ((rtx, enum machine_mode));
extern int acc_operand PARAMS ((rtx, enum machine_mode));
extern int even_acc_operand PARAMS ((rtx, enum machine_mode));
extern int quad_acc_operand PARAMS ((rtx, enum machine_mode));
extern int accg_operand PARAMS ((rtx, enum machine_mode));
extern rtx frv_matching_accg_for_acc PARAMS ((rtx));
extern void frv_machine_dependent_reorg PARAMS ((rtx));
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* Frv initialization file linked before all user modules
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
This file was originally taken from the file crtstuff.c in the
main compiler directory, and simplified. */
#include "defaults.h"
#include <stddef.h>
#include "unwind-dw2-fde.h"
#include "gbl-ctors.h"
/* Declare a pointer to void function type. */
#define STATIC static
#ifdef __FRV_UNDERSCORE__
#define UNDERSCORE "_"
#else
#define UNDERSCORE ""
#endif
#define INIT_SECTION_NEG_ONE(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".word -1\n\t" \
".previous")
#define INIT_SECTION(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".previous")
/* Beginning of .ctor/.dtor sections that provides a list of constructors and
destructors to run. */
INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__");
INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__");
/* Beginning of .eh_frame section that provides all of the exception handling
tables. */
INIT_SECTION (".eh_frame", "\"aw\"", "__EH_FRAME_BEGIN__");
/* Beginning of .rofixup section that provides a list of pointers that we
need to adjust. */
INIT_SECTION (".rofixup", "\"a\"", "__ROFIXUP_LIST__");
extern void __frv_register_eh(void) __attribute__((__constructor__));
extern void __frv_deregister_eh(void) __attribute__((__destructor__));
extern func_ptr __EH_FRAME_BEGIN__[];
/* Register the exeception handling table as the first constructor */
void
__frv_register_eh (void)
{
static struct object object;
if (__register_frame_info)
__register_frame_info (__EH_FRAME_BEGIN__, &object);
}
/* Note, do not declare __{,de}register_frame_info weak as it seems
to interfere with the pic support. */
/* Unregister the exeception handling table as a deconstructor */
void
__frv_deregister_eh (void)
{
static int completed = 0;
if (completed)
return;
if (__deregister_frame_info)
__deregister_frame_info (__EH_FRAME_BEGIN__);
completed = 1;
}
/* Run the global destructors */
void
__do_global_dtors ()
{
static func_ptr *p = __DTOR_LIST__ + 1;
while (*p)
{
p++;
(*(p-1)) ();
}
}
/* Run the global constructors */
void
__do_global_ctors ()
{
unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
unsigned i;
if (nptrs == (unsigned long)-1)
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++);
for (i = nptrs; i >= 1; i--)
__CTOR_LIST__[i] ();
atexit (__do_global_dtors);
}
/* Subroutine called automatically by `main'.
Compiling a global function named `main'
produces an automatic call to this function at the beginning.
For many systems, this routine calls __do_global_ctors.
For systems which support a .init section we use the .init section
to run __do_global_ctors, so we need not do anything here. */
void
__main ()
{
/* Support recursive calls to `main': run initializers just once. */
static int initialized;
if (! initialized)
{
initialized = 1;
__do_global_ctors ();
}
}
/* Frv initialization file linked after all user modules
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "defaults.h"
#include <stddef.h>
#include "unwind-dw2-fde.h"
#ifdef __FRV_UNDERSCORE__
#define UNDERSCORE "_"
#else
#define UNDERSCORE ""
#endif
#define FINI_SECTION_ZERO(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".word 0\n\t" \
".previous")
#define FINI_SECTION(SECTION, FLAGS, NAME) \
__asm__ (".section " SECTION "," FLAGS "\n\t" \
".globl " UNDERSCORE NAME "\n\t" \
".type " UNDERSCORE NAME ",@object\n\t" \
".p2align 2\n" \
UNDERSCORE NAME ":\n\t" \
".previous")
/* End of .ctor/.dtor sections that provides a list of constructors and
destructors to run. */
FINI_SECTION_ZERO (".ctors", "\"aw\"", "__CTOR_END__");
FINI_SECTION_ZERO (".dtors", "\"aw\"", "__DTOR_END__");
/* End of .eh_frame section that provides all of the exception handling
tables. */
FINI_SECTION_ZERO (".eh_frame", "\"aw\"", "__FRAME_END__");
/* End of .rofixup section that provides a list of pointers that we
need to adjust. */
FINI_SECTION (".rofixup", "\"a\"", "__ROFIXUP_END__");
/* Library functions.
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Red Hat, Inc.
This file is part of GNU CC.
GNU CC is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation * either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <frv-asm.h>
#ifdef L_cmpll
/* icc0 = __cmpll (long long a, long long b) */
.file "_cmpll.s"
.globl EXT(__cmpll)
.type EXT(__cmpll),@function
.text
.p2align 4
EXT(__cmpll):
cmp gr8, gr10, icc0
ckeq icc0, cc4
P(ccmp) gr9, gr11, cc4, 1
ret
.Lend:
.size EXT(__cmpll),.Lend-EXT(__cmpll)
#endif /* L_cmpll */
#ifdef L_cmpf
/* icc0 = __cmpf (float a, float b) */
/* Note, because this function returns the result in ICC0, it means it can't
handle NaNs. */
.file "_cmpf.s"
.globl EXT(__cmpf)
.type EXT(__cmpf),@function
.text
.p2align 4
EXT(__cmpf):
#ifdef __FRV_HARD_FLOAT__ /* floating point instructions available */
movgf gr8, fr0
P(movgf) gr9, fr1
setlos #1, gr8
fcmps fr0, fr1, fcc0
P(fcklt) fcc0, cc0
fckeq fcc0, cc1
csub gr0, gr8, gr8, cc0, 1
cmov gr0, gr8, cc1, 1
cmpi gr8, 0, icc0
ret
#else /* no floating point instructions available */
movsg lr, gr4
addi sp, #-16, sp
sti gr4, @(sp, 8)
st fp, @(sp, gr0)
mov sp, fp
call EXT(__cmpsf2)
cmpi gr8, #0, icc0
ldi @(sp, 8), gr4
movgs gr4, lr
ld @(sp,gr0), fp
addi sp, #16, sp
ret
#endif
.Lend:
.size EXT(__cmpf),.Lend-EXT(__cmpf)
#endif
#ifdef L_cmpd
/* icc0 = __cmpd (double a, double b) */
/* Note, because this function returns the result in ICC0, it means it can't
handle NaNs. */
.file "_cmpd.s"
.globl EXT(__cmpd)
.type EXT(__cmpd),@function
.text
.p2align 4
EXT(__cmpd):
movsg lr, gr4
addi sp, #-16, sp
sti gr4, @(sp, 8)
st fp, @(sp, gr0)
mov sp, fp
call EXT(__cmpdf2)
cmpi gr8, #0, icc0
ldi @(sp, 8), gr4
movgs gr4, lr
ld @(sp,gr0), fp
addi sp, #16, sp
ret
.Lend:
.size EXT(__cmpd),.Lend-EXT(__cmpd)
#endif
#ifdef L_addll
/* gr8,gr9 = __addll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_addll.s"
.globl EXT(__addll)
.type EXT(__addll),@function
.text
.p2align
EXT(__addll):
addcc gr9, gr11, gr9, icc0
addx gr8, gr10, gr8, icc0
ret
.Lend:
.size EXT(__addll),.Lend-EXT(__addll)
#endif
#ifdef L_subll
/* gr8,gr9 = __subll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_subll.s"
.globl EXT(__subll)
.type EXT(__subll),@function
.text
.p2align 4
EXT(__subll):
subcc gr9, gr11, gr9, icc0
subx gr8, gr10, gr8, icc0
ret
.Lend:
.size EXT(__subll),.Lend-EXT(__subll)
#endif
#ifdef L_andll
/* gr8,gr9 = __andll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_andll.s"
.globl EXT(__andll)
.type EXT(__andll),@function
.text
.p2align 4
EXT(__andll):
P(and) gr9, gr11, gr9
P2(and) gr8, gr10, gr8
ret
.Lend:
.size EXT(__andll),.Lend-EXT(__andll)
#endif
#ifdef L_orll
/* gr8,gr9 = __orll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_orll.s"
.globl EXT(__orll)
.type EXT(__orll),@function
.text
.p2align 4
EXT(__orll):
P(or) gr9, gr11, gr9
P2(or) gr8, gr10, gr8
ret
.Lend:
.size EXT(__orll),.Lend-EXT(__orll)
#endif
#ifdef L_xorll
/* gr8,gr9 = __xorll (long long a, long long b) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_xorll.s"
.globl EXT(__xorll)
.type EXT(__xorll),@function
.text
.p2align 4
EXT(__xorll):
P(xor) gr9, gr11, gr9
P2(xor) gr8, gr10, gr8
ret
.Lend:
.size EXT(__xorll),.Lend-EXT(__xorll)
#endif
#ifdef L_notll
/* gr8,gr9 = __notll (long long a) */
/* Note, gcc will never call this function, but it is present in case an
ABI program calls it. */
.file "_notll.s"
.globl EXT(__notll)
.type EXT(__notll),@function
.text
.p2align 4
EXT(__notll):
P(not) gr9, gr9
P2(not) gr8, gr8
ret
.Lend:
.size EXT(__notll),.Lend-EXT(__notll)
#endif
#ifdef L_cmov
/* (void) __cmov (char *dest, const char *src, size_t len) */
/*
* void __cmov (char *dest, const char *src, size_t len)
* {
* size_t i;
*
* if (dest < src || dest > src+len)
* {
* for (i = 0; i < len; i++)
* dest[i] = src[i];
* }
* else
* {
* while (len-- > 0)
* dest[len] = src[len];
* }
* }
*/
.file "_cmov.s"
.globl EXT(__cmov)
.type EXT(__cmov),@function
.text
.p2align 4
EXT(__cmov):
P(cmp) gr8, gr9, icc0
add gr9, gr10, gr4
P(cmp) gr8, gr4, icc1
bc icc0, 0, .Lfwd
bls icc1, 0, .Lback
.Lfwd:
/* move bytes in a forward direction */
P(setlos) #0, gr5
cmp gr0, gr10, icc0
P(subi) gr9, #1, gr9
P2(subi) gr8, #1, gr8
bnc icc0, 0, .Lret
.Lfloop:
/* forward byte move loop */
addi gr5, #1, gr5
P(ldsb) @(gr9, gr5), gr4
cmp gr5, gr10, icc0
P(stb) gr4, @(gr8, gr5)
bc icc0, 0, .Lfloop
ret
.Lbloop:
/* backward byte move loop body */
ldsb @(gr9,gr10),gr4
stb gr4,@(gr8,gr10)
.Lback:
P(cmpi) gr10, #0, icc0
addi gr10, #-1, gr10
bne icc0, 0, .Lbloop
.Lret:
ret
.Lend:
.size EXT(__cmov),.Lend-EXT(__cmov)
#endif
This diff is collapsed.
int __modi (int a, int b)
{
return a % b;
}
double __uitod (unsigned int a)
{
return a;
}
float __uitof (unsigned int a)
{
return a;
}
double __ulltod (unsigned long long a)
{
return a;
}
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