OSDN Git Service

* expr.c (move_block_from_reg): Try using an integral mov operation first.
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / freebsd.h
1 /* Definitions of target machine for GNU compiler for Intel 80386
2    running FreeBSD.
3    Copyright (C) 1988, 1992, 1994, 1996 Free Software Foundation, Inc.
4    Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 /* This goes away when the math-emulator is fixed */
24 #define TARGET_CPU_DEFAULT 0400         /* TARGET_NO_FANCY_MATH_387 */
25
26 /* This is tested by i386gas.h.  */
27 #define YES_UNDERSCORES
28
29 /* Don't assume anything about the header files. */
30 #define NO_IMPLICIT_EXTERN_C
31
32 #include "i386/gstabs.h"
33
34 /* Get perform_* macros to build libgcc.a.  */
35 #include "i386/perform.h"
36
37 #undef CPP_PREDEFINES
38 #define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
39
40 /* Like the default, except no -lg.  */
41 #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
42
43 #undef SIZE_TYPE
44 #define SIZE_TYPE "unsigned int"
45
46 #undef PTRDIFF_TYPE
47 #define PTRDIFF_TYPE "int"
48
49 #undef WCHAR_TYPE
50 #define WCHAR_TYPE "short unsigned int"
51
52 #define WCHAR_UNSIGNED 1
53
54 #undef WCHAR_TYPE_SIZE
55 #define WCHAR_TYPE_SIZE 16
56
57 #define HAVE_ATEXIT
58
59 #undef ASM_APP_ON
60 #define ASM_APP_ON "#APP\n"
61
62 #undef ASM_APP_OFF
63 #define ASM_APP_OFF "#NO_APP\n"
64 \f
65 /* The following macros are stolen from i386v4.h */
66 /* These have to be defined to get PIC code correct */
67
68 /* This is how to output an element of a case-vector that is relative.
69    This is only used for PIC code.  See comments by the `casesi' insn in
70    i386.md for an explanation of the expression this outputs. */
71
72 #undef ASM_OUTPUT_ADDR_DIFF_ELT
73 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
74   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
75
76 /* Indicate that jump tables go in the text section.  This is
77    necessary when compiling PIC code.  */
78
79 #define JUMP_TABLES_IN_TEXT_SECTION
80
81 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
82    we want to retain compatibility with older gcc versions.  */
83 #define DEFAULT_PCC_STRUCT_RETURN 0
84 \f
85 /* Profiling routines, partially copied from i386/osfrose.h.  */
86
87 /* Redefine this to use %eax instead of %edx.  */
88 #undef FUNCTION_PROFILER
89 #define FUNCTION_PROFILER(FILE, LABELNO)  \
90 {                                                                       \
91   if (flag_pic)                                                         \
92     {                                                                   \
93       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n",              \
94                LPREFIX, (LABELNO));                                     \
95       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                    \
96     }                                                                   \
97   else                                                                  \
98     {                                                                   \
99       fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO));      \
100       fprintf (FILE, "\tcall mcount\n");                                \
101     }                                                                   \
102 }
103
104 /*
105  * Some imports from svr4.h in support of shared libraries.
106  * Currently, we need the DECLARE_OBJECT_SIZE stuff.
107  */
108
109 /* Define the strings used for the special svr4 .type and .size directives.
110    These strings generally do not vary from one system running svr4 to
111    another, but if a given system (e.g. m88k running svr) needs to use
112    different pseudo-op names for these, they may be overridden in the
113    file which includes this one.  */
114
115 #define TYPE_ASM_OP     ".type"
116 #define SIZE_ASM_OP     ".size"
117
118 /* The following macro defines the format used to output the second
119    operand of the .type assembler directive.  Different svr4 assemblers
120    expect various different forms for this operand.  The one given here
121    is just a default.  You may need to override it in your machine-
122    specific tm.h file (depending upon the particulars of your assembler).  */
123
124 #define TYPE_OPERAND_FMT        "@%s"
125
126 /* Write the extra assembler code needed to declare a function's result.
127    Most svr4 assemblers don't require any special declaration of the
128    result value, but there are exceptions.  */
129
130 #ifndef ASM_DECLARE_RESULT
131 #define ASM_DECLARE_RESULT(FILE, RESULT)
132 #endif
133
134 /* These macros generate the special .type and .size directives which
135    are used to set the corresponding fields of the linker symbol table
136    entries in an ELF object file under SVR4.  These macros also output
137    the starting labels for the relevant functions/objects.  */
138
139 /* Write the extra assembler code needed to declare a function properly.
140    Some svr4 assemblers need to also have something extra said about the
141    function's return value.  We allow for that here.  */
142
143 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)                     \
144   do {                                                                  \
145     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
146     assemble_name (FILE, NAME);                                         \
147     putc (',', FILE);                                                   \
148     fprintf (FILE, TYPE_OPERAND_FMT, "function");                       \
149     putc ('\n', FILE);                                                  \
150     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));                      \
151     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
152   } while (0)
153
154 /* Write the extra assembler code needed to declare an object properly.  */
155
156 #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)                       \
157   do {                                                                  \
158     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                             \
159     assemble_name (FILE, NAME);                                         \
160     putc (',', FILE);                                                   \
161     fprintf (FILE, TYPE_OPERAND_FMT, "object");                         \
162     putc ('\n', FILE);                                                  \
163     size_directive_output = 0;                                          \
164     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))               \
165       {                                                                 \
166         size_directive_output = 1;                                      \
167         fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
168         assemble_name (FILE, NAME);                                     \
169         fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL))); \
170       }                                                                 \
171     ASM_OUTPUT_LABEL(FILE, NAME);                                       \
172   } while (0)
173
174 /* Output the size directive for a decl in rest_of_decl_compilation
175    in the case where we did not do so before the initializer.
176    Once we find the error_mark_node, we know that the value of
177    size_directive_output was set
178    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
179
180 #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
181 do {                                                                    \
182      char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                  \
183      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)               \
184          && ! AT_END && TOP_LEVEL                                       \
185          && DECL_INITIAL (DECL) == error_mark_node                      \
186          && !size_directive_output)                                     \
187        {                                                                \
188          fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                        \
189          assemble_name (FILE, name);                                    \
190          fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL)));\
191         }                                                               \
192    } while (0)
193
194
195 /* This is how to declare the size of a function.  */
196
197 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)                    \
198   do {                                                                  \
199     if (!flag_inhibit_size_directive)                                   \
200       {                                                                 \
201         char label[256];                                                \
202         static int labelno;                                             \
203         labelno++;                                                      \
204         ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);            \
205         ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);               \
206         fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                         \
207         assemble_name (FILE, (FNAME));                                  \
208         fprintf (FILE, ",");                                            \
209         assemble_name (FILE, label);                                    \
210         fprintf (FILE, "-");                                            \
211         assemble_name (FILE, (FNAME));                                  \
212         putc ('\n', FILE);                                              \
213       }                                                                 \
214   } while (0)
215
216 #define ASM_SPEC   " %| %{fpic:-k} %{fPIC:-k}"
217 #define LINK_SPEC \
218   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
219
220 /* This is defined when gcc is compiled in the BSD-directory-tree, and must
221  * make up for the gap to all the stuff done in the GNU-makefiles.
222  */
223
224 #ifdef FREEBSD_NATIVE
225
226 #define INCLUDE_DEFAULTS { \
227         { "/usr/include", 0 }, \
228         { "/usr/include/g++", 1 }, \
229         { 0, 0} \
230         }
231
232 #undef MD_EXEC_PREFIX
233 #define MD_EXEC_PREFIX "/usr/libexec/"
234
235 #undef STANDARD_STARTFILE_PREFIX
236 #define STANDARD_STARTFILE_PREFIX "/usr/lib"
237
238 #if 0 /* This is very wrong!!! */
239 #define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0"
240 #define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
241 #define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include"
242 #define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
243 #endif
244
245 #endif /* FREEBSD_NATIVE */