Debian Codegraph @

gcc/fortran/trans-const.h

raw
1 /* Header for code constant translation functions
2 Copyright (C) 2002-2025 Free Software Foundation, Inc.
3 Contributed by Paul Brook
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 /* Converts between INT_CST and GMP integer representations. */
22 tree gfc_conv_mpz_to_tree (mpz_t, int);
23 tree gfc_conv_mpz_unsigned_to_tree (mpz_t, int);
24 tree gfc_conv_mpz_to_tree_type (mpz_t, const tree);
25 void gfc_conv_tree_to_mpz (mpz_t, tree);
26
27 /* Converts between REAL_CST and MPFR floating-point representations. */
28 tree gfc_conv_mpfr_to_tree (mpfr_t, int, int);
29 void gfc_conv_tree_to_mpfr (mpfr_ptr, tree);
30
31 /* Build a tree containing a real infinity (or HUGE if infinities are
32 not supported for the given type. */
33 tree gfc_build_inf_or_huge (tree, int);
34
35 /* Build a tree containing a NaN for the given type, with significand
36 specified by second argument. */
37 tree gfc_build_nan (tree, const char *);
38
39 /* Build a tree for a constant. Must be an EXPR_CONSTANT gfc_expr.
40 For CHARACTER literal constants, the caller still has to set the
41 string length as a separate operation. */
42 tree gfc_conv_constant_to_tree (gfc_expr *);
43
44 /* Like gfc_conv_noncharacter_constant, but works on simplified expression
45 structures. Also sets the length of CHARACTER strings in the gfc_se. */
46 void gfc_conv_constant (gfc_se *, gfc_expr *);
47
48 tree gfc_build_string_const (size_t, const char *);
49 tree gfc_build_wide_string_const (int, size_t, const gfc_char_t *);
50 tree gfc_build_cstring_const (const char *);
51 tree gfc_build_localized_cstring_const (const char *);
52
53 /* Translate a string constant for a static initializer. */
54 tree gfc_conv_string_init (tree, gfc_expr *);
55
56 /* Create a tree node for the string length if it is constant. */
57 void gfc_conv_const_charlen (gfc_charlen *);
58
59 /* Initialize the nodes for constants. */
60 void gfc_init_constants (void);
61
62 /* Build a constant with given type from an int_cst. */
63 tree gfc_build_const (tree, tree);
64
65 /* Integer constants 0..GFC_MAX_DIMENSIONS. */
66 extern GTY(()) tree gfc_rank_cst[GFC_MAX_DIMENSIONS + 1];
67
68 #define gfc_index_zero_node gfc_rank_cst[0]
69 #define gfc_index_one_node gfc_rank_cst[1]