|
|
1.1 root 1: /* Target definitions for GNU compiler for mc680x0 running NeXTSTEP
1.1.1.3 root 2: Copyright (C) 1989, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
1.1 root 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
1.1.1.4 ! root 18: the Free Software Foundation, 59 Temple Place - Suite 330,
! 19: Boston, MA 02111-1307, USA. */
1.1 root 20:
21: #include "m68k/m68k.h"
22: #include "nextstep.h"
23: #include "machmode.h"
24: #include "real.h"
25:
26: /* See m68k.h. 0407 means 68040 (or 68030 or 68020, with 68881/2). */
27:
28: #define TARGET_DEFAULT 0407
29:
30: /* Boundary (in *bits*) on which stack pointer should be aligned. */
31:
32: #undef STACK_BOUNDARY
33: #define STACK_BOUNDARY 32
34:
35: /* Names to predefine in the preprocessor for this target machine. */
36:
1.1.1.2 root 37: #define CPP_PREDEFINES "-Dmc68000 -Dm68k -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"m68k\" -Asystem(unix) -Asystem(mach) -Acpu(m68k) -Amachine(m68k)"
1.1 root 38:
39: /* Every structure or union's size must be a multiple of 2 bytes.
40: (Why isn't this in m68k.h?) */
41:
42: #define STRUCTURE_SIZE_BOUNDARY 16
43: /* This is how to output an assembler line defining a `double' constant. */
44:
45: #undef ASM_OUTPUT_DOUBLE
46: #ifdef REAL_VALUE_TO_TARGET_DOUBLE
47: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
48: do { \
49: long hex[2]; \
50: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
51: fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \
52: } while (0)
53: #else
54: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
55: do { if (REAL_VALUE_ISINF (VALUE)) \
56: { \
57: if (REAL_VALUE_NEGATIVE (VALUE)) \
58: fprintf (FILE, "\t.double 0r-99e999\n"); \
59: else \
60: fprintf (FILE, "\t.double 0r99e999\n"); \
61: } \
62: else \
63: { char dstr[30]; \
64: REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
65: fprintf (FILE, "\t.double 0r%s\n", dstr); \
66: } \
67: } while (0)
68: #endif
69:
70: /* This is how to output an assembler line defining a `float' constant. */
71:
72: #undef ASM_OUTPUT_FLOAT
73: #ifdef REAL_VALUE_TO_TARGET_SINGLE
74: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
75: do { \
76: long hex; \
77: REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
78: fprintf (FILE, "\t.long 0x%x\n", hex); \
79: } while (0)
80: #else
81: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
82: do { if (REAL_VALUE_ISINF (VALUE)) \
83: { \
84: if (REAL_VALUE_NEGATIVE (VALUE)) \
85: fprintf (FILE, "\t.single 0r-99e999\n"); \
86: else \
87: fprintf (FILE, "\t.single 0r99e999\n"); \
88: } \
89: else \
90: { char dstr[30]; \
91: REAL_VALUE_TO_DECIMAL ((VALUE), "%.20e", dstr); \
92: fprintf (FILE, "\t.single 0r%s\n", dstr); \
93: } \
94: } while (0)
95: #endif
96:
97: #undef ASM_OUTPUT_FLOAT_OPERAND
98: #ifdef REAL_VALUE_TO_TARGET_SINGLE
99: #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
100: do { \
101: long hex; \
102: REAL_VALUE_TO_TARGET_SINGLE (VALUE, hex); \
103: fprintf (FILE, "#0%c%x", (CODE) == 'f' ? 'b' : 'x', hex); \
104: } while (0)
105: #else
106: #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE) \
107: do{ \
108: if (CODE != 'f') \
109: { \
110: long l; \
111: REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
112: if (sizeof (int) == sizeof (long)) \
113: asm_fprintf ((FILE), "%I0x%x", l); \
114: else \
115: asm_fprintf ((FILE), "%I0x%lx", l); \
116: } \
117: else if (REAL_VALUE_ISINF (VALUE)) \
118: { \
119: if (REAL_VALUE_NEGATIVE (VALUE)) \
120: fprintf (FILE, "#0r-99e999"); \
121: else \
122: fprintf (FILE, "#0r99e999"); \
123: } \
124: else \
125: { char dstr[30]; \
126: REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr); \
127: fprintf (FILE, "#0r%s", dstr); \
128: } \
129: } while (0)
130: #endif
131:
132: #undef ASM_OUTPUT_DOUBLE_OPERAND
133: #ifdef REAL_VALUE_TO_TARGET_DOUBLE
134: #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
135: do { \
136: long hex[2]; \
137: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
138: fprintf (FILE, "#0b%x%08x", hex[0], hex[1]); \
139: } while (0)
140: #else
141: #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE) \
142: do { if (REAL_VALUE_ISINF (VALUE)) \
143: { \
144: if (REAL_VALUE_NEGATIVE (VALUE)) \
145: fprintf (FILE, "#0r-99e999"); \
146: else \
147: fprintf (FILE, "#0r99e999"); \
148: } \
149: else \
150: { char dstr[30]; \
151: REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr); \
152: fprintf (FILE, "#0r%s", dstr); \
153: } \
154: } while (0)
155: #endif
156:
157: /* We do not define JUMP_TABLES_IN_TEXT_SECTION, since we wish to keep
158: the text section pure. There is no point in addressing the jump
159: tables using pc relative addressing, since they are not in the text
160: section, so we undefine CASE_VECTOR_PC_RELATIVE. This also
161: causes the compiler to use absolute addresses in the jump table,
162: so we redefine CASE_VECTOR_MODE to be SImode. */
163:
164: #undef CASE_VECTOR_MODE
165: #define CASE_VECTOR_MODE SImode
166: #undef CASE_VECTOR_PC_RELATIVE
167:
168: /* Make sure jump tables have the same alignment as other pointers. */
169:
170: #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLEINSN) \
171: { ASM_OUTPUT_ALIGN (FILE, 1); ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM); }
172:
173: /* Don't treat addresses involving labels differently from symbol names.
174: Previously, references to labels generated pc-relative addressing modes
175: while references to symbol names generated absolute addressing modes. */
176:
177: #undef GO_IF_INDEXABLE_BASE(X, ADDR)
178: #define GO_IF_INDEXABLE_BASE(X, ADDR) \
1.1.1.3 root 179: { if (LEGITIMATE_BASE_REG_P (X)) goto ADDR; }
1.1 root 180:
181: /* This accounts for the return pc and saved fp on the m68k. */
182:
183: #define OBJC_FORWARDING_STACK_OFFSET 8
184: #define OBJC_FORWARDING_MIN_OFFSET 8
1.1.1.2 root 185:
186: /* INITIALIZE_TRAMPOLINE is changed so that it also enables executable
187: stack. The __enable_execute_stack also clears the insn cache. */
188:
189: /* NOTE: part of this is copied from m68k.h */
190: #undef INITIALIZE_TRAMPOLINE
191: #define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
192: { \
193: rtx _addr, _func; \
194: emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 2)), TRAMP); \
195: emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 18)), CXT); \
196: emit_move_insn (gen_rtx (MEM, SImode, plus_constant (TRAMP, 22)), FNADDR); \
197: _addr = memory_address (SImode, (TRAMP)); \
198: _func = gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"); \
199: emit_library_call (_func, 0, VOIDmode, 1, _addr, Pmode); \
200: }
201:
202: /* A C expression used to clear the instruction cache from
203: address BEG to address END. On NeXTSTEP this i a system trap. */
204:
205: #define CLEAR_INSN_CACHE(BEG, END) \
206: asm volatile ("trap #2")
207:
1.1.1.3 root 208: /* GCC is the primary compiler for NeXTSTEP, so we don't need this. */
209: #undef PCC_STATIC_STRUCT_RETURN
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.