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