Mercurial > hg > CbC > CbC_gcc
annotate gcc/config/i386/i386-c.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
rev | line source |
---|---|
0 | 1 /* Subroutines used for macro/preprocessor support on the ia-32. |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
2 Copyright (C) 2008, 2009, 2010 |
0 | 3 Free Software Foundation, 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 3, 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 COPYING3. If not see | |
19 <http://www.gnu.org/licenses/>. */ | |
20 | |
21 #include "config.h" | |
22 #include "system.h" | |
23 #include "coretypes.h" | |
24 #include "tm.h" | |
25 #include "tree.h" | |
26 #include "tm_p.h" | |
27 #include "flags.h" | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
28 #include "c-family/c-common.h" |
0 | 29 #include "ggc.h" |
30 #include "target.h" | |
31 #include "target-def.h" | |
32 #include "cpplib.h" | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
33 #include "c-family/c-pragma.h" |
0 | 34 |
35 static bool ix86_pragma_target_parse (tree, tree); | |
36 static void ix86_target_macros_internal | |
37 (int, enum processor_type, enum processor_type, enum fpmath_unit, | |
38 void (*def_or_undef) (cpp_reader *, const char *)); | |
39 | |
40 | |
41 /* Internal function to either define or undef the appropriate system | |
42 macros. */ | |
43 static void | |
44 ix86_target_macros_internal (int isa_flag, | |
45 enum processor_type arch, | |
46 enum processor_type tune, | |
47 enum fpmath_unit fpmath, | |
48 void (*def_or_undef) (cpp_reader *, | |
49 const char *)) | |
50 { | |
51 /* For some of the k6/pentium varients there weren't seperate ISA bits to | |
52 identify which tune/arch flag was passed, so figure it out here. */ | |
53 size_t arch_len = strlen (ix86_arch_string); | |
54 size_t tune_len = strlen (ix86_tune_string); | |
55 int last_arch_char = ix86_arch_string[arch_len - 1]; | |
56 int last_tune_char = ix86_tune_string[tune_len - 1]; | |
57 | |
58 /* Built-ins based on -march=. */ | |
59 switch (arch) | |
60 { | |
61 case PROCESSOR_I386: | |
62 break; | |
63 case PROCESSOR_I486: | |
64 def_or_undef (parse_in, "__i486"); | |
65 def_or_undef (parse_in, "__i486__"); | |
66 break; | |
67 case PROCESSOR_PENTIUM: | |
68 def_or_undef (parse_in, "__i586"); | |
69 def_or_undef (parse_in, "__i586__"); | |
70 def_or_undef (parse_in, "__pentium"); | |
71 def_or_undef (parse_in, "__pentium__"); | |
72 if (isa_flag & OPTION_MASK_ISA_MMX) | |
73 def_or_undef (parse_in, "__pentium_mmx__"); | |
74 break; | |
75 case PROCESSOR_PENTIUMPRO: | |
76 def_or_undef (parse_in, "__i686"); | |
77 def_or_undef (parse_in, "__i686__"); | |
78 def_or_undef (parse_in, "__pentiumpro"); | |
79 def_or_undef (parse_in, "__pentiumpro__"); | |
80 break; | |
81 case PROCESSOR_GEODE: | |
82 def_or_undef (parse_in, "__geode"); | |
83 def_or_undef (parse_in, "__geode__"); | |
84 break; | |
85 case PROCESSOR_K6: | |
86 def_or_undef (parse_in, "__k6"); | |
87 def_or_undef (parse_in, "__k6__"); | |
88 if (last_arch_char == '2') | |
89 def_or_undef (parse_in, "__k6_2__"); | |
90 else if (last_arch_char == '3') | |
91 def_or_undef (parse_in, "__k6_3__"); | |
92 else if (isa_flag & OPTION_MASK_ISA_3DNOW) | |
93 def_or_undef (parse_in, "__k6_3__"); | |
94 break; | |
95 case PROCESSOR_ATHLON: | |
96 def_or_undef (parse_in, "__athlon"); | |
97 def_or_undef (parse_in, "__athlon__"); | |
98 if (isa_flag & OPTION_MASK_ISA_SSE) | |
99 def_or_undef (parse_in, "__athlon_sse__"); | |
100 break; | |
101 case PROCESSOR_K8: | |
102 def_or_undef (parse_in, "__k8"); | |
103 def_or_undef (parse_in, "__k8__"); | |
104 break; | |
105 case PROCESSOR_AMDFAM10: | |
106 def_or_undef (parse_in, "__amdfam10"); | |
107 def_or_undef (parse_in, "__amdfam10__"); | |
108 break; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
109 case PROCESSOR_BDVER1: |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
110 def_or_undef (parse_in, "__bdver1"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
111 def_or_undef (parse_in, "__bdver1__"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
112 break; |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
113 case PROCESSOR_BTVER1: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
114 def_or_undef (parse_in, "__btver1"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
115 def_or_undef (parse_in, "__btver1__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
116 break; |
0 | 117 case PROCESSOR_PENTIUM4: |
118 def_or_undef (parse_in, "__pentium4"); | |
119 def_or_undef (parse_in, "__pentium4__"); | |
120 break; | |
121 case PROCESSOR_NOCONA: | |
122 def_or_undef (parse_in, "__nocona"); | |
123 def_or_undef (parse_in, "__nocona__"); | |
124 break; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
125 case PROCESSOR_CORE2_32: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
126 case PROCESSOR_CORE2_64: |
0 | 127 def_or_undef (parse_in, "__core2"); |
128 def_or_undef (parse_in, "__core2__"); | |
129 break; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
130 case PROCESSOR_COREI7_32: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
131 case PROCESSOR_COREI7_64: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
132 def_or_undef (parse_in, "__corei7"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
133 def_or_undef (parse_in, "__corei7__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
134 break; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
135 case PROCESSOR_ATOM: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
136 def_or_undef (parse_in, "__atom"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
137 def_or_undef (parse_in, "__atom__"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
138 break; |
0 | 139 /* use PROCESSOR_max to not set/unset the arch macro. */ |
140 case PROCESSOR_max: | |
141 break; | |
142 case PROCESSOR_GENERIC32: | |
143 case PROCESSOR_GENERIC64: | |
144 gcc_unreachable (); | |
145 } | |
146 | |
147 /* Built-ins based on -mtune=. */ | |
148 switch (tune) | |
149 { | |
150 case PROCESSOR_I386: | |
151 def_or_undef (parse_in, "__tune_i386__"); | |
152 break; | |
153 case PROCESSOR_I486: | |
154 def_or_undef (parse_in, "__tune_i486__"); | |
155 break; | |
156 case PROCESSOR_PENTIUM: | |
157 def_or_undef (parse_in, "__tune_i586__"); | |
158 def_or_undef (parse_in, "__tune_pentium__"); | |
159 if (last_tune_char == 'x') | |
160 def_or_undef (parse_in, "__tune_pentium_mmx__"); | |
161 break; | |
162 case PROCESSOR_PENTIUMPRO: | |
163 def_or_undef (parse_in, "__tune_i686__"); | |
164 def_or_undef (parse_in, "__tune_pentiumpro__"); | |
165 switch (last_tune_char) | |
166 { | |
167 case '3': | |
168 def_or_undef (parse_in, "__tune_pentium3__"); | |
169 /* FALLTHRU */ | |
170 case '2': | |
171 def_or_undef (parse_in, "__tune_pentium2__"); | |
172 break; | |
173 } | |
174 break; | |
175 case PROCESSOR_GEODE: | |
176 def_or_undef (parse_in, "__tune_geode__"); | |
177 break; | |
178 case PROCESSOR_K6: | |
179 def_or_undef (parse_in, "__tune_k6__"); | |
180 if (last_tune_char == '2') | |
181 def_or_undef (parse_in, "__tune_k6_2__"); | |
182 else if (last_tune_char == '3') | |
183 def_or_undef (parse_in, "__tune_k6_3__"); | |
184 else if (isa_flag & OPTION_MASK_ISA_3DNOW) | |
185 def_or_undef (parse_in, "__tune_k6_3__"); | |
186 break; | |
187 case PROCESSOR_ATHLON: | |
188 def_or_undef (parse_in, "__tune_athlon__"); | |
189 if (isa_flag & OPTION_MASK_ISA_SSE) | |
190 def_or_undef (parse_in, "__tune_athlon_sse__"); | |
191 break; | |
192 case PROCESSOR_K8: | |
193 def_or_undef (parse_in, "__tune_k8__"); | |
194 break; | |
195 case PROCESSOR_AMDFAM10: | |
196 def_or_undef (parse_in, "__tune_amdfam10__"); | |
197 break; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
198 case PROCESSOR_BDVER1: |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
199 def_or_undef (parse_in, "__tune_bdver1__"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
200 break; |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
201 case PROCESSOR_BTVER1: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
202 def_or_undef (parse_in, "__tune_btver1__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
203 break; |
0 | 204 case PROCESSOR_PENTIUM4: |
205 def_or_undef (parse_in, "__tune_pentium4__"); | |
206 break; | |
207 case PROCESSOR_NOCONA: | |
208 def_or_undef (parse_in, "__tune_nocona__"); | |
209 break; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
210 case PROCESSOR_CORE2_32: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
211 case PROCESSOR_CORE2_64: |
0 | 212 def_or_undef (parse_in, "__tune_core2__"); |
213 break; | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
214 case PROCESSOR_COREI7_32: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
215 case PROCESSOR_COREI7_64: |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
216 def_or_undef (parse_in, "__tune_corei7__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
217 break; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
218 case PROCESSOR_ATOM: |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
219 def_or_undef (parse_in, "__tune_atom__"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
220 break; |
0 | 221 case PROCESSOR_GENERIC32: |
222 case PROCESSOR_GENERIC64: | |
223 break; | |
224 /* use PROCESSOR_max to not set/unset the tune macro. */ | |
225 case PROCESSOR_max: | |
226 break; | |
227 } | |
228 | |
229 if (isa_flag & OPTION_MASK_ISA_MMX) | |
230 def_or_undef (parse_in, "__MMX__"); | |
231 if (isa_flag & OPTION_MASK_ISA_3DNOW) | |
232 def_or_undef (parse_in, "__3dNOW__"); | |
233 if (isa_flag & OPTION_MASK_ISA_3DNOW_A) | |
234 def_or_undef (parse_in, "__3dNOW_A__"); | |
235 if (isa_flag & OPTION_MASK_ISA_SSE) | |
236 def_or_undef (parse_in, "__SSE__"); | |
237 if (isa_flag & OPTION_MASK_ISA_SSE2) | |
238 def_or_undef (parse_in, "__SSE2__"); | |
239 if (isa_flag & OPTION_MASK_ISA_SSE3) | |
240 def_or_undef (parse_in, "__SSE3__"); | |
241 if (isa_flag & OPTION_MASK_ISA_SSSE3) | |
242 def_or_undef (parse_in, "__SSSE3__"); | |
243 if (isa_flag & OPTION_MASK_ISA_SSE4_1) | |
244 def_or_undef (parse_in, "__SSE4_1__"); | |
245 if (isa_flag & OPTION_MASK_ISA_SSE4_2) | |
246 def_or_undef (parse_in, "__SSE4_2__"); | |
247 if (isa_flag & OPTION_MASK_ISA_AES) | |
248 def_or_undef (parse_in, "__AES__"); | |
249 if (isa_flag & OPTION_MASK_ISA_PCLMUL) | |
250 def_or_undef (parse_in, "__PCLMUL__"); | |
251 if (isa_flag & OPTION_MASK_ISA_AVX) | |
252 def_or_undef (parse_in, "__AVX__"); | |
253 if (isa_flag & OPTION_MASK_ISA_FMA) | |
254 def_or_undef (parse_in, "__FMA__"); | |
255 if (isa_flag & OPTION_MASK_ISA_SSE4A) | |
256 def_or_undef (parse_in, "__SSE4A__"); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
257 if (isa_flag & OPTION_MASK_ISA_FMA4) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
258 def_or_undef (parse_in, "__FMA4__"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
259 if (isa_flag & OPTION_MASK_ISA_XOP) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
260 def_or_undef (parse_in, "__XOP__"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
261 if (isa_flag & OPTION_MASK_ISA_LWP) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
262 def_or_undef (parse_in, "__LWP__"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
263 if (isa_flag & OPTION_MASK_ISA_ABM) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
264 def_or_undef (parse_in, "__ABM__"); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
265 if (isa_flag & OPTION_MASK_ISA_BMI) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
266 def_or_undef (parse_in, "__BMI__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
267 if (isa_flag & OPTION_MASK_ISA_TBM) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
268 def_or_undef (parse_in, "__TBM__"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
269 if (isa_flag & OPTION_MASK_ISA_POPCNT) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
270 def_or_undef (parse_in, "__POPCNT__"); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
271 if (isa_flag & OPTION_MASK_ISA_FSGSBASE) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
272 def_or_undef (parse_in, "__FSGSBASE__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
273 if (isa_flag & OPTION_MASK_ISA_RDRND) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
274 def_or_undef (parse_in, "__RDRND__"); |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
275 if (isa_flag & OPTION_MASK_ISA_F16C) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
276 def_or_undef (parse_in, "__F16C__"); |
0 | 277 if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE)) |
278 def_or_undef (parse_in, "__SSE_MATH__"); | |
279 if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2)) | |
280 def_or_undef (parse_in, "__SSE2_MATH__"); | |
281 } | |
282 | |
283 | |
284 /* Hook to validate the current #pragma GCC target and set the state, and | |
285 update the macros based on what was changed. If ARGS is NULL, then | |
286 POP_TARGET is used to reset the options. */ | |
287 | |
288 static bool | |
289 ix86_pragma_target_parse (tree args, tree pop_target) | |
290 { | |
291 tree prev_tree = build_target_option_node (); | |
292 tree cur_tree; | |
293 struct cl_target_option *prev_opt; | |
294 struct cl_target_option *cur_opt; | |
295 int prev_isa; | |
296 int cur_isa; | |
297 int diff_isa; | |
298 enum processor_type prev_arch; | |
299 enum processor_type prev_tune; | |
300 enum processor_type cur_arch; | |
301 enum processor_type cur_tune; | |
302 | |
303 if (! args) | |
304 { | |
305 cur_tree = ((pop_target) | |
306 ? pop_target | |
307 : target_option_default_node); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
308 cl_target_option_restore (&global_options, |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
309 TREE_TARGET_OPTION (cur_tree)); |
0 | 310 } |
311 else | |
312 { | |
313 cur_tree = ix86_valid_target_attribute_tree (args); | |
314 if (!cur_tree) | |
315 return false; | |
316 } | |
317 | |
318 target_option_current_node = cur_tree; | |
319 | |
320 /* Figure out the previous/current isa, arch, tune and the differences. */ | |
321 prev_opt = TREE_TARGET_OPTION (prev_tree); | |
322 cur_opt = TREE_TARGET_OPTION (cur_tree); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
323 prev_isa = prev_opt->x_ix86_isa_flags; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
324 cur_isa = cur_opt->x_ix86_isa_flags; |
0 | 325 diff_isa = (prev_isa ^ cur_isa); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
326 prev_arch = (enum processor_type) prev_opt->arch; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
327 prev_tune = (enum processor_type) prev_opt->tune; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
328 cur_arch = (enum processor_type) cur_opt->arch; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
329 cur_tune = (enum processor_type) cur_opt->tune; |
0 | 330 |
331 /* If the same processor is used for both previous and current options, don't | |
332 change the macros. */ | |
333 if (cur_arch == prev_arch) | |
334 cur_arch = prev_arch = PROCESSOR_max; | |
335 | |
336 if (cur_tune == prev_tune) | |
337 cur_tune = prev_tune = PROCESSOR_max; | |
338 | |
339 /* Undef all of the macros for that are no longer current. */ | |
340 ix86_target_macros_internal (prev_isa & diff_isa, | |
341 prev_arch, | |
342 prev_tune, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
343 (enum fpmath_unit) prev_opt->fpmath, |
0 | 344 cpp_undef); |
345 | |
346 /* Define all of the macros for new options that were just turned on. */ | |
347 ix86_target_macros_internal (cur_isa & diff_isa, | |
348 cur_arch, | |
349 cur_tune, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
350 (enum fpmath_unit) cur_opt->fpmath, |
0 | 351 cpp_define); |
352 | |
353 return true; | |
354 } | |
355 | |
356 /* Function to tell the preprocessor about the defines for the current target. */ | |
357 | |
358 void | |
359 ix86_target_macros (void) | |
360 { | |
361 /* 32/64-bit won't change with target specific options, so do the assert and | |
362 builtin_define_std calls here. */ | |
363 if (TARGET_64BIT) | |
364 { | |
365 cpp_assert (parse_in, "cpu=x86_64"); | |
366 cpp_assert (parse_in, "machine=x86_64"); | |
367 cpp_define (parse_in, "__amd64"); | |
368 cpp_define (parse_in, "__amd64__"); | |
369 cpp_define (parse_in, "__x86_64"); | |
370 cpp_define (parse_in, "__x86_64__"); | |
371 } | |
372 else | |
373 { | |
374 cpp_assert (parse_in, "cpu=i386"); | |
375 cpp_assert (parse_in, "machine=i386"); | |
376 builtin_define_std ("i386"); | |
377 } | |
378 | |
379 ix86_target_macros_internal (ix86_isa_flags, | |
380 ix86_arch, | |
381 ix86_tune, | |
382 ix86_fpmath, | |
383 cpp_define); | |
384 } | |
385 | |
386 | |
387 /* Register target pragmas. We need to add the hook for parsing #pragma GCC | |
388 option here rather than in i386.c since it will pull in various preprocessor | |
389 functions, and those are not present in languages like fortran without a | |
390 preprocessor. */ | |
391 | |
392 void | |
393 ix86_register_pragmas (void) | |
394 { | |
395 /* Update pragma hook to allow parsing #pragma GCC target. */ | |
396 targetm.target_option.pragma_parse = ix86_pragma_target_parse; | |
397 | |
398 #ifdef REGISTER_SUBTARGET_PRAGMAS | |
399 REGISTER_SUBTARGET_PRAGMAS (); | |
400 #endif | |
401 } |