]>
Commit | Line | Data |
---|---|---|
8d9254fc | 1 | /* Copyright (C) 2016-2020 Free Software Foundation, Inc. |
cf07c3de CZ |
2 | |
3 | This file is part of GCC. | |
4 | ||
5 | GCC is free software; you can redistribute it and/or modify it | |
6 | under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3, or (at your option) | |
8 | any later version. | |
9 | ||
10 | GCC is distributed in the hope that it will be useful, but WITHOUT | |
11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
12 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | |
13 | License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with GCC; see the file COPYING3. If not see | |
17 | <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
8fcc61f8 RS |
20 | #define IN_TARGET_CODE 1 |
21 | ||
cf07c3de CZ |
22 | #include "config.h" |
23 | #include "system.h" | |
24 | #include "coretypes.h" | |
25 | #include "tm.h" | |
26 | #include "tree.h" | |
4d0cdd0c | 27 | #include "memmodel.h" |
cf07c3de CZ |
28 | #include "tm_p.h" |
29 | #include "cpplib.h" | |
30 | #include "c-family/c-common.h" | |
31 | #include "target.h" | |
32 | ||
33 | #define builtin_define(TXT) cpp_define (pfile, TXT) | |
34 | #define builtin_assert(TXT) cpp_assert (pfile, TXT) | |
35 | ||
36 | /* Define or undefine macros based on the current target. */ | |
37 | ||
38 | static void | |
39 | def_or_undef_macro (cpp_reader* pfile, const char *name, bool def_p) | |
40 | { | |
41 | if (def_p) | |
42 | cpp_define (pfile, name); | |
43 | else | |
44 | cpp_undef (pfile, name); | |
45 | } | |
46 | ||
47 | /* Helper for TARGET_CPU_CPP_BUILTINS hook. */ | |
48 | ||
49 | void | |
50 | arc_cpu_cpp_builtins (cpp_reader * pfile) | |
51 | { | |
52 | builtin_assert ("cpu=arc"); | |
53 | builtin_assert ("machine=arc"); | |
54 | ||
55 | builtin_define ("__arc__"); | |
56 | ||
57 | #undef ARC_C_DEF | |
58 | #define ARC_C_DEF(NAME, CONDITION) \ | |
59 | def_or_undef_macro (pfile, NAME, CONDITION); | |
60 | ||
61 | #include "arc-c.def" | |
62 | #undef ARC_C_DEF | |
63 | ||
64 | builtin_define_with_int_value ("__ARC_TLS_REGNO__", | |
65 | arc_tp_regno); | |
66 | ||
a2de90a4 CZ |
67 | builtin_define_with_int_value ("__ARC_LPC_WIDTH__", arc_lpcwidth); |
68 | ||
cf07c3de CZ |
69 | builtin_define (TARGET_BIG_ENDIAN |
70 | ? "__BIG_ENDIAN__" : "__LITTLE_ENDIAN__"); | |
71 | if (TARGET_BIG_ENDIAN) | |
72 | builtin_define ("__big_endian__"); | |
73 | ||
756b23a8 VG |
74 | if (TARGET_HARD_FLOAT) |
75 | { | |
76 | builtin_define ("__arc_hard_float__"); | |
77 | builtin_define ("__ARC_HARD_FLOAT__"); | |
78 | } | |
79 | else | |
80 | { | |
81 | builtin_define ("__arc_soft_float__"); | |
82 | builtin_define ("__ARC_SOFT_FLOAT__"); | |
83 | } | |
cf07c3de | 84 | } |