]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/m68k/a-ux.h
Merge in gcc2-ss-010999
[thirdparty/gcc.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:%{!traditional:-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 #define NO_SYS_SIGLIST
68
69 /* We provide atexit(), A/UX does not have it */
70 #define HAVE_ATEXIT
71
72 /* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
73 and bzero */
74 #define TARGET_MEM_FUNCTIONS
75
76 /* Resize standard types */
77
78 #undef SIZE_TYPE
79 #define SIZE_TYPE "unsigned int"
80
81 #undef PTRDIFF_TYPE
82 #define PTRDIFF_TYPE "int"
83
84 #undef WCHAR_TYPE
85 #define WCHAR_TYPE "unsigned int"
86
87 /* Every structure or union's size must be a multiple of 2 bytes. */
88 #define STRUCTURE_SIZE_BOUNDARY 16
89
90 /* Bits needed by collect */
91
92 #define OBJECT_FORMAT_COFF
93 #define MY_ISCOFF(m) ((m) == M68TVMAGIC || \
94 (m) == M68MAGIC || \
95 (m) == MC68TVMAGIC || \
96 (m) == MC68MAGIC || \
97 (m) == M68NSMAGIC)
98
99
100 #ifndef USE_COLLECT2
101 /* For .ctor/.dtor sections for collecting constructors */
102 /* We have special start/end files for defining [cd]tor lists */
103 #define CTOR_LISTS_DEFINED_EXTERNALLY
104 #endif
105
106
107 /*======================================================================*/
108 /* Calling convention and library support changes */
109
110 /* Define how to generate (in the callee) the output value of a function
111 and how to find (in the caller) the value returned by a function. VALTYPE
112 is the data type of the value (as a tree). If the precise function being
113 called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
114 For A/UX generate the result in d0, a0, or fp0 as appropriate. */
115
116 #undef FUNCTION_VALUE
117 #define FUNCTION_VALUE(VALTYPE, FUNC) \
118 (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
119 ? gen_rtx_REG (TYPE_MODE (VALTYPE), 16) \
120 : (POINTER_TYPE_P (VALTYPE) \
121 ? gen_rtx_REG (TYPE_MODE (VALTYPE), 8) \
122 : gen_rtx_REG (TYPE_MODE (VALTYPE), 0)))
123
124 #undef LIBCALL_VALUE
125 #define LIBCALL_VALUE(MODE) \
126 gen_rtx_REG ((MODE), ((TARGET_68881 && \
127 ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
128
129 /* 1 if N is a possible register number for a function value.
130 For A/UX allow d0, a0, or fp0 as return registers, for integral,
131 pointer, or floating types, respectively. Reject fp0 if not using a
132 68881 coprocessor. */
133
134 #undef FUNCTION_VALUE_REGNO_P
135 #define FUNCTION_VALUE_REGNO_P(N) \
136 ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
137
138 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
139 more than one register. */
140
141 #undef NEEDS_UNTYPED_CALL
142 #define NEEDS_UNTYPED_CALL 1
143
144 /* For compatibility with the large body of existing code which does not
145 always properly declare external functions returning pointer types, the
146 A/UX convention is to copy the value returned for pointer functions
147 from a0 to d0 in the function epilogue, so that callers that have
148 neglected to properly declare the callee can still find the correct return
149 value. */
150
151 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
152 { \
153 if (current_function_returns_pointer \
154 && ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
155 asm_fprintf (FILE, "\t%s %Ra0,%Rd0\n", ASM_MOV_INSN); \
156 }
157
158 /* How to call the function profiler */
159
160 #undef FUNCTION_PROFILER
161 #define FUNCTION_PROFILER(FILE, LABELNO) \
162 asm_fprintf (FILE, "\t%Olea %LLP%d,%Ra0\n\t%Ojbsr %s\n", \
163 (LABELNO), FUNCTION_PROFILER_SYMBOL)
164
165 /* Finalize the trampoline by flushing the insn cache */
166
167 #undef FINALIZE_TRAMPOLINE
168 #define FINALIZE_TRAMPOLINE(TRAMP) \
169 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
170 0, VOIDmode, 2, TRAMP, Pmode, \
171 plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
172
173 /* Clear the instruction cache from `beg' to `end'. This makes an
174 inline system call to SYS_sysm68k. The arguments are as follows:
175
176 sysm68k(105, addr, scope, cache, len)
177
178 105 - the subfunction code to clear the cache
179 addr - the start address for the flush
180 scope - the scope of the flush (see the cpush insn)
181 cache - which cache to flush (see the cpush insn)
182 len - a factor relating to the number of flushes to perform :
183 len/16 lines, or len/4096 pages.
184
185 While all this is only really relevant to 040's, the system call
186 will just return an error (which we ignore) on other systems. */
187
188 #define CLEAR_INSN_CACHE(beg, end) \
189 { \
190 unsigned _beg = (unsigned)(beg), _end = (unsigned)(end); \
191 unsigned _len = ((_end / 16) - (_beg / 16) + 1) * 16; \
192 __asm __volatile( \
193 ASM_MOV_INSN " %1, %-\n\t" /* nr lines */ \
194 ASM_MOV_INSN " %#3, %-\n\t" /* insn+data caches */ \
195 ASM_MOV_INSN " %#1, %-\n\t" /* clear lines */ \
196 ASM_MOV_INSN " %0, %-\n\t" /* beginning of buffer */ \
197 ASM_MOV_INSN " %#105, %-\n\t" /* cache sub-function nr */ \
198 ASM_MOV_INSN " %#0, %-\n\t" /* dummy return address */ \
199 ASM_MOV_INSN " %#38, %/d0\n\t" /* system call nr */ \
200 "trap %#0\n\t" \
201 "add%.l %#24, %/sp" \
202 : /* no outputs */ \
203 : "g"(_beg), "g"(_len) \
204 : "%d0"); \
205 }