1/* Compiler arithmetic header.
2 Copyright (C) 2000-2023 Free Software Foundation, Inc.
3 Contributed by Steven Bosscher
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GFC_ARITH_H
22#define GFC_ARITH_H
23
24/* MPFR also does not have the conversion of a mpfr_t to a mpz_t, so declare
25 a function for this as well. */
26
27void gfc_mpfr_to_mpz (mpz_t, mpfr_t, locus *);
28void gfc_set_model_kind (int);
29void gfc_set_model (mpfr_t);
30
31/* Make sure a gfc_expr expression is within its allowed range. Checks
32 for overflow and underflow. */
33arith gfc_range_check (gfc_expr *);
34
35int gfc_compare_expr (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
36int gfc_compare_string (gfc_expr *, gfc_expr *);
37int gfc_compare_with_Cstring (gfc_expr *, const char *, bool);
38
39
40/* Constant folding for gfc_expr trees. */
41gfc_expr *gfc_parentheses (gfc_expr * op);
42gfc_expr *gfc_uplus (gfc_expr * op);
43gfc_expr *gfc_uminus (gfc_expr * op);
44gfc_expr *gfc_add (gfc_expr *, gfc_expr *);
45gfc_expr *gfc_subtract (gfc_expr *, gfc_expr *);
46gfc_expr *gfc_multiply (gfc_expr *, gfc_expr *);
47gfc_expr *gfc_divide (gfc_expr *, gfc_expr *);
48gfc_expr *gfc_power (gfc_expr *, gfc_expr *);
49gfc_expr *gfc_concat (gfc_expr *, gfc_expr *);
50gfc_expr *gfc_and (gfc_expr *, gfc_expr *);
51gfc_expr *gfc_or (gfc_expr *, gfc_expr *);
52gfc_expr *gfc_not (gfc_expr *);
53gfc_expr *gfc_eqv (gfc_expr *, gfc_expr *);
54gfc_expr *gfc_neqv (gfc_expr *, gfc_expr *);
55gfc_expr *gfc_eq (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
56gfc_expr *gfc_ne (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
57gfc_expr *gfc_gt (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
58gfc_expr *gfc_ge (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
59gfc_expr *gfc_lt (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
60gfc_expr *gfc_le (gfc_expr *, gfc_expr *, gfc_intrinsic_op);
61
62/* Convert a constant of one kind to another kind. */
63gfc_expr *gfc_int2int (gfc_expr *, int);
64gfc_expr *gfc_int2real (gfc_expr *, int);
65gfc_expr *gfc_int2complex (gfc_expr *, int);
66gfc_expr *gfc_real2int (gfc_expr *, int);
67gfc_expr *gfc_real2real (gfc_expr *, int);
68gfc_expr *gfc_real2complex (gfc_expr *, int);
69gfc_expr *gfc_complex2int (gfc_expr *, int);
70gfc_expr *gfc_complex2real (gfc_expr *, int);
71gfc_expr *gfc_complex2complex (gfc_expr *, int);
72gfc_expr *gfc_log2log (gfc_expr *, int);
73gfc_expr *gfc_log2int (gfc_expr *, int);
74gfc_expr *gfc_int2log (gfc_expr *, int);
75gfc_expr *gfc_hollerith2int (gfc_expr *, int);
76gfc_expr *gfc_hollerith2real (gfc_expr *, int);
77gfc_expr *gfc_hollerith2complex (gfc_expr *, int);
78gfc_expr *gfc_hollerith2character (gfc_expr *, int);
79gfc_expr *gfc_hollerith2logical (gfc_expr *, int);
80gfc_expr *gfc_character2int (gfc_expr *, int);
81gfc_expr *gfc_character2real (gfc_expr *, int);
82gfc_expr *gfc_character2complex (gfc_expr *, int);
83gfc_expr *gfc_character2character (gfc_expr *, int);
84gfc_expr *gfc_character2logical (gfc_expr *, int);
85
86#endif /* GFC_ARITH_H */
87
88

source code of gcc/fortran/arith.h