1 /* Definitions for Motorola 680x0 running A/UX
2 Copyright (C) 1996, 1998, 1999 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)
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 */
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"
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 }}}}}}}"
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 }"
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 }}}\
61 #define ENDFILE_SPEC "crtn.o%s "
64 /*===================================================================*/
65 /* Compilation environment -- mostly */
67 /* We provide atexit(), A/UX does not have it */
70 /* Generate calls to memcpy, memcmp and memset, as opposed to bcopy, bcmp,
72 #define TARGET_MEM_FUNCTIONS
74 /* Resize standard types */
77 #define SIZE_TYPE "unsigned int"
80 #define PTRDIFF_TYPE "int"
83 #define WCHAR_TYPE "unsigned int"
85 /* Every structure or union's size must be a multiple of 2 bytes. */
86 #define STRUCTURE_SIZE_BOUNDARY 16
88 /* Bits needed by collect */
90 #define OBJECT_FORMAT_COFF
91 #define MY_ISCOFF(m) ((m) == M68TVMAGIC || \
93 (m) == MC68TVMAGIC || \
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
105 /*======================================================================*/
106 /* Calling convention and library support changes */
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. */
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)))
123 #define LIBCALL_VALUE(MODE) \
124 gen_rtx_REG ((MODE), ((TARGET_68881 && \
125 ((MODE) == SFmode || (MODE) == DFmode)) ? 16 : 0))
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. */
132 #undef FUNCTION_VALUE_REGNO_P
133 #define FUNCTION_VALUE_REGNO_P(N) \
134 ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
136 /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
137 more than one register. */
139 #undef NEEDS_UNTYPED_CALL
140 #define NEEDS_UNTYPED_CALL 1
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
149 #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
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); \
156 /* How to call the function profiler */
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)
163 /* Finalize the trampoline by flushing the insn cache */
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);
171 /* Clear the instruction cache from `beg' to `end'. This makes an
172 inline system call to SYS_sysm68k. The arguments are as follows:
174 sysm68k(105, addr, scope, cache, len)
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.
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. */
186 #define CLEAR_INSN_CACHE(beg, end) \
188 unsigned _beg = (unsigned)(beg), _end = (unsigned)(end); \
189 unsigned _len = ((_end / 16) - (_beg / 16) + 1) * 16; \
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 */ \
199 "add%.l %#24, %/sp" \
201 : "g"(_beg), "g"(_len) \