pkgsrc/cross/mipsEEel-netbsd/patches/gcc-ab

255 lines
8.1 KiB
Text

$NetBSD: gcc-ab,v 1.1 2001/08/05 15:28:41 kent Exp $
--- /dev/null Thu Aug 2 23:44:43 2001
+++ gcc/config/mips/eenetbsd.h
@@ -0,0 +1,250 @@
+/*
+ *
+ *
+ *
+ */
+
+/* Experimental: */
+#define MIPS_ABI_DEFAULT ABI_32
+#undef mips_abi
+extern int mips_abi;
+/* End of experimental */
+
+#define MIPS_CPU_STRING_DEFAULT "R5900"
+
+#undef MIPS_ISA_DEFAULT
+#define MIPS_ISA_DEFAULT 2
+
+#include "linux.h"
+#include "abi64.h"
+
+/*
+ * Override TARGET_DEFAULT
+ * for r5900 : default is -msingle-float
+ */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS|MASK_SINGLE_FLOAT|MASK_MIPS5900)
+
+#undef MACHINE_TYPE
+#define MACHINE_TYPE "(MIPSEL EE NetBSD/ELF)"
+
+/* How to output a quadword for the r5900. */
+#define ASM_OUTPUT_QUADRUPLE_INT(STREAM,VALUE) \
+do { \
+ if (TARGET_64BIT) \
+ { \
+ fprintf (STREAM, "\t.octa\t"); \
+ if (HOST_BITS_PER_WIDE_INT < 64 || GET_CODE (VALUE) != CONST_INT) \
+ /* We can't use 'X' for negative numbers, because then we won't \
+ get the right value for the upper 32 bits. */ \
+ output_addr_const (STREAM, VALUE); \
+ else \
+ /* We must use 'X', because otherwise LONG_MIN will print as \
+ a number that the Irix 6 assembler won't accept. */ \
+ print_operand (STREAM, VALUE, 'X'); \
+ fprintf (STREAM, "\n"); \
+ } \
+ else \
+ { \
+ assemble_integer (operand_subword ((VALUE), 0, 0, TImode), \
+ UNITS_PER_WORD, 1); \
+ assemble_integer (operand_subword ((VALUE), 1, 0, TImode), \
+ UNITS_PER_WORD, 1); \
+ } \
+} while (0)
+
+/* ALIGN 128 bit objects */
+
+#define DEFAULT_MIPS_ALIGNMENT 128
+
+#undef SUBTARGET_TARGET_OPTIONS
+#define SUBTARGET_TARGET_OPTIONS \
+ { "align128", &mips_align128_string, \
+ "Speciy 128bit alignment to use"}, \
+ { "no-align128", &mips_no_align128_string, \
+ "Speciy no 128bit alignment to use"}, \
+ { "abi=", &mips_abi_string, \
+ "Speciy ABI to use"},
+
+#undef STACK_BOUNDARY
+#define STACK_BOUNDARY \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
+ ? 64 : 128)
+
+#undef MIPS_STACK_ALIGN
+#define MIPS_STACK_ALIGN(LOC) \
+ (((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI) \
+ && mips_alignment != 128 ) \
+ ? ((LOC) + 7) & ~7 \
+ : ((LOC) + 15) & ~15)
+
+
+#undef BIGGEST_ALIGNMENT
+#define BIGGEST_ALIGNMENT mips_alignment
+
+#define PREFERRED_STACK_BOUNDARY \
+(mips_alignment == 128 ? 128 : \
+ ((mips_abi == ABI_32 || mips_abi == ABI_O64 || mips_abi == ABI_EABI ) \
+ ? 64 : 128))
+
+
+/*
+
+ ** Table of cc1 flags v.s. stack alignment related values **
+
+ STACK_BOUNDARY MIPS_STACK_ALIGN BIGGEST_ALIGNMENT PREFERRED_STACK_BOUNDARY
+o32/o64 64 64 64 64
+ +align128 64 128 128 128
+n32/n64 128 128 64 128
+ +align128 128 128 128 128
+*/
+
+/*
+////////////
+//
+// default mips2
+//
+// default is elf, -mabi=o32, -mips2, -mcpu=r5900 and -EL
+*/
+#undef CPP_PREDEFINES
+#define CPP_PREDEFINES "\
+-D__ELF__ -D_MIPS_SIM=_MIPS_SIM_ABI32 \
+-D_MIPS_ISA=_MIPS_ISA_MIPS2 \
+-Dunix -D__unix__ \
+-D__NetBSD__ \
+-Dmips -D_mips -D__mips -D__mips__ \
+-DR3000 -D_R3000 \
+-DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ \
+-Asystem(unix) -Asystem(posix) -Acpu(mips) -Amachine(mips) \
+ "
+
+#undef SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC "\
+%{mfp32: -D_MIPS_FPSET=16}%{!mfp32: -D_MIPS_FPSET=32} \
+%{mips1: -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS1} \
+%{mips2: -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
+%{mips3: -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS3 -UR3000 -U_R3000} \
+%{mips4: -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS4 -UR3000 -U_R3000} \
+%{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \
+%{fno-PIC: -U__PIC__ -U__pic__} \
+%{fno-pic: -U__PIC__ -U__pic__} \
+%{fPIC: -D__PIC__ -D__pic__} \
+%{fpic: -D__PIC__ -D__pic__} \
+%{!fpic: %{!fPIC: %{!fno-pic: %{!fno-pic: -D__PIC__ -D__pic__}}}} \
+%{-D__HAVE_FPU__ } \
+%{posix: -D_POSIX_SOURCE} \
+%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ %{!ansi:-DLANGUAGE_C_PLUS_PLUS}} \
+%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ %{!ansi:-DLANGUAGE_C_PLUS_PLUS}} \
+%{.C: -D__LANGUAGE_C_PLUS_PLUS__ %{!ansi:-DLANGUAGE_C_PLUS_PLUS}} \
+%{.m: -D__LANGUAGE_OBJECTIVE_C__ %{!ansi:-DLANGUAGE_OBJECTIVE_C}} \
+%{.S: -D__LANGUAGE_ASSEMBLY__ %{!ansi:-DLANGUAGE_ASSEMBLY}} \
+%{.s: -D__LANGUAGE_ASSEMBLY__ %{!ansi:-DLANGUAGE_ASSEMBLY}} \
+%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D__LANGUAGE_C__ %{!ansi:-DLANGUAGE_C}}}}}} } \
+%{ansi:-Uunix -Ulinux -Umips -UR3000 -UMIPSEB -UMIPSEL} \
+%{ffast-math: -D__FAST_MATH__} \
+%{!mcpu*: -D__R5900 -D_R5900} \
+%{mcpu=r5900: -D__R5900 -D_R5900} \
+ "
+#undef SUBTARGET_CC1_SPEC
+#define SUBTARGET_CC1_SPEC "\
+%{fno-pic: -mno-abicalls} \
+ "
+
+#undef SUBTARGET_ASM_SPEC
+#define SUBTARGET_ASM_SPEC "\
+%{!mcpu*: -mwarn-short-loop} \
+%{!mcpu*: -mcpu=r5900} \
+%{fno-pic: -non_shared} \
+%{mno-abicalls: -non_shared} \
+%{!fno-pic: %{!mno-abicalls: -KPIC}} \
+%{!mips*: -mips2} \
+%{!mdouble-float: -msingle-float} \
+ "
+
+
+/*
+ * Default fucntion and data alignment values for r5900
+ */
+
+/* prefer .p2align rather than .align (gas assumed) */
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
+ if ((LOG)!=0) \
+ if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP))
+
+#undef DEFAULT_LOOP_ALIGN
+#undef DEFAULT_LOOP_MAX_SKIP
+#undef DEFAULT_JUMP_ALIGN
+#undef DEFAULT_JUMP_MAX_SKIP
+#undef DEFAULT_FUNCTION_ALIGN
+#undef DEFAULT_FUNCTION_MAX_SKIP
+
+#define DEFAULT_LOOP_ALIGN 3
+#define DEFAULT_LOOP_MAX_SKIP 0
+#define DEFAULT_JUMP_ALIGN 2
+#define DEFAULT_JUMP_MAX_SKIP 0
+#define DEFAULT_FUNCTION_ALIGN 3
+#define DEFAULT_FUNCTION_MAX_SKIP 0
+
+/*
+ * bb profiling extension
+ *
+ *construct/destruct private reocord in strunc bb
+ * int BB_CONSTRUCT_PRIVATE_RECORD(void **p_private)
+ * ( return 1 if successed, otherwise return 0 )
+ * void BB_DESTRUCT_PRIVATE_RECORD(void **p_private)
+ *
+ *called from "bb.out" reporter
+ * void BB_PRINT_PRIVATE_RECORD(FILE*, void *private)
+ *
+ *called from "bb.in" parser
+ * int BB_PARSE_PRIVATE(char *bb_in)
+ * ( return 1 if processed, otherwise return 0 )
+ *
+ *called per once program
+ * void BB_INIT_PRIVATE(void)
+ * void BB_EXIT_PRIVATE(void)
+ *
+ *called when etering/returning function
+ * void BB_INIT_TRACE_FUNC_PRIVATE(struct bb *blocks, unsigned long blockno)
+ * void BB_TRACE_RET_PRIVATE(void)
+ *
+ *called when entering bb
+ * void BB_TRACE_FUNC_PRIVATE(struct __bb * p__bb)
+ *
+ */
+
+#define BB_CONSTRUCT_PRIVATE_RECORD(p_private) \
+ __bb_alloc_r5900_perf_counter(p_private)
+
+#define BB_DESTRUCT_PRIVATE_RECORD(p_private) \
+ __bb_free_r5900_perf_counter(p_private)
+
+#define BB_PRINT_PRIVATE_RECORD(file,private) \
+ __bb_print_r5900_perf_counter(file,private)
+
+#define BB_PARSE_PRIVATE(ptr) \
+ __bb_parse_r5900_perf_counter(ptr)
+
+#define BB_INIT_PRIVATE \
+ __bb_init_r5900_perf_counter
+
+#define BB_EXIT_PRIVATE \
+ __bb_exit_r5900_perf_counter
+
+#define BB_TRACE_FUNC_PRIVATE(pbb) \
+ __bb_trace_r5900_perf_counter(pbb)
+
+#define BB_INIT_TRACE_FUNC_PRIVATE(blocks, blockno) \
+ __bb_init_trace_r5900_perf_counter(blocks, blockno)
+
+#define BB_TRACE_RET_PRIVATE \
+ __bb_ret_trace_r5900_perf_counter
+
+/*
+ * bb_stack size
+ * inital and growth value
+ *
+ */
+#define BB_INITAL_STACK_SIZE 100
+#define BB_GROWTH_OF_STACK_SIZE 100