]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/arith.h
Merge tree-ssa-20020619-branch into mainline.
[thirdparty/gcc.git] / gcc / fortran / arith.h
1 /* Compiler arithmetic header.
2 Copyright (C) 2000, 2001. 2002 Free Software Foundation, Inc.
3 Contributed by Steven Bosscher
4
5 This file is part of GNU G95.
6
7 GNU G95 is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU G95 is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU G95; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22
23 #ifndef GFC_ARITH_H
24 #define GFC_ARITH_H
25
26 #include "gfortran.h"
27
28 /* Constants calculated during initialization. */
29 extern mpf_t pi, half_pi, two_pi, e;
30
31 /* Calculate mathematically interesting functions. */
32 void natural_logarithm (mpf_t *, mpf_t *);
33 void common_logarithm (mpf_t *, mpf_t *);
34 void exponential (mpf_t *, mpf_t *);
35 void sine (mpf_t *, mpf_t *);
36 void cosine (mpf_t *, mpf_t *);
37 void arctangent (mpf_t *, mpf_t *);
38 void arctangent2 (mpf_t *, mpf_t *, mpf_t *);
39 void hypercos (mpf_t *, mpf_t *);
40 void hypersine (mpf_t *, mpf_t *);
41
42 /* Return a constant result of a given type and kind, with locus. */
43 gfc_expr *gfc_constant_result (bt, int, locus *);
44
45 /* Make sure a gfc_expr expression is within its allowed range. Checks
46 for overflow and underflow. */
47 arith gfc_range_check (gfc_expr *);
48
49 int gfc_compare_expr (gfc_expr *, gfc_expr *);
50 int gfc_compare_string (gfc_expr *, gfc_expr *, const int *);
51
52 /* Constant folding for gfc_expr trees. */
53 gfc_expr *gfc_uplus (gfc_expr * op);
54 gfc_expr *gfc_uminus (gfc_expr * op);
55 gfc_expr *gfc_add (gfc_expr *, gfc_expr *);
56 gfc_expr *gfc_subtract (gfc_expr *, gfc_expr *);
57 gfc_expr *gfc_multiply (gfc_expr *, gfc_expr *);
58 gfc_expr *gfc_divide (gfc_expr *, gfc_expr *);
59 gfc_expr *gfc_power (gfc_expr *, gfc_expr *);
60 gfc_expr *gfc_concat (gfc_expr *, gfc_expr *);
61 gfc_expr *gfc_and (gfc_expr *, gfc_expr *);
62 gfc_expr *gfc_or (gfc_expr *, gfc_expr *);
63 gfc_expr *gfc_not (gfc_expr *);
64 gfc_expr *gfc_eqv (gfc_expr *, gfc_expr *);
65 gfc_expr *gfc_neqv (gfc_expr *, gfc_expr *);
66 gfc_expr *gfc_eq (gfc_expr *, gfc_expr *);
67 gfc_expr *gfc_ne (gfc_expr *, gfc_expr *);
68 gfc_expr *gfc_gt (gfc_expr *, gfc_expr *);
69 gfc_expr *gfc_ge (gfc_expr *, gfc_expr *);
70 gfc_expr *gfc_lt (gfc_expr *, gfc_expr *);
71 gfc_expr *gfc_le (gfc_expr *, gfc_expr *);
72
73 /* Convert strings to literal constants. */
74 gfc_expr *gfc_convert_integer (const char *, int, int, locus *);
75 gfc_expr *gfc_convert_real (const char *, int, locus *);
76 gfc_expr *gfc_convert_complex (gfc_expr *, gfc_expr *, int);
77
78 /* Convert a constant of one kind to another kind. */
79 gfc_expr *gfc_int2int (gfc_expr *, int);
80 gfc_expr *gfc_int2real (gfc_expr *, int);
81 gfc_expr *gfc_int2complex (gfc_expr *, int);
82 gfc_expr *gfc_real2int (gfc_expr *, int);
83 gfc_expr *gfc_real2real (gfc_expr *, int);
84 gfc_expr *gfc_real2complex (gfc_expr *, int);
85 gfc_expr *gfc_complex2int (gfc_expr *, int);
86 gfc_expr *gfc_complex2real (gfc_expr *, int);
87 gfc_expr *gfc_complex2complex (gfc_expr *, int);
88 gfc_expr *gfc_log2log (gfc_expr *, int);
89
90 #endif /* GFC_ARITH_H */
91