microblaze-c.c revision 1.3
1/* Subroutines used for the C front end for Xilinx MicroBlaze.
2   Copyright (C) 2010-2015 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 "hash-set.h"
28#include "machmode.h"
29#include "vec.h"
30#include "double-int.h"
31#include "input.h"
32#include "alias.h"
33#include "symtab.h"
34#include "wide-int.h"
35#include "inchash.h"
36#include "tree.h"
37#include "c-family/c-common.h"
38#include "tm_p.h"
39#include "target.h"
40
41#define builtin_define(TXT) cpp_define (pfile, TXT)
42#define builtin_assert(TXT) cpp_assert (pfile, TXT)
43
44/* Define preprocessor symbols for MicroBlaze.
45   Symbols which do not start with __ are deprecated.  */
46
47void
48microblaze_cpp_define (cpp_reader *pfile)
49{
50  builtin_assert ("cpu=microblaze");
51  builtin_assert ("machine=microblaze");
52  builtin_define ("__MICROBLAZE__");
53  builtin_define ("__microblaze__");
54  if (TARGET_LITTLE_ENDIAN)
55    {
56      builtin_define ("_LITTLE_ENDIAN");
57      builtin_define ("__LITTLE_ENDIAN__");
58      builtin_define ("__MICROBLAZEEL__");
59    }
60  else
61    {
62      builtin_define ("_BIG_ENDIAN");
63      builtin_define ("__BIG_ENDIAN__");
64      builtin_define ("__MICROBLAZEEB__");
65    }
66  if (!TARGET_SOFT_MUL)
67    {
68      if (!flag_iso)
69        builtin_define ("HAVE_HW_MUL");
70      builtin_define ("__HAVE_HW_MUL__");
71    }
72  if (TARGET_MULTIPLY_HIGH)
73    {
74      if (!flag_iso)
75        builtin_define ("HAVE_HW_MUL_HIGH");
76      builtin_define ("__HAVE_HW_MUL_HIGH__");
77    }
78  if (!TARGET_SOFT_DIV)
79    {
80      if (!flag_iso)
81        builtin_define ("HAVE_HW_DIV");
82      builtin_define ("__HAVE_HW_DIV__");
83    }
84  if (TARGET_BARREL_SHIFT)
85    {
86      if (!flag_iso)
87        builtin_define ("HAVE_HW_BSHIFT");
88      builtin_define ("__HAVE_HW_BSHIFT__");
89    }
90  if (TARGET_PATTERN_COMPARE)
91    {
92      if (!flag_iso)
93        builtin_define ("HAVE_HW_PCMP");
94      builtin_define ("__HAVE_HW_PCMP__");
95    }
96  if (TARGET_HARD_FLOAT)
97    {
98      if (!flag_iso)
99        builtin_define ("HAVE_HW_FPU");
100      builtin_define ("__HAVE_HW_FPU__");
101    }
102  if (TARGET_FLOAT_CONVERT)
103    {
104      if (!flag_iso)
105        builtin_define ("HAVE_HW_FPU_CONVERT");
106      builtin_define ("__HAVE_HW_FPU_CONVERT__");
107    }
108  if (TARGET_FLOAT_SQRT)
109    {
110      if (!flag_iso)
111        builtin_define ("HAVE_HW_FPU_SQRT");
112      builtin_define ("__HAVE_HW_FPU_SQRT__");
113    }
114}
115