OSDN Git Service

PR middle-end/51516
[pf3gnuchains/gcc-fork.git] / gcc / config / rs6000 / vxworks.h
1 /* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
2    Copyright (C) 1996, 2000, 2002, 2003, 2004, 2005, 2007, 2009, 2010, 2011
3    Free Software Foundation, Inc.
4    Contributed by CodeSourcery, LLC.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 /* Note to future editors: VxWorks is mostly an EABI target.  We do
23    not use rs6000/eabi.h because we would have to override most of
24    it anyway.  However, if you change that file, consider making
25    analogous changes here too.  */
26
27 /* CPP predefined macros.  */
28
29 #undef TARGET_OS_CPP_BUILTINS
30 #define TARGET_OS_CPP_BUILTINS()                \
31   do                                            \
32     {                                           \
33       builtin_define ("__ppc");                 \
34       builtin_define ("__PPC__");               \
35       builtin_define ("__EABI__");              \
36       builtin_define ("__ELF__");               \
37       if (!TARGET_SOFT_FLOAT)                   \
38         builtin_define ("__hardfp");            \
39                                                 \
40       /* C89 namespace violation! */            \
41       builtin_define ("CPU_FAMILY=PPC");        \
42                                                 \
43       VXWORKS_OS_CPP_BUILTINS ();               \
44     }           \
45   while (0)
46
47 /* Only big endian PPC is supported by VxWorks.  */
48 #undef BYTES_BIG_ENDIAN
49 #define BYTES_BIG_ENDIAN 1
50 #undef WORDS_BIG_ENDIAN
51 #define WORDS_BIG_ENDIAN 1
52
53 /* We have to kill off the entire specs set created by rs6000/sysv4.h
54    and substitute our own set.  The top level vxworks.h has done some
55    of this for us.  */
56
57 #undef SUBTARGET_EXTRA_SPECS
58 #undef CPP_SPEC
59 #undef CC1_SPEC
60 #undef ASM_SPEC
61
62 #define SUBTARGET_EXTRA_SPECS /* none needed */
63
64 /* FIXME: The only reason we allow no -mcpu switch at all is because
65    config-ml.in insists on a "." multilib. */
66 #define CPP_SPEC \
67 "%{!DCPU=*:               \
68    %{mcpu=403 : -DCPU=PPC403  ; \
69      mcpu=405 : -DCPU=PPC405  ; \
70      mcpu=440 : -DCPU=PPC440  ; \
71      mcpu=464 : -DCPU=PPC464  ; \
72      mcpu=476 : -DCPU=PPC476  ; \
73      mcpu=603 : -DCPU=PPC603  ; \
74      mcpu=604 : -DCPU=PPC604  ; \
75      mcpu=860 : -DCPU=PPC860  ; \
76      mcpu=8540: -DCPU=PPC85XX ; \
77               : -DCPU=PPC604  }}" \
78 VXWORKS_ADDITIONAL_CPP_SPEC
79
80 #define CC1_SPEC                                                \
81 "%{G*} %{mno-sdata:-msdata=none} %{msdata:-msdata=default}      \
82  %{mlittle|mlittle-endian:-mstrict-align}"
83
84 #define ASM_SPEC \
85 "%(asm_cpu) \
86  %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
87  %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} -mbig"
88
89 #undef  LIB_SPEC
90 #define LIB_SPEC VXWORKS_LIB_SPEC
91 #undef  LINK_SPEC
92 #define LINK_SPEC VXWORKS_LINK_SPEC
93 #undef  STARTFILE_SPEC
94 #define STARTFILE_SPEC VXWORKS_STARTFILE_SPEC
95 #undef  ENDFILE_SPEC
96 #define ENDFILE_SPEC VXWORKS_ENDFILE_SPEC
97
98 /* There is no default multilib.  */
99 #undef MULTILIB_DEFAULTS
100
101 #undef TARGET_DEFAULT
102 #define TARGET_DEFAULT \
103   (MASK_POWERPC | MASK_NEW_MNEMONICS | MASK_EABI | MASK_STRICT_ALIGN)
104
105 #undef PROCESSOR_DEFAULT
106 #define PROCESSOR_DEFAULT PROCESSOR_PPC604
107
108 /* Nor sdata, for kernel mode.  We use this in
109    SUBSUBTARGET_INITIALIZE_OPTIONS, after rs6000_rtp has been initialized.  */
110 #undef SDATA_DEFAULT_SIZE
111 #define SDATA_DEFAULT_SIZE (TARGET_VXWORKS_RTP ? 8 : 0)
112
113 /* Enforce 16bytes alignment for the stack pointer, to permit general
114    compliance with e.g. Altivec instructions requirements.  Make sure
115    this isn't overruled by the EABI constraints.  */
116
117 #undef  STACK_BOUNDARY
118 #define STACK_BOUNDARY (16*BITS_PER_UNIT)
119
120 #undef  PREFERRED_STACK_BOUNDARY
121 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
122
123 #undef  ABI_STACK_BOUNDARY
124
125 /* Make -mcpu=8540 imply SPE.  ISEL is automatically enabled, the
126    others must be done by hand.  Handle -mrtp.  Disable -fPIC
127    for -mrtp - the VxWorks PIC model is not compatible with it.  */
128 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
129 #define SUBSUBTARGET_OVERRIDE_OPTIONS           \
130   do {                                          \
131     if (TARGET_E500)                            \
132       {                                         \
133         rs6000_spe = 1;                         \
134         rs6000_spe_abi = 1;                     \
135         rs6000_float_gprs = 1;                  \
136       }                                         \
137                                                 \
138   if (!global_options_set.x_g_switch_value)     \
139     g_switch_value = SDATA_DEFAULT_SIZE;        \
140   VXWORKS_OVERRIDE_OPTIONS;                     \
141   } while (0)
142
143 /* No _mcount profiling on VxWorks.  */
144 #undef FUNCTION_PROFILER
145 #define FUNCTION_PROFILER(FILE,LABELNO) VXWORKS_FUNCTION_PROFILER(FILE,LABELNO)