rust: build failure after NON_DEPENDENT_EXPR removal [PR111899]
[official-gcc.git] / gcc / config / nvptx / nvptx-c.cc
blob040823b50c7c1b699c594b5a8a7095488f21b3bf
1 /* Subroutines for the C front end on the NVPTX architecture.
2 * Copyright (C) 2021-2023 Free Software Foundation, Inc.
4 * This file is part of GCC.
6 * GCC is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 3, or (at your
9 * option) any later version.
11 * GCC is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 * License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GCC; see the file COPYING3. If not see
18 * <http://www.gnu.org/licenses/>. */
20 #define IN_TARGET_CODE 1
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "target.h"
26 #include "c-family/c-common.h"
27 #include "memmodel.h"
28 #include "tm_p.h"
29 #include "c-family/c-pragma.h"
31 /* Function to tell the preprocessor about the defines for the target. */
32 void
33 nvptx_cpu_cpp_builtins (void)
35 cpp_assert (parse_in, "machine=nvptx");
36 cpp_assert (parse_in, "cpu=nvptx");
37 cpp_define (parse_in, "__nvptx__");
38 if (TARGET_SOFT_STACK)
39 cpp_define (parse_in, "__nvptx_softstack__");
40 if (TARGET_UNIFORM_SIMT)
41 cpp_define (parse_in,"__nvptx_unisimt__");
43 const char *ptx_sm = NULL;
44 #define NVPTX_SM(XX, SEP) \
45 { \
46 if (TARGET_SM ## XX) \
47 ptx_sm = "__PTX_SM__=" #XX "0"; \
49 #include "nvptx-sm.def"
50 #undef NVPTX_SM
51 cpp_define (parse_in, ptx_sm);
54 unsigned major
55 = ptx_version_to_number ((ptx_version)ptx_version_option, true);
56 unsigned minor
57 = ptx_version_to_number ((ptx_version)ptx_version_option, false);
58 cpp_define_formatted (parse_in, "__PTX_ISA_VERSION_MAJOR__=%u", major);
59 cpp_define_formatted (parse_in, "__PTX_ISA_VERSION_MINOR__=%u", minor);