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