|
|
1.1 root 1: /* Definitions of target machine for GNU compiler.
2: Intel 386 (OSF/1 with OSF/rose) version.
3: Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
4:
5: This file is part of GNU CC.
6:
7: GNU CC is free software; you can redistribute it and/or modify
8: it under the terms of the GNU General Public License as published by
9: the Free Software Foundation; either version 2, or (at your option)
10: any later version.
11:
12: GNU CC is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with GNU CC; see the file COPYING. If not, write to
19: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20:
21: #include "halfpic.h"
22: #include "i386/gstabs.h"
23:
24: /* Get perform_* macros to build libgcc.a. */
25: #include "i386/perform.h"
26:
27: #define OSF_OS
28:
29: #undef WORD_SWITCH_TAKES_ARG
30: #define WORD_SWITCH_TAKES_ARG(STR) \
31: (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
32:
33: /* This defines which switch letters take arguments. On svr4, most of
34: the normal cases (defined in gcc.c) apply, and we also have -h* and
35: -z* options (for the linker). */
36:
37: #define SWITCH_TAKES_ARG(CHAR) \
38: ( (CHAR) == 'D' \
39: || (CHAR) == 'U' \
40: || (CHAR) == 'o' \
41: || (CHAR) == 'e' \
42: || (CHAR) == 'T' \
43: || (CHAR) == 'u' \
44: || (CHAR) == 'I' \
45: || (CHAR) == 'm' \
46: || (CHAR) == 'L' \
47: || (CHAR) == 'A' \
48: || (CHAR) == 'h' \
49: || (CHAR) == 'z')
50:
51: #define MASK_HALF_PIC 0x40000000 /* Mask for half-pic code */
52: #define MASK_HALF_PIC_DEBUG 0x20000000 /* Debug flag */
53: #define MASK_ELF 0x10000000 /* ELF not rose */
54: #define MASK_NO_IDENT 0x08000000 /* suppress .ident */
55: #define MASK_NO_UNDERSCORES 0x04000000 /* suppress leading _ */
56: #define MASK_LARGE_ALIGN 0x02000000 /* align to >word boundaries */
57: #define MASK_NO_MCOUNT 0x01000000 /* profiling uses mcount_ptr */
58:
59: #define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)
60: #define TARGET_DEBUG (target_flags & MASK_HALF_PIC_DEBUG)
61: #define HALF_PIC_DEBUG TARGET_DEBUG
62: #define TARGET_ELF (target_flags & MASK_ELF)
63: #define TARGET_ROSE ((target_flags & MASK_ELF) == 0)
64: #define TARGET_IDENT ((target_flags & MASK_NO_IDENT) == 0)
65: #define TARGET_UNDERSCORES ((target_flags & MASK_NO_UNDERSCORES) == 0)
66: #define TARGET_LARGE_ALIGN (target_flags & MASK_LARGE_ALIGN)
67: #define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)
68:
69: #undef SUBTARGET_SWITCHES
70: #define SUBTARGET_SWITCHES \
71: { "half-pic", MASK_HALF_PIC}, \
72: { "no-half-pic", -MASK_HALF_PIC}, \
73: { "debug-half-pic", MASK_HALF_PIC_DEBUG}, \
74: { "debugb", MASK_HALF_PIC_DEBUG}, \
75: { "elf", MASK_ELF}, \
76: { "rose", -MASK_ELF}, \
77: { "ident", -MASK_NO_IDENT}, \
78: { "no-ident", MASK_NO_IDENT}, \
79: { "underscores", -MASK_NO_UNDERSCORES}, \
80: { "no-underscores", MASK_NO_UNDERSCORES}, \
81: { "large-align", MASK_LARGE_ALIGN}, \
82: { "no-large-align",-MASK_LARGE_ALIGN}, \
83: { "mcount", -MASK_NO_MCOUNT}, \
84: { "no-mcount", MASK_NO_MCOUNT},
85:
86: /* OSF/rose uses stabs, not dwarf. */
87: #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
88:
89: #ifndef DWARF_DEBUGGING_INFO
90: #define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */
91: #endif
92:
93: /* Handle #pragma weak and #pragma pack. */
94:
95: #define HANDLE_SYSV_PRAGMA
96:
97: /* Change default predefines. */
98: #undef CPP_PREDEFINES
99: #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Di386 -Asystem(unix) -Asystem(xpg4) -Acpu(i386) -Amachine(i386)"
100:
101: #undef CPP_SPEC
102: #define CPP_SPEC "\
103: %{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \
104: %{melf: -D__ELF__ %{fpic: -D__SHARED__}} \
105: %{mno-underscores: -D__NO_UNDERSCORES__} \
106: %{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
107: %{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
108: %{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
109: %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
110: %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
111: %{.C: -D__LANGUAGE_C_PLUS_PLUS} \
112: %{.m: -D__LANGUAGE_OBJECTIVE_C} \
113: %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
114:
115: /* Turn on -pic-extern by default. */
116: #undef CC1_SPEC
117: #define CC1_SPEC "\
118: %{!melf: %{!mrose: -mrose }} \
119: %{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }}} \
120: %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
121: %{!melf: %{pic-none: -mno-half-pic} \
122: %{pic-extern: } %{pic-lib: } %{pic-calls: } %{pic-names*: } \
123: %{!pic-none: -mhalf-pic }}"
124:
125: #undef ASM_SPEC
126: #define ASM_SPEC "%{v*: -v}"
127:
128: #undef LINK_SPEC
129: #define LINK_SPEC "%{v*: -v} \
130: %{!melf: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
131: %{nostdlib} %{noshrlib} %{glue}} \
132: %{melf: %{dy} %{dn} %{glue: } \
133: %{h*} %{z*} \
134: %{static:-dn -Bstatic} \
135: %{shared:-G -dy} \
136: %{symbolic:-Bsymbolic -G -dy} \
137: %{G:-G} \
138: %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \
139: %{noshrlib: -dn } %{pic-none: -dn } \
140: %{!noshrlib: %{!pic-none: -dy}}}}}}}}"
141:
142: #undef LIB_SPEC
143: #define LIB_SPEC "-lc"
144:
145: #undef LIBG_SPEC
146: #define LIBG_SPEC ""
147:
148: #undef STARTFILE_SPEC
149: #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
150:
151: #undef TARGET_VERSION_INTERNAL
152: #undef TARGET_VERSION
153:
154: #define I386_VERSION " 80386, OSF/rose objects"
155:
156: #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
157: #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
158:
159: #undef MD_EXEC_PREFIX
160: #define MD_EXEC_PREFIX "/usr/ccs/gcc/"
161:
162: #undef MD_STARTFILE_PREFIX
163: #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
164:
165: /* Specify size_t, ptrdiff_t, and wchar_t types. */
166: #undef SIZE_TYPE
167: #undef PTRDIFF_TYPE
168: #undef WCHAR_TYPE
169: #undef WCHAR_TYPE_SIZE
170:
171: #define SIZE_TYPE "long unsigned int"
172: #define PTRDIFF_TYPE "int"
173: #define WCHAR_TYPE "unsigned int"
174: #define WCHAR_TYPE_SIZE BITS_PER_WORD
175:
176: /* Temporarily turn off long double being 96 bits. */
177: #undef LONG_DOUBLE_TYPE_SIZE
178:
179: /* This macro generates the assembly code for function entry.
180: FILE is a stdio stream to output the code to.
181: SIZE is an int: how many units of temporary storage to allocate.
182: Refer to the array `regs_ever_live' to determine which registers
183: to save; `regs_ever_live[I]' is nonzero if register number I
184: is ever used in the function. This macro is responsible for
185: knowing which registers should not be saved even if used.
186:
187: We override it here to allow for the new profiling code to go before
188: the prologue and the old mcount code to go after the prologue (and
189: after %ebx has been set up for ELF shared library support). */
190:
191: #define OSF_PROFILE_BEFORE_PROLOGUE \
192: (!TARGET_MCOUNT \
193: && !current_function_needs_context \
194: && (!flag_pic \
195: || !frame_pointer_needed \
196: || (!current_function_uses_pic_offset_table \
197: && !current_function_uses_const_pool)))
198:
199: #undef FUNCTION_PROLOGUE
200: #define FUNCTION_PROLOGUE(FILE, SIZE) \
201: do \
202: { \
203: char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
204: char *lprefix = LPREFIX; \
205: int labelno = profile_label_no; \
206: \
207: if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
208: { \
209: if (!flag_pic && !HALF_PIC_P ()) \
210: { \
211: fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
212: fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
213: } \
214: \
215: else if (HALF_PIC_P ()) \
216: { \
217: rtx symref; \
218: \
219: HALF_PIC_EXTERNAL ("_mcount_ptr"); \
220: symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \
221: "_mcount_ptr")); \
222: \
223: fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
224: fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \
225: XSTR (symref, 0)); \
226: fprintf (FILE, "\tcall *(%%eax)\n"); \
227: } \
228: \
229: else \
230: { \
231: static int call_no = 0; \
232: \
233: fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \
234: fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \
235: fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
236: lprefix, call_no++); \
237: fprintf (FILE, "\tleal $%sP%d@GOTOFF(%%eax),%%edx\n", \
238: lprefix, labelno); \
239: fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
240: prefix); \
241: fprintf (FILE, "\tcall *(%%eax)\n"); \
242: } \
243: } \
244: \
245: function_prologue (FILE, SIZE); \
246: } \
247: while (0)
248:
249: /* A C statement or compound statement to output to FILE some assembler code to
250: call the profiling subroutine `mcount'. Before calling, the assembler code
251: must load the address of a counter variable into a register where `mcount'
252: expects to find the address. The name of this variable is `LP' followed by
253: the number LABELNO, so you would generate the name using `LP%d' in a
254: `fprintf'.
255:
256: The details of how the address should be passed to `mcount' are determined
257: by your operating system environment, not by GNU CC. To figure them out,
258: compile a small program for profiling using the system's installed C
259: compiler and look at the assembler code that results. */
260:
261: #undef FUNCTION_PROFILER
262: #define FUNCTION_PROFILER(FILE, LABELNO) \
263: do \
264: { \
265: if (!OSF_PROFILE_BEFORE_PROLOGUE) \
266: { \
267: char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
268: char *lprefix = LPREFIX; \
269: int labelno = LABELNO; \
270: \
271: /* Note that OSF/rose blew it in terms of calling mcount, \
272: since OSF/rose prepends a leading underscore, but mcount's \
273: doesn't. At present, we keep this kludge for ELF as well \
274: to allow old kernels to build profiling. */ \
275: \
276: if (flag_pic \
277: && !current_function_uses_pic_offset_table \
278: && !current_function_uses_const_pool) \
279: abort (); \
280: \
281: if (TARGET_MCOUNT && flag_pic) \
282: { \
283: fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
284: lprefix, labelno); \
285: fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
286: } \
287: \
288: else if (TARGET_MCOUNT && HALF_PIC_P ()) \
289: { \
290: rtx symdef; \
291: \
292: HALF_PIC_EXTERNAL ("mcount"); \
293: symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \
294: fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
295: fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \
296: } \
297: \
298: else if (TARGET_MCOUNT) \
299: { \
300: fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
301: fprintf (FILE, "\tcall %smcount\n", prefix); \
302: } \
303: \
304: else if (flag_pic && frame_pointer_needed) \
305: { \
306: fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
307: fprintf (FILE, "\tpushl %%ecx\n"); \
308: fprintf (FILE, "\tleal $%sP%d@GOTOFF(%%ebx),%%edx\n", \
309: lprefix, labelno); \
310: fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%eax),%%eax\n"); \
311: fprintf (FILE, "\tcall *(%%eax)\n"); \
312: fprintf (FILE, "\tpopl %%eax\n"); \
313: } \
314: \
315: else if (frame_pointer_needed) \
316: { \
317: fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
318: fprintf (FILE, "\tpushl %%ecx\n"); \
319: fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
320: fprintf (FILE, "\tcall *_mcount_ptr\n"); \
321: fprintf (FILE, "\tpopl %%eax\n"); \
322: } \
323: \
324: else \
325: abort (); \
326: } \
327: } \
328: while (0)
329:
330: /* A C statement or compound statement to output to FILE some
331: assembler code to initialize basic-block profiling for the current
332: object module. This code should call the subroutine
333: `__bb_init_func' once per object module, passing it as its sole
334: argument the address of a block allocated in the object module.
335:
336: The name of the block is a local symbol made with this statement:
337:
338: ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
339:
340: Of course, since you are writing the definition of
341: `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
342: can take a short cut in the definition of this macro and use the
343: name that you know will result.
344:
345: The first word of this block is a flag which will be nonzero if the
346: object module has already been initialized. So test this word
347: first, and do not call `__bb_init_func' if the flag is nonzero. */
348:
349: #undef FUNCTION_BLOCK_PROFILER
350: #define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO) \
351: do \
352: { \
353: if (!flag_pic) \
354: { \
355: fprintf (STREAM, "\tcmpl $0,%sPBX0\n", LPREFIX); \
356: fprintf (STREAM, "\tjne 0f\n"); \
357: fprintf (STREAM, "\tpushl $%sPBX0\n", LPREFIX); \
358: fprintf (STREAM, "\tcall %s__bb_init_func\n", \
359: (TARGET_UNDERSCORES) ? "_" : ""); \
360: fprintf (STREAM, "0:\n"); \
361: } \
362: else \
363: { \
364: fprintf (STREAM, "\tpushl %eax\n"); \
365: fprintf (STREAM, "\tmovl %sPBX0@GOT(%ebx),%eax\n"); \
366: fprintf (STREAM, "\tcmpl $0,(%eax)\n"); \
367: fprintf (STREAM, "\tjne 0f\n"); \
368: fprintf (STREAM, "\tpushl %eax\n"); \
369: fprintf (STREAM, "\tcall %s__bb_init_func@PLT\n", \
370: (TARGET_UNDERSCORES) ? "_" : ""); \
371: fprintf (STREAM, "0:\n"); \
372: fprintf (STREAM, "\tpopl %eax\n"); \
373: } \
374: } \
375: while (0)
376:
377: /* A C statement or compound statement to increment the count
378: associated with the basic block number BLOCKNO. Basic blocks are
379: numbered separately from zero within each compilation. The count
380: associated with block number BLOCKNO is at index BLOCKNO in a
381: vector of words; the name of this array is a local symbol made
382: with this statement:
383:
384: ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
385:
386: Of course, since you are writing the definition of
387: `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
388: can take a short cut in the definition of this macro and use the
389: name that you know will result. */
390:
391: #undef BLOCK_PROFILER
392: #define BLOCK_PROFILER(STREAM, BLOCKNO) \
393: do \
394: { \
395: if (!flag_pic) \
396: fprintf (STREAM, "\tincl %sPBX2+%d\n", LPREFIX, (BLOCKNO)*4); \
397: else \
398: { \
399: fprintf (STREAM, "\tpushl %eax\n"); \
400: fprintf (STREAM, "\tmovl %sPBX2@GOT(%ebx),%eax\n", LPREFIX); \
401: fprintf (STREAM, "\tincl %d(%eax)\n", (BLOCKNO)*4); \
402: fprintf (STREAM, "\tpopl %eax\n"); \
403: } \
404: } \
405: while (0)
406:
407: /* A C function or functions which are needed in the library to
408: support block profiling. When support goes into libc, undo
409: the #if 0. */
410:
411: #if 0
412: #undef BLOCK_PROFILING_CODE
413: #define BLOCK_PROFILING_CODE
414: #endif
415:
416: /* Prefix for internally generated assembler labels. If we aren't using
417: underscores, we are using prefix `.'s to identify labels that should
418: be ignored, as in `i386/gas.h' [email protected] */
419: #undef LPREFIX
420: #define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
421:
422: /* This is how to store into the string BUF
423: the symbol_ref name of an internal numbered label where
424: PREFIX is the class of label and NUM is the number within the class.
425: This is suitable for output with `assemble_name'. */
426:
427: #undef ASM_GENERATE_INTERNAL_LABEL
428: #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
429: sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
430: (PREFIX), (NUMBER))
431:
432: /* This is how to output an internal numbered label where
433: PREFIX is the class of label and NUM is the number within the class. */
434:
435: #undef ASM_OUTPUT_INTERNAL_LABEL
436: #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
437: fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
438: PREFIX, NUM)
439:
440: /* This is how to output a reference to a user-level label named NAME. */
441:
442: #undef ASM_OUTPUT_LABELREF
443: #define ASM_OUTPUT_LABELREF(FILE,NAME) \
444: fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
445:
446: /* This is how to output an element of a case-vector that is relative.
447: This is only used for PIC code. See comments by the `casesi' insn in
448: i386.md for an explanation of the expression this outputs. */
449:
450: #undef ASM_OUTPUT_ADDR_DIFF_ELT
451: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
452: fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
453:
454: /* A C expression to output text to align the location counter in the
455: way that is desirable at a point in the code that is reached only
456: by jumping.
457:
458: This macro need not be defined if you don't want any special
459: alignment to be done at such a time. Most machine descriptions do
460: not currently define the macro. */
461:
462: #undef ASM_OUTPUT_ALIGN_CODE
463: #define ASM_OUTPUT_ALIGN_CODE(STREAM) \
464: fprintf (STREAM, "\t.align\t%d\n", \
465: (TARGET_486 && TARGET_LARGE_ALIGN) ? 4 : 2)
466:
467: /* A C expression to output text to align the location counter in the
468: way that is desirable at the beginning of a loop.
469:
470: This macro need not be defined if you don't want any special
471: alignment to be done at such a time. Most machine descriptions do
472: not currently define the macro. */
473:
474: #undef ASM_OUTPUT_LOOP_ALIGN
475: #define ASM_OUTPUT_LOOP_ALIGN(STREAM) \
476: fprintf (STREAM, "\t.align\t2\n")
477:
478: /* A C statement to output to the stdio stream STREAM an assembler
479: command to advance the location counter to a multiple of 2 to the
480: POWER bytes. POWER will be a C expression of type `int'. */
481:
482: #undef ASM_OUTPUT_ALIGN
483: #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
484: fprintf (STREAM, "\t.align\t%d\n", \
485: (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
486:
487: /* A C expression that is 1 if the RTX X is a constant which is a
488: valid address. On most machines, this can be defined as
489: `CONSTANT_P (X)', but a few machines are more restrictive in
490: which constant addresses are supported.
491:
492: `CONSTANT_P' accepts integer-values expressions whose values are
493: not explicitly known, such as `symbol_ref', `label_ref', and
494: `high' expressions and `const' arithmetic expressions, in
495: addition to `const_int' and `const_double' expressions. */
496:
497: #define CONSTANT_ADDRESS_P_ORIG(X) \
498: (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
499: || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
500: || GET_CODE (X) == HIGH)
501:
502: #undef CONSTANT_ADDRESS_P
503: #define CONSTANT_ADDRESS_P(X) \
504: ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
505:
506: /* Nonzero if the constant value X is a legitimate general operand.
507: It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
508:
509: #undef LEGITIMATE_CONSTANT_P
510: #define LEGITIMATE_CONSTANT_P(X) \
511: (!HALF_PIC_P () \
512: || GET_CODE (X) == CONST_DOUBLE \
513: || GET_CODE (X) == CONST_INT \
514: || !HALF_PIC_ADDRESS_P (X))
515:
516: /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
517: that is a valid memory address for an instruction.
518: The MODE argument is the machine mode for the MEM expression
519: that wants to use this address. */
520:
521: #define GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR) \
522: { \
523: if (CONSTANT_ADDRESS_P (X) \
524: && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
525: goto ADDR; \
526: GO_IF_INDEXING (X, ADDR); \
527: if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
528: { \
529: rtx x0 = XEXP (X, 0); \
530: if (! flag_pic || ! SYMBOLIC_CONST (XEXP (X, 1))) \
531: { GO_IF_INDEXING (x0, ADDR); } \
532: else if (x0 == pic_offset_table_rtx) \
533: goto ADDR; \
534: else if (GET_CODE (x0) == PLUS) \
535: { \
536: if (XEXP (x0, 0) == pic_offset_table_rtx) \
537: { GO_IF_INDEXABLE_BASE (XEXP (x0, 1), ADDR); } \
538: if (XEXP (x0, 1) == pic_offset_table_rtx) \
539: { GO_IF_INDEXABLE_BASE (XEXP (x0, 0), ADDR); } \
540: } \
541: } \
542: }
543:
544: #undef GO_IF_LEGITIMATE_ADDRESS
545: #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
546: { \
547: if (! HALF_PIC_P ()) \
548: { \
549: GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR); \
550: } \
551: else \
552: { \
553: if (CONSTANT_P (X) && ! HALF_PIC_ADDRESS_P (X)) \
554: goto ADDR; \
555: \
556: GO_IF_INDEXING (X, ADDR); \
557: if (GET_CODE (X) == PLUS) \
558: { \
559: rtx x1 = XEXP (X, 1); \
560: \
561: if (CONSTANT_P (x1) && ! HALF_PIC_ADDRESS_P (x1)) \
562: { \
563: rtx x0 = XEXP (X, 0); \
564: GO_IF_INDEXING (x0, ADDR); \
565: } \
566: } \
567: } \
568: }
569:
570: /* Sometimes certain combinations of command options do not make sense
571: on a particular target machine. You can define a macro
572: `OVERRIDE_OPTIONS' to take account of this. This macro, if
573: defined, is executed once just after all the command options have
574: been parsed. */
575:
576: #undef SUBTARGET_OVERRIDE_OPTIONS
577: #define SUBTARGET_OVERRIDE_OPTIONS \
578: { \
579: /* \
580: if (TARGET_ELF && TARGET_HALF_PIC) \
581: { \
582: target_flags &= ~MASK_HALF_PIC; \
583: flag_pic = 1; \
584: } \
585: */ \
586: \
587: if (TARGET_ROSE && flag_pic) \
588: { \
589: target_flags |= MASK_HALF_PIC; \
590: flag_pic = 0; \
591: } \
592: \
593: if (TARGET_HALF_PIC) \
594: half_pic_init (); \
595: }
596:
597: /* Define this macro if references to a symbol must be treated
598: differently depending on something about the variable or
599: function named by the symbol (such as what section it is in).
600:
601: The macro definition, if any, is executed immediately after the
602: rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
603: The value of the rtl will be a `mem' whose address is a
604: `symbol_ref'.
605:
606: The usual thing for this macro to do is to a flag in the
607: `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
608: name string in the `symbol_ref' (if one bit is not enough
609: information).
610:
611: The best way to modify the name string is by adding text to the
612: beginning, with suitable punctuation to prevent any ambiguity.
613: Allocate the new name in `saveable_obstack'. You will have to
614: modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
615: and output the name accordingly.
616:
617: You can also check the information stored in the `symbol_ref' in
618: the definition of `GO_IF_LEGITIMATE_ADDRESS' or
619: `PRINT_OPERAND_ADDRESS'. */
620:
621: #undef ENCODE_SECTION_INFO
622: #define ENCODE_SECTION_INFO(DECL) \
623: do \
624: { \
625: if (HALF_PIC_P ()) \
626: HALF_PIC_ENCODE (DECL); \
627: \
628: else if (flag_pic) \
629: { \
630: rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
631: ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
632: SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
633: = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
634: || ! TREE_PUBLIC (DECL)); \
635: } \
636: } \
637: while (0)
638:
639:
640: /* On most machines, read-only variables, constants, and jump tables
641: are placed in the text section. If this is not the case on your
642: machine, this macro should be defined to be the name of a function
643: (either `data_section' or a function defined in `EXTRA_SECTIONS')
644: that switches to the section to be used for read-only items.
645:
646: If these items should be placed in the text section, this macro
647: should not be defined. */
648:
649: #if 0
650: #undef READONLY_DATA_SECTION
651: #define READONLY_DATA_SECTION() \
652: do \
653: { \
654: if (TARGET_ELF) \
655: { \
656: if (in_section != in_rodata) \
657: { \
658: fprintf (asm_out_file, "\t.section \"rodata\"\n"); \
659: in_section = in_rodata; \
660: } \
661: } \
662: else \
663: text_section (); \
664: } \
665: while (0)
666: #endif
667:
668: /* A list of names for sections other than the standard two, which are
669: `in_text' and `in_data'. You need not define this macro on a
670: system with no other sections (that GCC needs to use). */
671:
672: #undef EXTRA_SECTIONS
673: #define EXTRA_SECTIONS in_rodata, in_data1
674:
675: /* Given a decl node or constant node, choose the section to output it in
676: and select that section. */
677:
678: #undef SELECT_RTX_SECTION
679: #define SELECT_RTX_SECTION(MODE, RTX) \
680: do \
681: { \
682: if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX)) \
683: data_section (); \
684: else \
685: readonly_data_section (); \
686: } \
687: while (0)
688:
689: #undef SELECT_SECTION
690: #define SELECT_SECTION(DECL, RELOC) \
691: { \
692: if (RELOC && HALF_PIC_P ()) \
693: data_section (); \
694: \
695: else if (TREE_CODE (DECL) == STRING_CST) \
696: { \
697: if (flag_writable_strings) \
698: data_section (); \
699: else \
700: readonly_data_section (); \
701: } \
702: \
703: else if (TREE_CODE (DECL) != VAR_DECL) \
704: readonly_data_section (); \
705: \
706: else if (!TREE_READONLY (DECL)) \
707: data_section (); \
708: \
709: else \
710: readonly_data_section (); \
711: }
712:
713:
714: /* Define the strings used for the special svr4 .type and .size directives.
715: These strings generally do not vary from one system running svr4 to
716: another, but if a given system (e.g. m88k running svr) needs to use
717: different pseudo-op names for these, they may be overridden in the
718: file which includes this one. */
719:
720: #define TYPE_ASM_OP ".type"
721: #define SIZE_ASM_OP ".size"
722: #define WEAK_ASM_OP ".weak"
723: #define SET_ASM_OP ".set"
724:
725: /* The following macro defines the format used to output the second
726: operand of the .type assembler directive. Different svr4 assemblers
727: expect various different forms for this operand. The one given here
728: is just a default. You may need to override it in your machine-
729: specific tm.h file (depending upon the particulars of your assembler). */
730:
731: #define TYPE_OPERAND_FMT "@%s"
732:
733: /* A C statement (sans semicolon) to output to the stdio stream
734: STREAM any text necessary for declaring the name NAME of an
735: initialized variable which is being defined. This macro must
736: output the label definition (perhaps using `ASM_OUTPUT_LABEL').
737: The argument DECL is the `VAR_DECL' tree node representing the
738: variable.
739:
740: If this macro is not defined, then the variable name is defined
741: in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
742:
743: #undef ASM_DECLARE_OBJECT_NAME
744: #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
745: do \
746: { \
747: ASM_OUTPUT_LABEL(STREAM,NAME); \
748: HALF_PIC_DECLARE (NAME); \
749: if (TARGET_ELF) \
750: { \
751: fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
752: assemble_name (STREAM, NAME); \
753: putc (',', STREAM); \
754: fprintf (STREAM, TYPE_OPERAND_FMT, "object"); \
755: putc ('\n', STREAM); \
756: size_directive_output = 0; \
757: if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
758: { \
759: size_directive_output = 1; \
760: fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \
761: assemble_name (STREAM, NAME); \
762: fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
763: } \
764: } \
765: } \
766: while (0)
767:
768: /* Output the size directive for a decl in rest_of_decl_compilation
769: in the case where we did not do so before the initializer.
770: Once we find the error_mark_node, we know that the value of
771: size_directive_output was set
772: by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */
773:
774: #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \
775: do { \
776: char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \
777: if (TARGET_ELF \
778: && !flag_inhibit_size_directive && DECL_SIZE (DECL) \
779: && ! AT_END && TOP_LEVEL \
780: && DECL_INITIAL (DECL) == error_mark_node \
781: && !size_directive_output) \
782: { \
783: fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
784: assemble_name (FILE, name); \
785: fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
786: } \
787: } while (0)
788:
789: /* This is how to declare a function name. */
790:
791: #undef ASM_DECLARE_FUNCTION_NAME
792: #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
793: do \
794: { \
795: ASM_OUTPUT_LABEL(STREAM,NAME); \
796: HALF_PIC_DECLARE (NAME); \
797: if (TARGET_ELF) \
798: { \
799: fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
800: assemble_name (STREAM, NAME); \
801: putc (',', STREAM); \
802: fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
803: putc ('\n', STREAM); \
804: ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
805: } \
806: } \
807: while (0)
808:
809: /* Write the extra assembler code needed to declare a function's result.
810: Most svr4 assemblers don't require any special declaration of the
811: result value, but there are exceptions. */
812:
813: #ifndef ASM_DECLARE_RESULT
814: #define ASM_DECLARE_RESULT(FILE, RESULT)
815: #endif
816:
817: /* This is how to declare the size of a function. */
818:
819: #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
820: do \
821: { \
822: if (TARGET_ELF && !flag_inhibit_size_directive) \
823: { \
824: char label[256]; \
825: static int labelno; \
826: labelno++; \
827: ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
828: ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
829: fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
830: assemble_name (FILE, (FNAME)); \
831: fprintf (FILE, ","); \
832: assemble_name (FILE, label); \
833: fprintf (FILE, "-"); \
834: assemble_name (FILE, (FNAME)); \
835: putc ('\n', FILE); \
836: } \
837: } \
838: while (0)
839:
840: /* Attach a special .ident directive to the end of the file to identify
841: the version of GCC which compiled this code. The format of the
842: .ident string is patterned after the ones produced by native svr4
843: C compilers. */
844:
845: #define IDENT_ASM_OP ".ident"
846:
847: /* Allow #sccs in preprocessor. */
848:
849: #define SCCS_DIRECTIVE
850:
851: /* This says what to print at the end of the assembly file */
852: #define ASM_FILE_END(STREAM) \
853: do \
854: { \
855: if (HALF_PIC_P ()) \
856: HALF_PIC_FINISH (STREAM); \
857: \
858: if (TARGET_IDENT) \
859: { \
860: char *fstart = main_input_filename; \
861: char *fname; \
862: \
863: if (!fstart) \
864: fstart = "<no file>"; \
865: \
866: fname = fstart + strlen (fstart) - 1; \
867: while (fname > fstart && *fname != '/') \
868: fname--; \
869: \
870: if (*fname == '/') \
871: fname++; \
872: \
873: fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d", \
874: IDENT_ASM_OP, version_string, fname, optimize); \
875: \
876: if (write_symbols == PREFERRED_DEBUGGING_TYPE) \
877: fprintf ((STREAM), " -g%d", (int)debug_info_level); \
878: \
879: else if (write_symbols == DBX_DEBUG) \
880: fprintf ((STREAM), " -gstabs%d", (int)debug_info_level); \
881: \
882: else if (write_symbols == DWARF_DEBUG) \
883: fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level); \
884: \
885: else if (write_symbols != NO_DEBUG) \
886: fprintf ((STREAM), " -g??%d", (int)debug_info_level); \
887: \
888: if (flag_omit_frame_pointer) \
889: fprintf ((STREAM), " -fomit-frame-pointer"); \
890: \
891: if (flag_strength_reduce) \
892: fprintf ((STREAM), " -fstrength-reduce"); \
893: \
894: if (flag_unroll_loops) \
895: fprintf ((STREAM), " -funroll-loops"); \
896: \
897: if (flag_force_mem) \
898: fprintf ((STREAM), " -fforce-mem"); \
899: \
900: if (flag_force_addr) \
901: fprintf ((STREAM), " -fforce-addr"); \
902: \
903: if (flag_inline_functions) \
904: fprintf ((STREAM), " -finline-functions"); \
905: \
906: if (flag_caller_saves) \
907: fprintf ((STREAM), " -fcaller-saves"); \
908: \
909: if (flag_pic) \
910: fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic"); \
911: \
912: if (flag_inhibit_size_directive) \
913: fprintf ((STREAM), " -finhibit-size-directive"); \
914: \
915: if (flag_gnu_linker) \
916: fprintf ((STREAM), " -fgnu-linker"); \
917: \
918: if (profile_flag) \
919: fprintf ((STREAM), " -p"); \
920: \
921: if (profile_block_flag) \
922: fprintf ((STREAM), " -a"); \
923: \
924: if (TARGET_IEEE_FP) \
925: fprintf ((STREAM), " -mieee-fp"); \
926: \
927: if (TARGET_HALF_PIC) \
928: fprintf ((STREAM), " -mhalf-pic"); \
929: \
930: fprintf ((STREAM), (TARGET_486) ? " -m486" : " -m386"); \
931: fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
932: } \
933: } \
934: while (0)
935:
936: /* Tell collect that the object format is OSF/rose. */
937: #define OBJECT_FORMAT_ROSE
938:
939: /* Tell collect where the appropriate binaries are. */
940: #define REAL_LD_FILE_NAME "/usr/ccs/gcc/gld"
941: #define REAL_NM_FILE_NAME "/usr/ccs/bin/nm"
942: #define REAL_STRIP_FILE_NAME "/usr/ccs/bin/strip"
943:
944: /* Use atexit for static constructors/destructors, instead of defining
945: our own exit function. */
946: #define HAVE_ATEXIT
947:
948: /* Define this macro meaning that gcc should find the library 'libgcc.a'
949: by hand, rather than passing the argument '-lgcc' to tell the linker
950: to do the search */
951: #define LINK_LIBGCC_SPECIAL
952:
953: /* A C statement to output assembler commands which will identify the object
954: file as having been compile with GNU CC. We don't need or want this for
955: OSF1. GDB doesn't need it and kdb doesn't like it */
956: #define ASM_IDENTIFY_GCC(FILE)
957:
958: /* Identify the front-end which produced this file. To keep symbol
959: space down, and not confuse kdb, only do this if the language is
960: not C. */
961:
962: #define ASM_IDENTIFY_LANGUAGE(STREAM) \
963: { \
964: if (strcmp (lang_identify (), "c") != 0) \
965: output_lang_identify (STREAM); \
966: }
967:
968: /* This is how to output an assembler line defining a `double' constant.
969: Use "word" pseudos to avoid printing NaNs, infinity, etc. */
970:
971: /* This is how to output an assembler line defining a `double' constant. */
972: #undef ASM_OUTPUT_DOUBLE
973: #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
974: do \
975: { \
976: long value_long[2]; \
977: char dstr[30]; \
978: REAL_VALUE_TO_TARGET_DOUBLE (VALUE, value_long); \
979: REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
980: if (sizeof (int) == sizeof (long)) \
981: fprintf (STREAM, "\t.long\t0x%08x\t\t# %s\n\t.long\t0x%08x\n", \
982: value_long[0], dstr, value_long[1]); \
983: else \
984: fprintf (STREAM, "\t.long\t0x%08lx\t\t# %s\n\t.long\t0x%08lx\n", \
985: value_long[0], dstr, value_long[1]); \
986: } \
987: while (0)
988:
989: /* This is how to output an assembler line defining a `float' constant. */
990: #undef ASM_OUTPUT_FLOAT
991: #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
992: do \
993: { \
994: long value_long; \
995: char dstr[30]; \
996: REAL_VALUE_TO_TARGET_SINGLE (VALUE, value_long); \
997: REAL_VALUE_TO_DECIMAL (VALUE, "%.12g", dstr); \
998: if (sizeof (int) == sizeof (long)) \
999: fprintf (STREAM, "\t.long\t0x%08x\t\t# %s (float)\n", \
1000: value_long, dstr); \
1001: else \
1002: fprintf (STREAM, "\t.long\t0x%08lx\t\t# %s (float)\n", \
1003: value_long, dstr); \
1004: } \
1005: while (0)
1006:
1007: /* This is how to output an assembler line for a `long double' constant. */
1008: #undef ASM_OUTPUT_LONG_DOUBLE
1009: #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
1010: do { long l[3]; \
1011: char dstr[30]; \
1012: REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
1013: REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
1014: if (sizeof (int) == sizeof (long)) \
1015: fprintf (FILE, \
1016: "\t.long\t0x%08x\t\t# %s\n\t.long\t0x%08x\n\t.long\t0x%08x\n", \
1017: l[0], dstr, l[1], l[2]); \
1018: else \
1019: fprintf (FILE, \
1020: "\t.long\t0x%08lx\t\t# %s\n\t.long\t0x%08lx\n\t.long\t0x%08lx\n", \
1021: l[0], dstr, l[1], l[2]); \
1022: } while (0)
1023:
1024: /* Generate calls to memcpy, etc., not bcopy, etc. */
1025: #define TARGET_MEM_FUNCTIONS
1026:
1027: /* Don't default to pcc-struct-return, because gcc is the only compiler, and
1028: we want to retain compatibility with older gcc versions. */
1029: #define DEFAULT_PCC_STRUCT_RETURN 0
1030:
1031: /* Map i386 registers to the numbers dwarf expects. Of course this is different
1032: from what stabs expects. */
1033:
1034: #define DWARF_DBX_REGISTER_NUMBER(n) \
1035: ((n) == 0 ? 0 \
1036: : (n) == 1 ? 2 \
1037: : (n) == 2 ? 1 \
1038: : (n) == 3 ? 3 \
1039: : (n) == 4 ? 6 \
1040: : (n) == 5 ? 7 \
1041: : (n) == 6 ? 5 \
1042: : (n) == 7 ? 4 \
1043: : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
1044: : (-1))
1045:
1046: /* Now what stabs expects in the register. */
1047: #define STABS_DBX_REGISTER_NUMBER(n) \
1048: ((n) == 0 ? 0 : \
1049: (n) == 1 ? 2 : \
1050: (n) == 2 ? 1 : \
1051: (n) == 3 ? 3 : \
1052: (n) == 4 ? 6 : \
1053: (n) == 5 ? 7 : \
1054: (n) == 6 ? 4 : \
1055: (n) == 7 ? 5 : \
1056: (n) + 4)
1057:
1058: #undef DBX_REGISTER_NUMBER
1059: #define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
1060: ? DWARF_DBX_REGISTER_NUMBER(n) \
1061: : STABS_DBX_REGISTER_NUMBER(n))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.