Import final gcc2 snapshot (990109)
[official-gcc.git] / gcc / config / m68k / a-ux.h
blob2af1b9468cfac002354ad8b3fa34cc023548abc6
1 /* Definitions for Motorola 680x0 running A/UX
2 Copyright (C) 1996, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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.
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.
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. */
21 /* This file was renamed from aux.h because of MSDOS: aux.anything
22 isn't usable. Sigh. */
24 /* Execution environment */
26 #undef TARGET_DEFAULT
27 #define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020) /* 68020, 68881 */
29 #define CPP_PREDEFINES "-Dunix -Dm68k -DAUX -DmacII \
30 -Asystem(unix) -Asystem(AUX) -Acpu(m68k) -Amachine(m68k) -Amachine(macII)"
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 }}}}}}}"
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 }"
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 "
60 #undef ENDFILE_SPEC
61 #define ENDFILE_SPEC "crtn.o%s "
64 /*===================================================================*/
65 /* Compilation environment -- mostly */
67 #define NO_SYS_SIGLIST
69 /* We provide atexit(), A/UX does not have it */
70 #define HAVE_ATEXIT
72 /* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
73 and bzero */
74 #define TARGET_MEM_FUNCTIONS
76 /* Resize standard types */
78 #undef SIZE_TYPE
79 #define SIZE_TYPE "unsigned int"
81 #undef PTRDIFF_TYPE
82 #define PTRDIFF_TYPE "int"
84 #undef WCHAR_TYPE
85 #define WCHAR_TYPE "unsigned int"
87 /* Every structure or union's size must be a multiple of 2 bytes. */
88 #define STRUCTURE_SIZE_BOUNDARY 16
90 /* Bits needed by collect */
92 #define OBJECT_FORMAT_COFF
93 #define MY_ISCOFF(m) ((m) == M68TVMAGIC || \
94 (m) == M68MAGIC || \
95 (m) == MC68TVMAGIC || \
96 (m) == MC68MAGIC || \
97 (m) == M68NSMAGIC)
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
107 /*======================================================================*/
108 /* Calling convention and library support changes */
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. */
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)))
124 #undef LIBCALL_VALUE
125 #define LIBCALL_VALUE(MODE) \
126 gen_rtx_REG ((MODE), ((TARGET_68881 && \
127 ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
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. */
134 #undef FUNCTION_VALUE_REGNO_P
135 #define FUNCTION_VALUE_REGNO_P(N) \
136 ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
138 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
139 more than one register. */
141 #undef NEEDS_UNTYPED_CALL
142 #define NEEDS_UNTYPED_CALL 1
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. */
151 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
153 extern int current_function_returns_pointer; \
154 if ((current_function_returns_pointer) && \
155 ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
156 asm_fprintf (FILE, "\t%s %Ra0,%Rd0\n", ASM_MOV_INSN); \
159 /* How to call the function profiler */
161 #undef FUNCTION_PROFILER
162 #define FUNCTION_PROFILER(FILE, LABELNO) \
163 asm_fprintf (FILE, "\t%Olea %LLP%d,%Ra0\n\t%Ojbsr %s\n", \
164 (LABELNO), FUNCTION_PROFILER_SYMBOL)
166 /* Finalize the trampoline by flushing the insn cache */
168 #undef FINALIZE_TRAMPOLINE
169 #define FINALIZE_TRAMPOLINE(TRAMP) \
170 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"), \
171 0, VOIDmode, 2, TRAMP, Pmode, \
172 plus_constant (TRAMP, TRAMPOLINE_SIZE), Pmode);
174 /* Clear the instruction cache from `beg' to `end'. This makes an
175 inline system call to SYS_sysm68k. The arguments are as follows:
177 sysm68k(105, addr, scope, cache, len)
179 105 - the subfunction code to clear the cache
180 addr - the start address for the flush
181 scope - the scope of the flush (see the cpush insn)
182 cache - which cache to flush (see the cpush insn)
183 len - a factor relating to the number of flushes to perform :
184 len/16 lines, or len/4096 pages.
186 While all this is only really relevant to 040's, the system call
187 will just return an error (which we ignore) on other systems. */
189 #define CLEAR_INSN_CACHE(beg, end) \
191 unsigned _beg = (unsigned)(beg), _end = (unsigned)(end); \
192 unsigned _len = ((_end / 16) - (_beg / 16) + 1) * 16; \
193 __asm __volatile( \
194 ASM_MOV_INSN " %1, %-\n\t" /* nr lines */ \
195 ASM_MOV_INSN " %#3, %-\n\t" /* insn+data caches */ \
196 ASM_MOV_INSN " %#1, %-\n\t" /* clear lines */ \
197 ASM_MOV_INSN " %0, %-\n\t" /* beginning of buffer */ \
198 ASM_MOV_INSN " %#105, %-\n\t" /* cache sub-function nr */ \
199 ASM_MOV_INSN " %#0, %-\n\t" /* dummy return address */ \
200 ASM_MOV_INSN " %#38, %/d0\n\t" /* system call nr */ \
201 "trap %#0\n\t" \
202 "add%.l %#24, %/sp" \
203 : /* no outputs */ \
204 : "g"(_beg), "g"(_len) \
205 : "%d0"); \