1 |
709 |
jeremybenn |
/* Definitions of target machine for GNU compiler.
|
2 |
|
|
MIPS SDE version, for use with the SDE C library rather than newlib.
|
3 |
|
|
Copyright (C) 2007, 2008, 2009, 2010
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
11 |
|
|
any later version.
|
12 |
|
|
|
13 |
|
|
GCC is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GCC; see the file COPYING3. If not see
|
20 |
|
|
<http://www.gnu.org/licenses/>. */
|
21 |
|
|
|
22 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
23 |
|
|
do \
|
24 |
|
|
{ \
|
25 |
|
|
builtin_assert ("system=sde"); \
|
26 |
|
|
builtin_assert ("system=posix"); \
|
27 |
|
|
builtin_define ("__SDE_MIPS__"); \
|
28 |
|
|
\
|
29 |
|
|
/* Deprecated: use __mips_isa_rev >= 2. */ \
|
30 |
|
|
if (ISA_MIPS32R2) \
|
31 |
|
|
builtin_define ("__mipsr2"); \
|
32 |
|
|
\
|
33 |
|
|
/* Deprecated: use __mips_fpr == 64. */ \
|
34 |
|
|
if (TARGET_FLOAT64) \
|
35 |
|
|
builtin_define ("__mipsfp64"); \
|
36 |
|
|
\
|
37 |
|
|
if (TARGET_NO_FLOAT) \
|
38 |
|
|
builtin_define ("__NO_FLOAT"); \
|
39 |
|
|
else if (TARGET_SOFT_FLOAT_ABI) \
|
40 |
|
|
builtin_define ("__SOFT_FLOAT"); \
|
41 |
|
|
else if (TARGET_SINGLE_FLOAT) \
|
42 |
|
|
builtin_define ("__SINGLE_FLOAT"); \
|
43 |
|
|
\
|
44 |
|
|
if (TARGET_BIG_ENDIAN) \
|
45 |
|
|
{ \
|
46 |
|
|
builtin_assert ("endian=big"); \
|
47 |
|
|
builtin_assert ("cpu=mipseb"); \
|
48 |
|
|
} \
|
49 |
|
|
else \
|
50 |
|
|
{ \
|
51 |
|
|
builtin_assert ("endian=little"); \
|
52 |
|
|
builtin_assert ("cpu=mipsel"); \
|
53 |
|
|
} \
|
54 |
|
|
} \
|
55 |
|
|
while (0)
|
56 |
|
|
|
57 |
|
|
/* For __clear_cache in libgcc2.c. */
|
58 |
|
|
#ifdef IN_LIBGCC2
|
59 |
|
|
extern void mips_sync_icache (void *beg, unsigned long len);
|
60 |
|
|
#undef CLEAR_INSN_CACHE
|
61 |
|
|
#define CLEAR_INSN_CACHE(beg, end) \
|
62 |
|
|
mips_sync_icache (beg, end - beg)
|
63 |
|
|
#endif
|
64 |
|
|
|
65 |
|
|
/* For mips_cache_flush_func in mips.opt. */
|
66 |
|
|
#undef CACHE_FLUSH_FUNC
|
67 |
|
|
#define CACHE_FLUSH_FUNC "mips_sync_icache"
|
68 |
|
|
|
69 |
|
|
/* For inline code which needs to sync the icache and dcache,
|
70 |
|
|
noting that the SDE library takes arguments (address, size). */
|
71 |
|
|
#undef MIPS_ICACHE_SYNC
|
72 |
|
|
#define MIPS_ICACHE_SYNC(ADDR, SIZE) \
|
73 |
|
|
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \
|
74 |
|
|
LCT_NORMAL, VOIDmode, 2, ADDR, Pmode, \
|
75 |
|
|
SIZE, TYPE_MODE (sizetype))
|
76 |
|
|
|
77 |
|
|
/* This version of _mcount does not pop 2 words from the stack. */
|
78 |
|
|
#undef FUNCTION_PROFILER
|
79 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
80 |
|
|
{ \
|
81 |
|
|
mips_push_asm_switch (&mips_noat); \
|
82 |
|
|
/* _mcount treats $2 as the static chain register. */ \
|
83 |
|
|
if (cfun->static_chain_decl != NULL) \
|
84 |
|
|
fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \
|
85 |
|
|
reg_names[STATIC_CHAIN_REGNUM]); \
|
86 |
|
|
/* MIPS16 code passes saved $ra in $v1 instead of $at. */ \
|
87 |
|
|
fprintf (FILE, "\tmove\t%s,%s\n", \
|
88 |
|
|
reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
|
89 |
|
|
reg_names[RETURN_ADDR_REGNUM]); \
|
90 |
|
|
fprintf (FILE, "\tjal\t_mcount\n"); \
|
91 |
|
|
mips_pop_asm_switch (&mips_noat); \
|
92 |
|
|
/* _mcount treats $2 as the static chain register. */ \
|
93 |
|
|
if (cfun->static_chain_decl != NULL) \
|
94 |
|
|
fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
|
95 |
|
|
reg_names[2]); \
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
/* ...nor does the call sequence preserve $31. */
|
99 |
|
|
#undef MIPS_SAVE_REG_FOR_PROFILING_P
|
100 |
|
|
#define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) ((REGNO) == RETURN_ADDR_REGNUM)
|
101 |
|
|
|
102 |
|
|
/* Compile in support for the -mno-float option. */
|
103 |
|
|
#define TARGET_SUPPORTS_NO_FLOAT 1
|