OSDN Git Service

GNU CC -> GCC
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / darwin.h
1 /* Target definitions for x86 running Darwin.
2    Copyright (C) 2001, 2002 Free Software Foundation, Inc.
3    Contributed by Apple Computer Inc.
4
5 This file is part of GCC.
6
7 GCC 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 GCC 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 GCC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Enable Mach-O bits in generic x86 code.  */
23 #undef TARGET_MACHO
24 #define TARGET_MACHO 1
25
26 #define TARGET_VERSION fprintf (stderr, " (i386 Darwin)");
27
28 #define TARGET_OS_CPP_BUILTINS()                \
29   do                                            \
30     {                                           \
31       builtin_define ("__i386__");              \
32       builtin_define ("__LITTLE_ENDIAN__");     \
33       builtin_define ("__MACH__");              \
34       builtin_define ("__APPLE__");             \
35     }                                           \
36   while (0)
37
38 /* We want -fPIC by default, unless we're using -static to compile for
39    the kernel or some such.  */
40
41 #undef CC1_SPEC
42 #define CC1_SPEC "%{!static:-fPIC}"
43
44 #define ASM_SPEC "-arch i386 \
45   %{Zforce_cpusubtype_ALL:-force_cpusubtype_ALL} \
46   %{!Zforce_cpusubtype_ALL:%{mmmx:-force_cpusubtype_ALL}\
47                            %{msse:-force_cpusubtype_ALL}\
48                            %{msse2:-force_cpusubtype_ALL}}"
49
50 #undef SUBTARGET_EXTRA_SPECS
51 #define SUBTARGET_EXTRA_SPECS                   \
52   { "darwin_arch", "i386" },
53
54 /* The Darwin assembler mostly follows AT&T syntax.  */
55 #undef ASSEMBLER_DIALECT
56 #define ASSEMBLER_DIALECT ASM_ATT
57
58 /* Define macro used to output shift-double opcodes when the shift
59    count is in %cl.  Some assemblers require %cl as an argument;
60    some don't.  This macro controls what to do: by default, don't
61    print %cl.  */
62
63 #define SHIFT_DOUBLE_OMITS_COUNT 0
64
65 /* Define the syntax of pseudo-ops, labels and comments.  */
66
67 /* String containing the assembler's comment-starter.  */
68
69 #define ASM_COMMENT_START "#"
70
71 /* By default, target has a 80387, uses IEEE compatible arithmetic,
72    and returns float values in the 387.  */
73
74 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
75
76 /* TARGET_DEEP_BRANCH_PREDICTION is incompatible with Mach-O PIC.  */
77
78 #undef TARGET_DEEP_BRANCH_PREDICTION
79 #define TARGET_DEEP_BRANCH_PREDICTION   0
80
81 /* For now, disable dynamic-no-pic.  We'll need to go through i386.c
82    with a fine-tooth comb looking for refs to flag_pic!  */
83 #define MASK_MACHO_DYNAMIC_NO_PIC 0
84 #define TARGET_DYNAMIC_NO_PIC     (target_flags & MASK_MACHO_DYNAMIC_NO_PIC)
85
86 /* Define the syntax of pseudo-ops, labels and comments.  */
87
88 #define LPREFIX "L"
89
90 /* Assembler pseudos to introduce constants of various size.  */
91
92 #define ASM_BYTE_OP "\t.byte\t"
93 #define ASM_SHORT "\t.word\t"
94 #define ASM_LONG "\t.long\t"
95 /* Darwin as doesn't do ".quad".  */
96
97 #undef ASM_OUTPUT_ALIGN
98 #define ASM_OUTPUT_ALIGN(FILE,LOG)      \
99  do { if ((LOG) != 0)                   \
100         {                               \
101           if (in_text_section ())       \
102             fprintf (FILE, "\t%s %d,0x90\n", ALIGN_ASM_OP, (LOG)); \
103           else                          \
104             fprintf (FILE, "\t%s %d\n", ALIGN_ASM_OP, (LOG)); \
105         }                               \
106     } while (0)
107
108 /* This says how to output an assembler line
109    to define a global common symbol.  */
110
111 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)  \
112 ( fputs (".comm ", (FILE)),                     \
113   assemble_name ((FILE), (NAME)),               \
114   fprintf ((FILE), ",%lu\n", (unsigned long)(ROUNDED)))
115
116 /* This says how to output an assembler line
117    to define a local common symbol.  */
118
119 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
120 ( fputs (".lcomm ", (FILE)),                    \
121   assemble_name ((FILE), (NAME)),               \
122   fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (ROUNDED)))
123
124 /* Darwin profiling -- call mcount.  */
125 #undef FUNCTION_PROFILER
126 #define FUNCTION_PROFILER(FILE, LABELNO)                                \
127     do {                                                                \
128       if (MACHOPIC_INDIRECT)                                            \
129         {                                                               \
130           const char *name = machopic_stub_name ("*mcount");            \
131           fprintf (FILE, "\tcall %s\n", name+1);  /*  skip '&'  */      \
132           machopic_validate_stub_or_non_lazy_ptr (name, /*stub:*/1);    \
133         }                                                               \
134       else fprintf (FILE, "\tcall mcount\n");                           \
135     } while (0)