|
|
1.1 root 1: /* Target definitions for GNU compiler for hppa 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: #define TARGET_DEFAULT (1+128+256) /* 1.1, gas, stub calls */
21:
22: #define TARGET_ARCHITECTURE \
23: { { "hppa", 1 }, /* same as snake. */ \
24: { "hppa1.0", -1 }, /* nosnake. */ \
25: }
26:
27: /* must before the inclusion of pa/pa.h */
28: #define NeXT_ASM
29:
30: #define MACHO_PIC 1
31:
32: #include "pa/pa.h"
33: #include "nextstep.h"
34:
35:
36: #define DEFAULT_TARGET_ARCH "hppa"
37:
38: #define HP_FP_ARG_DESCRIPTOR_REVERSED
39:
40: #undef CPP_PREDEFINES
41: #define CPP_PREDEFINES "-Dhppa -DNATURAL_ALIGNMENT -DNeXT -Dunix -D__MACH__ -D__BIG_ENDIAN__ -D__ARCHITECTURE__=\"hppa\" -D_PA_RISC1_1"
42:
43: #undef ASM_FILE_START
44: #define ASM_FILE_START
45:
46: #undef ASM_FILE_END
47: #undef ASM_OUTPUT_EXTERNAL_LIBCALL
48: #undef ASM_OUTPUT_EXTERNAL
49:
50: #undef FUNCTION_PROLOGUE
51: #define FUNCTION_PROLOGUE
52:
53: #undef FUNCTION_EPILOGUE
54: #define FUNCTION_EPILOGUE
55:
56: #undef GLOBAL_ASM_OP
57: #define GLOBAL_ASM_OP ".globl"
58:
59: #undef SIZE_TYPE
60: #define SIZE_TYPE "long unsigned int"
61:
62: #undef ASM_GLOBALIZE_LABEL
63: #define ASM_GLOBALIZE_LABEL(FILE,NAME) \
64: do { fprintf (FILE, "%s ", GLOBAL_ASM_OP); \
65: assemble_name (FILE, NAME); \
66: fputs ("\n", FILE);} while (0)
67:
68: /* This is how to output an internal numbered label where
69: PREFIX is the class of label and NUM is the number within the class. */
70:
71: #undef ASM_OUTPUT_INTERNAL_LABEL
72: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
73: asm_fprintf (FILE, "%0L%s%d:\n", PREFIX, NUM)
74:
75: /* This is how to store into the string LABEL
76: the symbol_ref name of an internal numbered label where
77: PREFIX is the class of label and NUM is the number within the class.
78: This is suitable for output with `assemble_name'. */
79:
80: #undef STRING_SECTION_NAME
81: #define STRING_SECTION_NAME "ascii"
82:
83: #undef ASM_GENERATE_INTERNAL_LABEL
84: #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
85: sprintf (LABEL, "*%s%d", PREFIX, NUM)
86:
87: /* This is how to output an assembler line defining a `double' constant. */
88:
89: #undef ASM_OUTPUT_DOUBLE
90: #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
91: do { \
92: long hex[2]; \
93: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, hex); \
94: fprintf(FILE, "\t; .double %.20g\n", (VALUE)); \
95: fprintf (FILE, "\t.long 0x%x\n\t.long 0x%x\n", hex[0], hex[1]); \
96: } while (0)
97:
98: /* This is how to output an assembler line defining a `float' constant. */
99:
100: #undef ASM_OUTPUT_FLOAT
101: #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
102: do { long l; \
103: REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
104: fprintf(FILE, "\t; .single %.12e\n", (VALUE)); \
105: fprintf (FILE, "\t.long 0x%x\n", l); \
106: } while (0)
107:
108: #undef ASM_OUTPUT_SKIP
109: #define ASM_OUTPUT_SKIP(FILE,SIZE) \
110: fprintf (FILE, "\t.space %u\n", (SIZE))
111:
112: /* Output to assembler file text saying following lines
113: may contain character constants, extra white space, comments, etc. */
114:
115: #undef ASM_APP_ON
116: #define ASM_APP_ON "#APP\n"
117:
118: /* Output to assembler file text saying following lines
119: no longer contain unusual constructs. */
120:
121: #undef ASM_APP_OFF
122: #define ASM_APP_OFF "#NO_APP\n"
123:
124: /* This is how to output a reference to a user-level label named NAME.
125: `assemble_name' uses this. */
126:
127: #define ASM_GENERATE_LABELREF(BUFFER,NAME) \
128: do { if (NAME[0] == '+' || NAME[0] == '-') sprintf (BUFFER, "\"%s\"", NAME); \
129: else if (!strncmp (NAME, "_OBJC_", 6)) sprintf (BUFFER, "L%s", NAME); \
130: else if (!strncmp (NAME, ".objc_class_name_", 17) \
131: || !strncmp (NAME, "$$", 2)) strcpy (BUFFER, NAME); \
132: else if (!strncmp (NAME, "mcount", 6)) sprintf (BUFFER, "%s", NAME); \
133: else sprintf (BUFFER, "_%s", NAME); } while (0)
134:
135: #undef ASM_OUTPUT_LABELREF
136: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
137: do { char __buf[256]; ASM_GENERATE_LABELREF (__buf, NAME); \
138: fprintf (FILE, "%s", __buf); } while (0)
139:
140: /* Output before read-only data. */
141:
142: #undef TEXT_SECTION_ASM_OP
143: #define TEXT_SECTION_ASM_OP ".text"
144:
145: /* Output before writable data. */
146:
147: #undef DATA_SECTION_ASM_OP
148: #define DATA_SECTION_ASM_OP ".data"
149:
150: /* override how BSS is handled */
151:
152: #undef BSS_SECTION_ASM_OP
153:
154: /* This says how to output an assembler line
155: to define a global common symbol. */
156:
157: #undef ASM_OUTPUT_COMMON
158: #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
159: ( fputs (".comm ", (FILE)), \
160: assemble_name ((FILE), (NAME)), \
161: fprintf ((FILE), ",%u\n", (ROUNDED)))
162:
163: /* This says how to output an assembler line
164: to define a local common symbol. */
165:
166: #undef ASM_OUTPUT_LOCAL
167: #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
168: ( fputs (".lcomm ", (FILE)), \
169: assemble_name ((FILE), (NAME)), \
170: fprintf ((FILE), ",%u\n", (ROUNDED)))
171:
172: #undef ASM_FORMAT_PRIVATE_NAME
173: #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
174: ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \
175: sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
176:
177: #undef ENCODE_SECTION_INFO
178:
179: #undef ASM_DECLARE_FUNCTION_NAME
180:
181: #undef TRAMPOLINE_TEMPLATE(FILE)
182: #define TRAMPOLINE_TEMPLATE(FILE) \
183: { \
184: fprintf (FILE, "\tldw 12(0,%%r22),%%r21\n"); \
185: fprintf (FILE, "\tbe 0(4,%%r21)\n"); \
186: fprintf (FILE, "\tldw 16(0,%%r22),%%r29\n"); \
187: fprintf (FILE, "\t.short 0\n"); \
188: fprintf (FILE, "\t.short 0\n"); \
189: }
190:
191: #undef ASM_OUTPUT_INT
192: #define ASM_OUTPUT_INT(FILE,VALUE) \
193: { fprintf (FILE, "\t.long "); \
194: if (function_label_operand (VALUE, VOIDmode) \
195: && in_section != in_text) \
196: fprintf (FILE, "P%%"); \
197: output_addr_const (FILE, (VALUE)); \
198: fprintf (FILE, "\n");}
199:
200: #undef ASM_OUTPUT_SHORT
201: #define ASM_OUTPUT_SHORT(FILE,VALUE) \
202: ( fprintf (FILE, "\t.short "), \
203: output_addr_const (FILE, (VALUE)), \
204: fprintf (FILE, "\n"))
205:
206: #undef ASM_OUTPUT_ADDR_VEC_ELT
207: #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
208: fprintf (FILE, "\tb L%d\n\tnop\n", VALUE)
209:
210: #define OUTPUT_COMPILER_STUB
211:
212: /* this may not work for double values -- hard coded to 32 bit entities */
213:
214: #define OBJC_FORWARDING_REG_OFFSET(ISREG, OFF, REGNO) \
215: do { OFF = (FP_REG_CLASS_P( REGNO_REG_CLASS(REGNO)) \
216: ? -2 * ((REGNO) - 44) - 4 \
217: : 4 * ((REGNO) - 26) - 4); \
218: ISREG = 0; } while (0)
219:
220: #undef FUNCTION_ARG
221: #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
222: (4 >= ((CUM) + FUNCTION_ARG_SIZE ((MODE), (TYPE))) \
223: ? gen_rtx (REG, (MODE), \
224: (FUNCTION_ARG_SIZE ((MODE), (TYPE)) > 1 \
225: ? (((MODE) == DFmode) \
226: ? ((CUM) ? 50 : 46) \
227: : ((CUM) ? 23 : 25)) \
228: : (((MODE) == SFmode) \
229: ? (44 + 2 * (CUM)) \
230: : (27 - (CUM) - FUNCTION_ARG_SIZE ((MODE), (TYPE))))))\
231: : 0)
232:
233: /*
234: After the magic in calls.c has moved an argument into some register,
235: this macro is expanded so the backend can choose to duplicate
236: or spill that load to somewhere else.
237: The NeXTSTEP/PA backend uses this to spill arguments from float
238: registers into the general purpose regs.
239:
240: NAME is the name of the function being called.
241: NREGS is the number of registers being loaded into.
242: REG_RTX is the rtx for the (first) register being loaded.
243: VALUE_RTX is the value being loaded.
244: MODE is the mode the value is loaded in.
245:
246: The USE_DUP_REG_ARG_LOAD macro allows emitting USE insns
247: for possible registers changed.
248: */
249:
250: #define DUP_REG_ARG_LOAD(NAME, NREGS, REG_RTX, VALUE_RTX, MODE) \
251: do { if ((MODE)==DFmode && REGNO(REG_RTX) >= 46) { \
252: move_block_to_reg ((REGNO(REG_RTX)==46 ? 25 : 23), \
253: validize_mem(VALUE_RTX), 2, MODE); \
254: } else if ((MODE)==SFmode && REGNO(REG_RTX) >= 44) { \
255: move_block_to_reg (26-((REGNO(REG_RTX)-44)/2), \
256: validize_mem(VALUE_RTX), 1, MODE); } \
257: } while (0)
258:
259: /* Emit insn's to actually use the spilled regs so the loads
260: will not be handled wrong by the optimizer. */
261: #define USE_DUP_REG_ARG_LOAD(NAME, NREGS, REG_RTX, MODE) \
262: do { if (NREGS == 0) { if ((MODE)==DFmode && REGNO(REG_RTX) >= 46) { \
263: use_regs ((REGNO(REG_RTX)==46 ? 25 : 23), 2); \
264: } else if ((MODE)==SFmode) { \
265: emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, 26-((REGNO (REG_RTX)-44)/2)))); } \
266: }} while (0)
267:
268: #define PROFILE_LABEL_PREFIX
269:
270: #undef OVERRIDE_OPTIONS
271:
272: #undef CONSTANT_ADDRESS_P
273: #define CONSTANT_ADDRESS_P(X) \
274: ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
275: || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
276: || GET_CODE (X) == HIGH) \
277: && (reload_in_progress || reload_completed \
278: || ! symbolic_expression_p (X) || machopic_operand_p (X)))
279:
280: #define HI_SUM_TARGET_RTX (gen_rtx (REG, SImode, 1))
281: #define HI_SUM_TARGET_REGNO 1
282:
283: #undef ASM_OUTPUT_ADDR_DIFF_ELT
284: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
285: fprintf (FILE, "\tb L%d\n\tnop\n", VALUE)
286:
287: #undef PIC_OFFSET_TABLE_REGNUM
288: #define PIC_OFFSET_TABLE_REGNUM 18
289:
290: #undef OPTIMIZATION_OPTIONS
291: #define OPTIMIZATION_OPTIONS(OPTIMIZE) \
292: { \
293: if (OPTIMIZE >= 1) \
294: { \
295: flag_cse_follow_jumps = 1; \
296: flag_cse_skip_blocks = 1; \
297: flag_expensive_optimizations = 1; \
298: flag_strength_reduce = 1; \
299: flag_rerun_cse_after_loop = 1; \
300: flag_caller_saves = 1; \
301: flag_schedule_insns = 1; \
302: flag_schedule_insns_after_reload = 1; \
303: } \
304: if (OPTIMIZE >= 2) \
305: flag_omit_frame_pointer = 1; \
306: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.