Initial revision
[official-gcc.git] / gcc / config / ns32k / genix.h
blobf0fe09cb807823604ec1dad3ba9de0f6843cccbf
1 /* Definitions of target machine for GNU compiler. Genix ns32000 version.
2 Copyright (C) 1987, 1988 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, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 #include "encore.h"
22 /* We don't want the one Encore needs. */
23 #undef ASM_SPEC
25 /* The following defines override ones in ns32k.h and prevent any attempts
26 to explicitly or implicitly make references to the SB register in the GCC
27 generated code. It is necessary to avoid such references under Genix V.3.1
28 because this OS doesn't even save/restore the SB on context switches! */
30 #define IS_OK_REG_FOR_BASE_P(X) \
31 ( (GET_CODE (X) == REG) && REG_OK_FOR_BASE_P (X) )
33 #undef INDIRECTABLE_1_ADDRESS_P
34 #define INDIRECTABLE_1_ADDRESS_P(X) \
35 (CONSTANT_ADDRESS_NO_LABEL_P (X) \
36 || IS_OK_REG_FOR_BASE_P (X) \
37 || (GET_CODE (X) == PLUS \
38 && IS_OK_REG_FOR_BASE_P (XEXP (X, 0)) \
39 && CONSTANT_ADDRESS_P (XEXP (X, 1)) ) )
41 /* Note that for double indirects, only FP, SP, and SB are allowed
42 as the inner-most base register. But we are avoiding use of SB. */
44 #undef MEM_REG
45 #define MEM_REG(X) \
46 ( (GET_CODE (X) == REG) \
47 && ( (REGNO (X) == FRAME_POINTER_REGNUM) \
48 || (REGNO (X) == STACK_POINTER_REGNUM) ) )
50 #undef INDIRECTABLE_2_ADDRESS_P
51 #define INDIRECTABLE_2_ADDRESS_P(X) \
52 (GET_CODE (X) == MEM \
53 && (((xfoo0 = XEXP (X, 0), MEM_REG (xfoo0)) \
54 || (GET_CODE (xfoo0) == PLUS \
55 && MEM_REG (XEXP (xfoo0, 0)) \
56 && CONSTANT_ADDRESS_NO_LABEL_P (XEXP (xfoo0, 1)))) \
57 || CONSTANT_ADDRESS_NO_LABEL_P (xfoo0)))
59 /* Go to ADDR if X is a valid address not using indexing.
60 (This much is the easy part.) */
61 #undef GO_IF_NONINDEXED_ADDRESS
62 #define GO_IF_NONINDEXED_ADDRESS(X, ADDR) \
63 { register rtx xfoob = (X); \
64 if (GET_CODE (xfoob) == REG) goto ADDR; \
65 if (INDIRECTABLE_1_ADDRESS_P(X)) goto ADDR; \
66 if (CONSTANT_P(X)) goto ADDR; \
67 if (INDIRECTABLE_2_ADDRESS_P (X)) goto ADDR; \
68 if (GET_CODE (X) == PLUS) \
69 if (CONSTANT_ADDRESS_NO_LABEL_P (XEXP (X, 1))) \
70 if (INDIRECTABLE_2_ADDRESS_P (XEXP (X, 0))) \
71 goto ADDR; \
74 /* A bug in the GNX 3.X assembler causes references to external symbols to
75 be mishandled if the symbol is also used as the name of a function-local
76 variable or as the name of a struct or union field. The problem only
77 appears when you are also using the -g option so that SDB debugging
78 directives are also being produced by GCC. In such cases, the assembler
79 gets the external entity confused with the local entity and addressing
80 havoc ensues. The solution is to get GCC to produce .global directives
81 for all external entities which are actually referenced within the current
82 source file. The following macro does this. */
84 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
85 ASM_GLOBALIZE_LABEL(FILE,NAME);
87 /* Genix wants 0l instead of 0f. */
89 #undef ASM_OUTPUT_DOUBLE
90 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
91 fprintf (FILE, "\t.long 0l%.20e\n", (VALUE))
93 /* A bug in the GNX 3.X linker prevents symbol-table entries with a storage-
94 class field of C_EFCN (-1) from being accepted. */
96 #ifdef PUT_SDB_EPILOGUE_END
97 #undef PUT_SDB_EPILOGUE_END
98 #endif
99 #define PUT_SDB_EPILOGUE_END(NAME)
101 #undef TARGET_VERSION
102 #define TARGET_VERSION fprintf (stderr, " (32000, National syntax)");
104 /* Same as the encore definition except
105 * Different syntax for double constants.
106 * Don't output `?' before external regs.
107 * Output `(sb)' in certain indirect refs. */
109 #undef PRINT_OPERAND
110 #define PRINT_OPERAND(FILE, X, CODE) \
111 { if (CODE == '$') putc ('$', FILE); \
112 else if (CODE == '?'); \
113 else if (GET_CODE (X) == REG) \
114 fprintf (FILE, "%s", reg_names[REGNO (X)]); \
115 else if (GET_CODE (X) == MEM) \
117 rtx xfoo; \
118 xfoo = XEXP (X, 0); \
119 switch (GET_CODE (xfoo)) \
121 case MEM: \
122 if (GET_CODE (XEXP (xfoo, 0)) == REG) \
123 if (REGNO (XEXP (xfoo, 0)) == STACK_POINTER_REGNUM) \
124 fprintf (FILE, "0(0(sp))"); \
125 else fprintf (FILE, "0(0(%s))", \
126 reg_names[REGNO (XEXP (xfoo, 0))]); \
127 else \
129 extern int paren_base_reg_printed; \
130 fprintf (FILE, "0("); \
131 paren_base_reg_printed = 0; \
132 output_address (xfoo); \
133 if (!paren_base_reg_printed) \
134 fprintf (FILE, "(sb)"); \
135 putc (')', FILE); \
137 break; \
138 case REG: \
139 fprintf (FILE, "0(%s)", reg_names[REGNO (xfoo)]); \
140 break; \
141 case PRE_DEC: \
142 case POST_INC: \
143 fprintf (FILE, "tos"); \
144 break; \
145 case CONST_INT: \
146 fprintf (FILE, "@%d", INTVAL (xfoo)); \
147 break; \
148 default: \
149 output_address (xfoo); \
150 break; \
153 else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != DImode) \
154 if (GET_MODE (X) == DFmode) \
155 { union { double d; int i[2]; } u; \
156 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
157 fprintf (FILE, "$0l%.20e", u.d); } \
158 else { union { double d; int i[2]; } u; \
159 u.i[0] = CONST_DOUBLE_LOW (X); u.i[1] = CONST_DOUBLE_HIGH (X); \
160 fprintf (FILE, "$0f%.20e", u.d); } \
161 else if (GET_CODE (X) == CONST) \
162 output_addr_const (FILE, X); \
163 else { putc ('$', FILE); output_addr_const (FILE, X); }}