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