|
|
1.1 root 1: /* Target definitions for GNU compiler for mc680x0 running System V.4
2: Copyright (C) 1991 Free Software Foundation, Inc.
3:
4: Written by Ron Guilmette ([email protected]) and Fred Fish ([email protected]).
5:
6: This file is part of GNU CC.
7:
8: GNU CC 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 2, or (at your option)
11: any later version.
12:
13: GNU CC 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 GNU CC; see the file COPYING. If not, write to
20: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21:
22: /* Use SGS_* macros to control compilation in m68k.md */
23:
24: #define SGS_SWAP_W /* Use swap.w rather than just plain swap */
25: #define SGS_SWITCH_TABLES /* Different switch table handling */
26:
27: #include "m68ksgs.h" /* The m68k/SVR4 assembler is SGS based */
28: #include "svr4.h" /* Pick up the generic SVR4 macros */
29:
30: /* See m68k.h. 7 means 68020 with 68881. */
31:
32: #ifndef TARGET_DEFAULT
33: #define TARGET_DEFAULT (5 /*68020*/ + 2 /*68881*/)
34: #endif
35:
36: /* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special
37: g++ assembler names. When this is defined, g++ uses embedded '.'
38: characters and some m68k assemblers have problems with this. The
39: chances are much greater that any particular assembler will permit
40: embedded '$' characters. */
41:
42: #undef NO_DOLLAR_IN_LABEL
43:
44: /* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine
45: is to use the nonreentrant technique for returning structure and union
46: values, as commonly implemented by the AT&T Portable C Compiler (PCC).
47: When defined, the gcc option -fpcc-struct-return can be used to cause
48: this form to be generated. When undefined, the option does nothing.
49: For m68k SVR4, the convention is to use a reentrant technique compatible
50: with the gcc default, so override the definition of this macro in m68k.h */
51:
52: #undef PCC_STATIC_STRUCT_RETURN
53:
54: /* Provide a set of pre-definitions and pre-assertions appropriate for
55: the m68k running svr4. __svr4__ is our extension. */
56:
57: #define CPP_PREDEFINES \
58: "-Dm68k -Dunix -D__svr4__ -Asystem(unix) -Acpu(m68k) -Amachine(m68k)"
59:
60: /* Test to see if the target includes a 68881 by default, and use CPP_SPEC
61: to control whether or not __HAVE_68881__ is defined by default or not.
62: If a 68881 is the default, gcc will use inline 68881 instructions, by
63: predefining __HAVE_68881__, unless -msoft-float is specified.
64: If a 68881 is not the default, gcc will only define __HAVE_68881__ if
65: -m68881 is specified. */
66:
67: #if TARGET_DEFAULT & 2
68: #define CPP_SPEC "%{!msoft-float:-D__HAVE_68881__}"
69: #else
70: #define CPP_SPEC "%{m68881:-D__HAVE_68881__}"
71: #endif
72:
73: /* Output assembler code to FILE to increment profiler label # LABELNO
74: for profiling a function entry. We override the definition in m68k.h
75: and match the way the native m68k/SVR4 compiler does profiling, with the
76: address of the profile counter in a1, not a0, and using bsr rather
77: than jsr. */
78:
79: #undef FUNCTION_PROFILER
80: #define FUNCTION_PROFILER(FILE, LABELNO) \
81: asm_fprintf ((FILE), "\tlea.l\t(%LLP%d,%Rpc),%Ra1\n\tbsr\t_mcount\n", \
82: (LABELNO))
83:
84: /* Local common symbols are declared to the assembler with ".lcomm" rather
85: than ".bss", so override the definition in svr4.h */
86:
87: #undef BSS_ASM_OP
88: #define BSS_ASM_OP "\t.lcomm"
89:
90: /* Register in which address to store a structure value is passed to a
91: function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
92:
93: #undef STRUCT_VALUE_REGNUM
94: #define STRUCT_VALUE_REGNUM 8
95:
96: #define ASM_COMMENT_START "#"
97:
98: #undef TYPE_OPERAND_FMT
99: #define TYPE_OPERAND_FMT "@%s"
100:
101: /* Define how the m68k registers should be numbered for Dwarf output.
102: The numbering provided here should be compatible with the native
103: SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7
104: are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */
105:
106: #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
107:
108: /* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip".
109: It is then overridden by m68ksgs.h to use ".space", and again by svr4.h
110: to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the
111: definition from m68ksgs.h here. Note that ASM_NO_SKIP_IN_TEXT is
112: defined in m68ksgs.h, so we don't have to repeat it here. */
113:
114: #undef ASM_OUTPUT_SKIP
115: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
116: fprintf (FILE, "%s %u\n", SPACE_ASM_OP, (SIZE))
117:
118: /* 1 if N is a possible register number for a function value.
119: For m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
120: pointer, or floating types, respectively. Reject fp0 if not using a
121: 68881 coprocessor. */
122:
123: #undef FUNCTION_VALUE_REGNO_P
124: #define FUNCTION_VALUE_REGNO_P(N) \
125: ((N) == 0 || (N) == 8 || (TARGET_68881 && (N) == 16))
126:
127: /* Define how to generate (in the callee) the output value of a function
128: and how to find (in the caller) the value returned by a function. VALTYPE
129: is the data type of the value (as a tree). If the precise function being
130: called is known, FUNC is its FUNCTION_DECL; otherwise, FUNC is 0.
131: For m68k/SVR4 generate the result in d0, a0, or fp0 as appropriate. */
132:
133: #undef FUNCTION_VALUE
134: #define FUNCTION_VALUE(VALTYPE, FUNC) \
135: (TREE_CODE (VALTYPE) == REAL_TYPE && TARGET_68881 \
136: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 16) \
137: : (TREE_CODE (VALTYPE) == POINTER_TYPE \
138: ? gen_rtx (REG, TYPE_MODE (VALTYPE), 8) \
139: : gen_rtx (REG, TYPE_MODE (VALTYPE), 0)))
140:
141: /* For compatibility with the large body of existing code which does not
142: always properly declare external functions returning pointer types, the
143: m68k/SVR4 convention is to copy the value returned for pointer functions
144: from a0 to d0 in the function epilogue, so that callers that have
145: neglected to properly declare the callee can still find the correct return
146: value. */
147:
148: extern int current_function_returns_pointer;
149: #define FUNCTION_EXTRA_EPILOGUE(FILE, SIZE) \
150: do { \
151: if ((current_function_returns_pointer) && \
152: ! find_equiv_reg (0, get_last_insn (), 0, 0, 0, 8, Pmode)) \
153: asm_fprintf (FILE, "\tmov.l %Ra0,%Rd0\n"); \
154: } while (0);
155:
156: /* Define how to find the value returned by a library function assuming the
157: value has mode MODE.
158: For m68k/SVR4 look for integer values in d0, pointer values in d0
159: (returned in both d0 and a0), and floating values in fp0. */
160:
161: #undef LIBCALL_VALUE
162: #define LIBCALL_VALUE(MODE) \
163: (((MODE) == SFmode || (MODE) == DFmode) && TARGET_68881 \
164: ? gen_rtx (REG, (MODE), 16) \
165: : gen_rtx (REG, (MODE), 0))
166:
167: /* Boundary (in *bits*) on which stack pointer should be aligned.
168: The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
169:
170: #undef STACK_BOUNDARY
171: #define STACK_BOUNDARY 32
172:
173: /* Alignment of field after `int : 0' in a structure.
174: For m68k/SVR4, this is the next longword boundary. */
175:
176: #undef EMPTY_FIELD_BOUNDARY
177: #define EMPTY_FIELD_BOUNDARY 32
178:
179: /* No data type wants to be aligned rounder than this.
180: For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
181: boundaries */
182:
183: #undef BIGGEST_ALIGNMENT
184: #define BIGGEST_ALIGNMENT 64
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.