]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/rs6000/rs6000-c.c
Use ISO C90 prototypes.
[thirdparty/gcc.git] / gcc / config / rs6000 / rs6000-c.c
CommitLineData
a5c76ee6 1/* Subroutines for the C front end on the POWER and PowerPC architectures.
5de601cf 2 Copyright (C) 2002, 2003
a5c76ee6
ZW
3 Free Software Foundation, Inc.
4
5 Contributed by Zack Weinberg <zack@codesourcery.com>
6
5de601cf 7 This file is part of GCC.
a5c76ee6 8
5de601cf
NC
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 2, or (at your
12 option) any later version.
a5c76ee6 13
5de601cf
NC
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
a5c76ee6 18
5de601cf
NC
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to the
21 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
22 MA 02111-1307, USA. */
a5c76ee6
ZW
23
24#include "config.h"
25#include "system.h"
4977bab6
ZW
26#include "coretypes.h"
27#include "tm.h"
a5c76ee6
ZW
28#include "cpplib.h"
29#include "tree.h"
81a75f0f 30#include "c-pragma.h"
a5c76ee6
ZW
31#include "errors.h"
32#include "tm_p.h"
33
34/* Handle the machine specific pragma longcall. Its syntax is
35
36 # pragma longcall ( TOGGLE )
37
38 where TOGGLE is either 0 or 1.
39
40 rs6000_default_long_calls is set to the value of TOGGLE, changing
41 whether or not new function declarations receive a longcall
42 attribute by default. */
43
5de601cf 44#define SYNTAX_ERROR(msgid) do { \
a5c76ee6
ZW
45 warning (msgid); \
46 warning ("ignoring malformed #pragma longcall"); \
47 return; \
48} while (0)
49
50void
a2369ed3 51rs6000_pragma_longcall (cpp_reader *pfile ATTRIBUTE_UNUSED)
a5c76ee6
ZW
52{
53 tree x, n;
54
55 /* If we get here, generic code has already scanned the directive
56 leader and the word "longcall". */
57
58 if (c_lex (&x) != CPP_OPEN_PAREN)
59 SYNTAX_ERROR ("missing open paren");
60 if (c_lex (&n) != CPP_NUMBER)
61 SYNTAX_ERROR ("missing number");
62 if (c_lex (&x) != CPP_CLOSE_PAREN)
63 SYNTAX_ERROR ("missing close paren");
64
65 if (n != integer_zero_node && n != integer_one_node)
66 SYNTAX_ERROR ("number must be 0 or 1");
67
68 if (c_lex (&x) != CPP_EOF)
69 warning ("junk at end of #pragma longcall");
70
71 rs6000_default_long_calls = (n == integer_one_node);
72}
4c4eb375
GK
73
74/* Handle defining many CPP flags based on TARGET_xxx. As a general
75 policy, rather than trying to guess what flags a user might want a
76 #define for, it's better to define a flag for everything. */
77
78#define builtin_define(TXT) cpp_define (pfile, TXT)
79#define builtin_assert(TXT) cpp_assert (pfile, TXT)
80
81void
a2369ed3 82rs6000_cpu_cpp_builtins (cpp_reader *pfile)
4c4eb375
GK
83{
84 if (TARGET_POWER2)
85 builtin_define ("_ARCH_PWR2");
86 else if (TARGET_POWER)
87 builtin_define ("_ARCH_PWR");
88 if (TARGET_POWERPC)
89 builtin_define ("_ARCH_PPC");
90 if (TARGET_POWERPC64)
91 builtin_define ("_ARCH_PPC64");
92 if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC)
93 builtin_define ("_ARCH_COM");
94 if (TARGET_ALTIVEC)
95 builtin_define ("__ALTIVEC__");
a3170dc6
AH
96 if (TARGET_SPE)
97 builtin_define ("__SPE__");
4c4eb375
GK
98 if (TARGET_SOFT_FLOAT)
99 builtin_define ("_SOFT_FLOAT");
b4d330e1
DE
100 /* Used by lwarx/stwcx. errata work-around. */
101 if (rs6000_cpu == PROCESSOR_PPC405)
102 builtin_define ("__PPC405__");
647d340d
JT
103
104 /* May be overridden by target configuration. */
105 RS6000_CPU_CPP_ENDIAN_BUILTINS();
106
4c4eb375
GK
107 if (TARGET_LONG_DOUBLE_128)
108 builtin_define ("__LONG_DOUBLE_128__");
109
110 switch (rs6000_current_abi)
111 {
112 case ABI_V4:
113 builtin_define ("_CALL_SYSV");
114 break;
4c4eb375
GK
115 case ABI_AIX:
116 builtin_define ("_CALL_AIXDESC");
117 builtin_define ("_CALL_AIX");
118 break;
119 case ABI_DARWIN:
120 builtin_define ("_CALL_DARWIN");
121 break;
b4d330e1
DE
122 default:
123 break;
4c4eb375
GK
124 }
125}