OSDN Git Service

* config/xtensa/xtensa.c (xtensa_va_arg): Fix to handle arguments
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / a-ux.h
1 /* Definitions for Motorola 680x0 running A/UX
2    Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* This file was renamed from aux.h because of MSDOS: aux.anything
22    isn't usable.  Sigh.  */
23
24 /* Execution environment */
25
26 #undef TARGET_DEFAULT
27 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020)    /* 68020, 68881 */
28
29 #define CPP_PREDEFINES "-Dunix -Dm68k -DAUX -DmacII \
30 -Asystem=unix -Asystem=AUX -Acpu=m68k -Amachine=m68k -Amachine=macII"
31
32 #define CPP_SPEC \
33 "%{!msoft-float:%{!ansi:-Dmc68881 }-D__HAVE_68881__ }\
34 -Acpu=mc68000 -D__mc68000__ %{!ansi:-Dmc68000 }\
35 %{!mc68000:%{!m68000:-Acpu=mc68020 -D__mc68020__ %{!ansi:-Dmc68020 }}}\
36 %{m68030:-Acpu=mc68030 -D__mc68030__ %{!ansi:-Dmc68030 }}\
37 %{m68040:-Acpu=mc68040 -D__mc68040__ %{!ansi:-Dmc68040 }}\
38 %{!ansi:-D__STDC__=2 }\
39 %{sbsd:-D_BSD_SOURCE -DBSD }%{ZB:-D_BSD_SOURCE -DBSD }\
40 %{ssysv:-D_SYSV_SOURCE -DSYSV -DUSG }%{ZS:-D_SYSV_SOURCE -DSYSV -DUSG }\
41 %{sposix:-D_POSIX_SOURCE -DPOSIX }%{ZP:-D_POSIX_SOURCE -DPOSIX }\
42 %{sposix+:-D_POSIX_SOURCE -DPOSIX }\
43 %{saux:-D_AUX_SOURCE }%{ZA:-D_AUX_SOURCE }\
44 %{!sbsd:%{!ZB:%{!ssysv:%{!ZS:%{!sposix:%{!ZP:%{!snone:\
45 -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE }}}}}}}"
46
47 #define LIB_SPEC \
48 "%{sbsd:-lbsd }%{ZB:-lbsd }\
49 %{ssysv:-lsvid }%{ZS:-lsvid }\
50 %{sposix:-lposix }%{ZP:-lposix }%{sposix+:-lposix }\
51 %{!static:%{smac:-lmac_s -lat -lld -lmr }-lc_s }\
52 %{static:%{smac:-lmac -lat -lld -lmr }-lc }"
53
54 #undef STARTFILE_SPEC
55 #define STARTFILE_SPEC \
56 "%{pg:mcrt0.o%s }%{!pg:%{p:mcrt1.o%s }\
57 %{!p:%{smac:maccrt1.o%s low.o%s }%{!smac:crt1.o%s }}}\
58 crt2.o%s "
59
60 #undef ENDFILE_SPEC
61 #define ENDFILE_SPEC "crtn.o%s "
62
63
64 /*===================================================================*/
65 /* Compilation environment -- mostly */
66
67 /* We provide atexit(), A/UX does not have it */
68 #define NEED_ATEXIT
69
70 /* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
71    and bzero */
72 #define TARGET_MEM_FUNCTIONS
73
74 /* Resize standard types */
75
76 #undef SIZE_TYPE
77 #define SIZE_TYPE "unsigned int"
78
79 #undef PTRDIFF_TYPE
80 #define PTRDIFF_TYPE "int"
81
82 #undef WCHAR_TYPE
83 #define WCHAR_TYPE "unsigned int"
84
85 /* Every structure or union's size must be a multiple of 2 bytes.  */
86 #define STRUCTURE_SIZE_BOUNDARY 16
87
88 /* Bits needed by collect */
89
90 #define OBJECT_FORMAT_COFF
91 #define MY_ISCOFF(m)    ((m) == M68TVMAGIC || \
92                          (m) == M68MAGIC || \
93                          (m) == MC68TVMAGIC || \
94                          (m) == MC68MAGIC || \
95                          (m) == M68NSMAGIC)
96
97
98 #ifndef USE_COLLECT2
99 /* For .ctor/.dtor sections for collecting constructors */
100 /* We have special start/end files for defining [cd]tor lists */
101 #define CTOR_LISTS_DEFINED_EXTERNALLY
102 #endif
103
104
105 /*======================================================================*/
106 /* Calling convention and library support changes */
107
108 /* Define how to generate (in the callee) the output value of a function
109    and how to find (in the caller) the value returned by a function.  VALTYPE
110    is the data type of the value (as a tree).  If the precise function being
111    called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
112    For A/UX generate the result in d0, a0, or fp0 as appropriate.  */
113
114 #undef FUNCTION_VALUE
115 #define FUNCTION_VALUE(VALTYPE, FUNC)                                  \
116   (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881                    \
117    ? gen_rtx_REG (TYPE_MODE (VALTYPE), 16)                            \
118    : (POINTER_TYPE_P (VALTYPE)                                         \
119       ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8)                           \
120       : gen_rtx_REG (TYPE_MODE (VALTYPE), 0)))
121                     
122 #undef LIBCALL_VALUE
123 #define LIBCALL_VALUE(MODE)                                             \
124   gen_rtx_REG ((MODE), ((TARGET_68881 &&                                \
125                          ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
126
127 /* 1 if N is a possible register number for a function value.
128    For A/UX allow d0, a0, or fp0 as return registers, for integral,
129    pointer, or floating types, respectively. Reject fp0 if not using a
130    68881 coprocessor.  */
131
132 #undef FUNCTION_VALUE_REGNO_P
133 #define FUNCTION_VALUE_REGNO_P(N) \
134   ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
135
136 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
137    more than one register.  */
138
139 #undef NEEDS_UNTYPED_CALL
140 #define NEEDS_UNTYPED_CALL 1
141
142 /* For compatibility with the large body of existing code which does not
143    always properly declare external functions returning pointer types, the
144    A/UX convention is to copy the value returned for pointer functions
145    from a0 to d0 in the function epilogue, so that callers that have
146    neglected to properly declare the callee can still find the correct return
147    value.  */
148
149 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE)                             \
150 {                                                                       \
151   if (current_function_returns_pointer                                  \
152       && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode))     \
153     asm_fprintf (FILE, "\t%s %Ra0,%Rd0\n", ASM_MOV_INSN);               \
154 }
155
156 /* How to call the function profiler */
157
158 #undef FUNCTION_PROFILER
159 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
160   asm_fprintf (FILE, "\t%Olea %LLP%d,%Ra0\n\t%Ojbsr %s\n",              \
161                (LABELNO), FUNCTION_PROFILER_SYMBOL)
162
163 /* Finalize the trampoline by flushing the insn cache */
164
165 #undef FINALIZE_TRAMPOLINE
166 #define FINALIZE_TRAMPOLINE(TRAMP)                                      \
167   emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),       \
168                      0, VOIDmode, 2, TRAMP, Pmode,                      \
169                      plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
170
171 /* Clear the instruction cache from `beg' to `end'.  This makes an 
172    inline system call to SYS_sysm68k.  The arguments are as follows:
173
174         sysm68k(105, addr, scope, cache, len)
175
176    105    - the subfunction code to clear the cache
177    addr   - the start address for the flush
178    scope  - the scope of the flush (see the cpush insn)
179    cache  - which cache to flush (see the cpush insn)
180    len    - a factor relating to the number of flushes to perform :
181             len/16 lines, or len/4096 pages.
182
183    While all this is only really relevant to 040's, the system call
184    will just return an error (which we ignore) on other systems.  */
185
186 #define CLEAR_INSN_CACHE(beg, end)                                      \
187 {                                                                       \
188     unsigned _beg = (unsigned)(beg), _end = (unsigned)(end);            \
189     unsigned _len = ((_end / 16) - (_beg / 16) + 1) * 16;               \
190     __asm __volatile(                                                   \
191             ASM_MOV_INSN " %1, %-\n\t"     /* nr lines */               \
192             ASM_MOV_INSN " %#3, %-\n\t"    /* insn+data caches */       \
193             ASM_MOV_INSN " %#1, %-\n\t"    /* clear lines */            \
194             ASM_MOV_INSN " %0, %-\n\t"     /* beginning of buffer */    \
195             ASM_MOV_INSN " %#105, %-\n\t"  /* cache sub-function nr */  \
196             ASM_MOV_INSN " %#0, %-\n\t"    /* dummy return address */   \
197             ASM_MOV_INSN " %#38, %/d0\n\t" /* system call nr */         \
198             "trap %#0\n\t"                                              \
199             "add%.l %#24, %/sp"                                         \
200             : /* no outputs */                                          \
201             : "g"(_beg), "g"(_len)                                      \
202             : "%d0");                                                   \
203 }