OSDN Git Service

Backport from mainline
[pf3gnuchains/gcc-fork.git] / gcc / config / microblaze / microblaze-c.c
1 /* Subroutines used for the C front end for Xilinx MicroBlaze.
2    Copyright 2010 Free Software Foundation, Inc.
3
4    Contributed by Michael Eager <eager@eagercon.com>.
5
6    This file is part of GCC.
7
8    GCC is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published
10    by the Free Software Foundation; either version 3, or (at your
11    option) any later version.
12
13    GCC is distributed in the hope that it will be useful, but WITHOUT
14    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16    License 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 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "cpplib.h"
27 #include "tree.h"
28 #include "c-family/c-common.h"
29 #include "tm_p.h"
30 #include "target.h"
31
32 #define builtin_define(TXT) cpp_define (pfile, TXT)
33 #define builtin_assert(TXT) cpp_assert (pfile, TXT)
34
35 /* Define preprocessor symbols for MicroBlaze.  
36    Symbols which do not start with __ are deprecated.  */
37
38 void 
39 microblaze_cpp_define (cpp_reader *pfile)
40 {
41   builtin_assert ("cpu=microblaze");
42   builtin_assert ("machine=microblaze");
43   builtin_define ("__MICROBLAZE__");
44   if (!TARGET_SOFT_MUL) 
45     {
46       if (!flag_iso)
47         builtin_define ("HAVE_HW_MUL");
48       builtin_define ("__HAVE_HW_MUL__");
49     }
50   if (TARGET_MULTIPLY_HIGH)
51     {
52       if (!flag_iso)
53         builtin_define ("HAVE_HW_MUL_HIGH");
54       builtin_define ("__HAVE_HW_MUL_HIGH__");
55     }
56   if (!TARGET_SOFT_DIV)
57     {
58       if (!flag_iso)
59         builtin_define ("HAVE_HW_DIV");
60       builtin_define ("__HAVE_HW_DIV__");
61     }
62   if (TARGET_BARREL_SHIFT)
63     {
64       if (!flag_iso)
65         builtin_define ("HAVE_HW_BSHIFT");
66       builtin_define ("__HAVE_HW_BSHIFT__");
67     }
68   if (TARGET_PATTERN_COMPARE)
69     {
70       if (!flag_iso)
71         builtin_define ("HAVE_HW_PCMP");
72       builtin_define ("__HAVE_HW_PCMP__");
73     }
74   if (TARGET_HARD_FLOAT)
75     {
76       if (!flag_iso)
77         builtin_define ("HAVE_HW_FPU");
78       builtin_define ("__HAVE_HW_FPU__");
79     }
80   if (TARGET_FLOAT_CONVERT)
81     {
82       if (!flag_iso)
83         builtin_define ("HAVE_HW_FPU_CONVERT");
84       builtin_define ("__HAVE_HW_FPU_CONVERT__");
85     }
86   if (TARGET_FLOAT_SQRT)
87     {
88       if (!flag_iso)
89         builtin_define ("HAVE_HW_FPU_SQRT");
90       builtin_define ("__HAVE_HW_FPU_SQRT__");
91     }
92 }