import of gcc-2.8
[official-gcc.git] / gcc / config / clipper / clix.h
blobc36e4de46a02b38888f910f7044284fbcc66c8f8
1 /* Definitions of target machine for GNU compiler. Clipper/Clix version.
2 Copyright (C) 1988, 1993, 1996, 1997 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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* Names to predefine in the preprocessor for this target machine. */
23 #define CPP_PREDEFINES "-Dclipper -Dunix -Asystem(unix) -Asystem(svr3) -Acpu(clipper) -Amachine(clipper)"
25 #undef STARTFILE_SPEC
26 #define STARTFILE_SPEC \
27 "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
29 #undef ENDFILE_SPEC
30 #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
32 #undef LIB_SPEC
34 #define TARGET_MEM_FUNCTIONS
36 #undef HAVE_ATEXIT
37 #define HAVE_ATEXIT
39 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
40 do { \
41 unsigned char *s; \
42 int i; \
43 for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++) \
44 { \
45 if ((i % 8) == 0) \
46 fputs ("\n\t.byte\t", (FILE)); \
47 fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
48 } \
49 fputs ("\n", (FILE)); \
50 } while (0)
52 #undef ASM_OUTPUT_DOUBLE
53 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
54 { \
55 union { int i[2]; double d; } _d_; \
56 _d_.d = VALUE; \
57 fprintf (FILE, "\t.long 0x%08x,0x%08x\n", _d_.i[0],_d_.i[1]); \
60 #undef ASM_OUTPUT_FLOAT
61 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
62 { \
63 union { int i; float f; } _f_; \
64 _f_.f = VALUE; \
65 fprintf (FILE, "\t.long 0x%08x\n", _f_.i); \
68 /* This is how to output an assembler line
69 that says to advance the location counter
70 to a multiple of 2**LOG bytes. */
72 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
73 fprintf(FILE, "\t.align %d\n", 1 << (LOG))
76 #define ASM_LONG ".long"
77 #define BSS_SECTION_ASM_OP ".bss"
78 #undef INIT_SECTION_ASM_OP
79 #define INIT_SECTION_ASM_OP ".section .init,\"x\""
82 /* Define a few machine-specific details of the implementation of
83 constructors.
85 The __CTORS_LIST__ goes in the .init section. Define CTOR_LIST_BEGIN
86 and CTOR_LIST_END to contribute to the .init section an instruction to
87 push a word containing 0 (or some equivalent of that).
89 ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
90 constructor. */
92 #define CTOR_LIST_BEGIN \
93 asm (INIT_SECTION_ASM_OP); \
94 asm ("subq $8,sp"); \
95 asm ("loadq $0,r0"); \
96 asm ("storw r0,(sp)")
98 /* don't need end marker */
100 #undef CTOR_LIST_END
102 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
103 do { \
104 init_section (); \
105 fputs ("\tloada ", FILE); \
106 assemble_name (FILE, NAME); \
107 fputs (",r0\n\tsubq $8,sp\n\tstorw r0,(sp)\n", FILE); \
108 } while (0)
111 /* fini psect is 8 aligned */
113 #define DTOR_LIST_BEGIN \
114 asm (DTORS_SECTION_ASM_OP); \
115 func_ptr __DTOR_LIST__[2] = { (func_ptr) (-1), 0 };
117 /* A C statement (sans semicolon) to output an element in the table of
118 global destructors. */
120 #undef ASM_OUTPUT_DESTRUCTOR
121 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
122 do { \
123 fini_section (); \
124 fprintf (FILE, "%s\t ", ASM_LONG); \
125 assemble_name (FILE, NAME); \
126 fprintf (FILE, ",0\n"); \
127 } while (0)
130 /* On clix crt1.o first calls init code and then sets environ and a valid
131 chrclass. Unfortunately stdio routines bomb with unset chrclass.
132 Therefore we set chrclass prior to calling global constructors. */
134 #undef DO_GLOBAL_CTORS_BODY
135 #define DO_GLOBAL_CTORS_BODY \
136 do { \
137 func_ptr *p, *beg = alloca (0); \
138 _setchrclass (0); \
139 for (p = beg; *p; p+=2) \
141 while (p != beg) \
142 { p-= 2; (*p) (); } \
143 } while (0)
146 #undef DO_GLOBAL_DTORS_BODY
147 #define DO_GLOBAL_DTORS_BODY \
148 func_ptr *f = &__DTOR_LIST__[2]; /* 0,1 contains -1,0 */ \
149 int n = 0; \
150 while (*f) \
152 f+= 2; /* skip over alignment 0 */ \
153 n++; \
155 f -= 2; \
156 while (--n >= 0) \
158 (*f) (); \
159 f-= 2; /* skip over alignment 0 */ \