annotate gcc/machmode.h @ 118:fd00160c1b76

ifdef TARGET_64BIT
author mir3636
date Tue, 27 Feb 2018 15:01:35 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Machine mode definitions for GCC; included by rtl.h and tree.h.
111
kono
parents: 67
diff changeset
2 Copyright (C) 1991-2017 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 #ifndef HAVE_MACHINE_MODES
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #define HAVE_MACHINE_MODES
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
111
kono
parents: 67
diff changeset
23 typedef opt_mode<machine_mode> opt_machine_mode;
kono
parents: 67
diff changeset
24
kono
parents: 67
diff changeset
25 extern CONST_MODE_SIZE unsigned short mode_size[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
26 extern const unsigned short mode_precision[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
27 extern const unsigned char mode_inner[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
28 extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
29 extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
30 extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
31 extern const unsigned char mode_wider[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
32 extern const unsigned char mode_2xwider[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
33
kono
parents: 67
diff changeset
34 template<typename T>
kono
parents: 67
diff changeset
35 struct mode_traits
kono
parents: 67
diff changeset
36 {
kono
parents: 67
diff changeset
37 /* For use by the machmode support code only.
kono
parents: 67
diff changeset
38
kono
parents: 67
diff changeset
39 There are cases in which the machmode support code needs to forcibly
kono
parents: 67
diff changeset
40 convert a machine_mode to a specific mode class T, and in which the
kono
parents: 67
diff changeset
41 context guarantees that this is valid without the need for an assert.
kono
parents: 67
diff changeset
42 This can be done using:
kono
parents: 67
diff changeset
43
kono
parents: 67
diff changeset
44 return typename mode_traits<T>::from_int (mode);
kono
parents: 67
diff changeset
45
kono
parents: 67
diff changeset
46 when returning a T and:
kono
parents: 67
diff changeset
47
kono
parents: 67
diff changeset
48 res = T (typename mode_traits<T>::from_int (mode));
kono
parents: 67
diff changeset
49
kono
parents: 67
diff changeset
50 when assigning to a value RES that must be assignment-compatible
kono
parents: 67
diff changeset
51 with (but possibly not the same as) T. */
kono
parents: 67
diff changeset
52 #ifdef USE_ENUM_MODES
kono
parents: 67
diff changeset
53 /* Allow direct conversion of enums to specific mode classes only
kono
parents: 67
diff changeset
54 when USE_ENUM_MODES is defined. This is only intended for use
kono
parents: 67
diff changeset
55 by gencondmd, so that it can tell more easily when .md conditions
kono
parents: 67
diff changeset
56 are always false. */
kono
parents: 67
diff changeset
57 typedef machine_mode from_int;
kono
parents: 67
diff changeset
58 #else
kono
parents: 67
diff changeset
59 /* Here we use an enum type distinct from machine_mode but with the
kono
parents: 67
diff changeset
60 same range as machine_mode. T should have a constructor that
kono
parents: 67
diff changeset
61 accepts this enum type; it should not have a constructor that
kono
parents: 67
diff changeset
62 accepts machine_mode.
kono
parents: 67
diff changeset
63
kono
parents: 67
diff changeset
64 We use this somewhat indirect approach to avoid too many constructor
kono
parents: 67
diff changeset
65 calls when the compiler is built with -O0. For example, even in
kono
parents: 67
diff changeset
66 unoptimized code, the return statement above would construct the
kono
parents: 67
diff changeset
67 returned T directly from the numerical value of MODE. */
kono
parents: 67
diff changeset
68 enum from_int { dummy = MAX_MACHINE_MODE };
kono
parents: 67
diff changeset
69 #endif
kono
parents: 67
diff changeset
70 };
kono
parents: 67
diff changeset
71
kono
parents: 67
diff changeset
72 template<>
kono
parents: 67
diff changeset
73 struct mode_traits<machine_mode>
kono
parents: 67
diff changeset
74 {
kono
parents: 67
diff changeset
75 /* machine_mode itself needs no conversion. */
kono
parents: 67
diff changeset
76 typedef machine_mode from_int;
kono
parents: 67
diff changeset
77 };
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 /* Get the name of mode MODE as a string. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 extern const char * const mode_name[NUM_MACHINE_MODES];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 #define GET_MODE_NAME(MODE) mode_name[MODE]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 /* Mode classes. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 #include "mode-classes.def"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 #define DEF_MODE_CLASS(M) M
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 enum mode_class { MODE_CLASSES, MAX_MODE_CLASS };
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 #undef DEF_MODE_CLASS
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 #undef MODE_CLASSES
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 /* Get the general kind of object that mode MODE represents
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 (integer, floating, complex, etc.) */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 extern const unsigned char mode_class[NUM_MACHINE_MODES];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
96 #define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE])
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 /* Nonzero if MODE is an integral mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 #define INTEGRAL_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 (GET_MODE_CLASS (MODE) == MODE_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 || GET_MODE_CLASS (MODE) == MODE_VECTOR_INT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 /* Nonzero if MODE is a floating-point mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 #define FLOAT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 /* Nonzero if MODE is a complex mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 #define COMPLEX_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 /* Nonzero if MODE is a vector mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 #define VECTOR_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 /* Nonzero if MODE is a scalar integral mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 #define SCALAR_INT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 (GET_MODE_CLASS (MODE) == MODE_INT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 /* Nonzero if MODE is a scalar floating point mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 #define SCALAR_FLOAT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 (GET_MODE_CLASS (MODE) == MODE_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 /* Nonzero if MODE is a decimal floating point mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 #define DECIMAL_FLOAT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 (GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
139
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 /* Nonzero if MODE is a scalar fract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 #define SCALAR_FRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 (GET_MODE_CLASS (MODE) == MODE_FRACT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 /* Nonzero if MODE is a scalar ufract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 #define SCALAR_UFRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 (GET_MODE_CLASS (MODE) == MODE_UFRACT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 /* Nonzero if MODE is a scalar fract or ufract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 #define ALL_SCALAR_FRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 (SCALAR_FRACT_MODE_P (MODE) || SCALAR_UFRACT_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
151
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 /* Nonzero if MODE is a scalar accum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 #define SCALAR_ACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 (GET_MODE_CLASS (MODE) == MODE_ACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 /* Nonzero if MODE is a scalar uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 #define SCALAR_UACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 (GET_MODE_CLASS (MODE) == MODE_UACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 /* Nonzero if MODE is a scalar accum or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 #define ALL_SCALAR_ACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 (SCALAR_ACCUM_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 /* Nonzero if MODE is a scalar fract or accum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 #define SIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 (SCALAR_FRACT_MODE_P (MODE) || SCALAR_ACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 /* Nonzero if MODE is a scalar ufract or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 #define UNSIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 (SCALAR_UFRACT_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 /* Nonzero if MODE is a scalar fract, ufract, accum or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 #define ALL_SCALAR_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 (SIGNED_SCALAR_FIXED_POINT_MODE_P (MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 || UNSIGNED_SCALAR_FIXED_POINT_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 /* Nonzero if MODE is a scalar/vector fract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 #define FRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 (GET_MODE_CLASS (MODE) == MODE_FRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 /* Nonzero if MODE is a scalar/vector ufract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 #define UFRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 (GET_MODE_CLASS (MODE) == MODE_UFRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 /* Nonzero if MODE is a scalar/vector fract or ufract mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 #define ALL_FRACT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 (FRACT_MODE_P (MODE) || UFRACT_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
191 /* Nonzero if MODE is a scalar/vector accum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 #define ACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 (GET_MODE_CLASS (MODE) == MODE_ACCUM \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 /* Nonzero if MODE is a scalar/vector uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 #define UACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 (GET_MODE_CLASS (MODE) == MODE_UACCUM \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 /* Nonzero if MODE is a scalar/vector accum or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 #define ALL_ACCUM_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 (ACCUM_MODE_P (MODE) || UACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 /* Nonzero if MODE is a scalar/vector fract or accum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 #define SIGNED_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 (FRACT_MODE_P (MODE) || ACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 /* Nonzero if MODE is a scalar/vector ufract or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 #define UNSIGNED_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211 (UFRACT_MODE_P (MODE) || UACCUM_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
212
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 /* Nonzero if MODE is a scalar/vector fract, ufract, accum or uaccum mode. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 #define ALL_FIXED_POINT_MODE_P(MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 (SIGNED_FIXED_POINT_MODE_P (MODE) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 || UNSIGNED_FIXED_POINT_MODE_P (MODE))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
217
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 /* Nonzero if CLASS modes can be widened. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
219 #define CLASS_HAS_WIDER_MODES_P(CLASS) \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 (CLASS == MODE_INT \
111
kono
parents: 67
diff changeset
221 || CLASS == MODE_PARTIAL_INT \
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 || CLASS == MODE_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 || CLASS == MODE_DECIMAL_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 || CLASS == MODE_COMPLEX_FLOAT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
225 || CLASS == MODE_FRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 || CLASS == MODE_UFRACT \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 || CLASS == MODE_ACCUM \
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
228 || CLASS == MODE_UACCUM)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229
111
kono
parents: 67
diff changeset
230 #define POINTER_BOUNDS_MODE_P(MODE) \
kono
parents: 67
diff changeset
231 (GET_MODE_CLASS (MODE) == MODE_POINTER_BOUNDS)
kono
parents: 67
diff changeset
232
kono
parents: 67
diff changeset
233 /* An optional T (i.e. a T or nothing), where T is some form of mode class. */
kono
parents: 67
diff changeset
234 template<typename T>
kono
parents: 67
diff changeset
235 class opt_mode
kono
parents: 67
diff changeset
236 {
kono
parents: 67
diff changeset
237 public:
kono
parents: 67
diff changeset
238 enum from_int { dummy = MAX_MACHINE_MODE };
kono
parents: 67
diff changeset
239
kono
parents: 67
diff changeset
240 ALWAYS_INLINE opt_mode () : m_mode (E_VOIDmode) {}
kono
parents: 67
diff changeset
241 ALWAYS_INLINE opt_mode (const T &m) : m_mode (m) {}
kono
parents: 67
diff changeset
242 template<typename U>
kono
parents: 67
diff changeset
243 ALWAYS_INLINE opt_mode (const U &m) : m_mode (T (m)) {}
kono
parents: 67
diff changeset
244 ALWAYS_INLINE opt_mode (from_int m) : m_mode (machine_mode (m)) {}
kono
parents: 67
diff changeset
245
kono
parents: 67
diff changeset
246 machine_mode else_void () const;
kono
parents: 67
diff changeset
247 machine_mode else_blk () const;
kono
parents: 67
diff changeset
248 T require () const;
kono
parents: 67
diff changeset
249
kono
parents: 67
diff changeset
250 bool exists () const;
kono
parents: 67
diff changeset
251 template<typename U> bool exists (U *) const;
kono
parents: 67
diff changeset
252
kono
parents: 67
diff changeset
253 private:
kono
parents: 67
diff changeset
254 machine_mode m_mode;
kono
parents: 67
diff changeset
255 };
kono
parents: 67
diff changeset
256
kono
parents: 67
diff changeset
257 /* If the object contains a T, return its enum value, otherwise return
kono
parents: 67
diff changeset
258 E_VOIDmode. */
kono
parents: 67
diff changeset
259
kono
parents: 67
diff changeset
260 template<typename T>
kono
parents: 67
diff changeset
261 ALWAYS_INLINE machine_mode
kono
parents: 67
diff changeset
262 opt_mode<T>::else_void () const
kono
parents: 67
diff changeset
263 {
kono
parents: 67
diff changeset
264 return m_mode;
kono
parents: 67
diff changeset
265 }
kono
parents: 67
diff changeset
266
kono
parents: 67
diff changeset
267 /* If the T exists, return its enum value, otherwise return E_BLKmode. */
kono
parents: 67
diff changeset
268
kono
parents: 67
diff changeset
269 template<typename T>
kono
parents: 67
diff changeset
270 inline machine_mode
kono
parents: 67
diff changeset
271 opt_mode<T>::else_blk () const
kono
parents: 67
diff changeset
272 {
kono
parents: 67
diff changeset
273 return m_mode == E_VOIDmode ? E_BLKmode : m_mode;
kono
parents: 67
diff changeset
274 }
kono
parents: 67
diff changeset
275
kono
parents: 67
diff changeset
276 /* Assert that the object contains a T and return it. */
kono
parents: 67
diff changeset
277
kono
parents: 67
diff changeset
278 template<typename T>
kono
parents: 67
diff changeset
279 inline T
kono
parents: 67
diff changeset
280 opt_mode<T>::require () const
kono
parents: 67
diff changeset
281 {
kono
parents: 67
diff changeset
282 gcc_checking_assert (m_mode != E_VOIDmode);
kono
parents: 67
diff changeset
283 return typename mode_traits<T>::from_int (m_mode);
kono
parents: 67
diff changeset
284 }
kono
parents: 67
diff changeset
285
kono
parents: 67
diff changeset
286 /* Return true if the object contains a T rather than nothing. */
kono
parents: 67
diff changeset
287
kono
parents: 67
diff changeset
288 template<typename T>
kono
parents: 67
diff changeset
289 ALWAYS_INLINE bool
kono
parents: 67
diff changeset
290 opt_mode<T>::exists () const
kono
parents: 67
diff changeset
291 {
kono
parents: 67
diff changeset
292 return m_mode != E_VOIDmode;
kono
parents: 67
diff changeset
293 }
kono
parents: 67
diff changeset
294
kono
parents: 67
diff changeset
295 /* Return true if the object contains a T, storing it in *MODE if so. */
kono
parents: 67
diff changeset
296
kono
parents: 67
diff changeset
297 template<typename T>
kono
parents: 67
diff changeset
298 template<typename U>
kono
parents: 67
diff changeset
299 inline bool
kono
parents: 67
diff changeset
300 opt_mode<T>::exists (U *mode) const
kono
parents: 67
diff changeset
301 {
kono
parents: 67
diff changeset
302 if (m_mode != E_VOIDmode)
kono
parents: 67
diff changeset
303 {
kono
parents: 67
diff changeset
304 *mode = T (typename mode_traits<T>::from_int (m_mode));
kono
parents: 67
diff changeset
305 return true;
kono
parents: 67
diff changeset
306 }
kono
parents: 67
diff changeset
307 return false;
kono
parents: 67
diff changeset
308 }
kono
parents: 67
diff changeset
309
kono
parents: 67
diff changeset
310 /* A POD version of mode class T. */
kono
parents: 67
diff changeset
311
kono
parents: 67
diff changeset
312 template<typename T>
kono
parents: 67
diff changeset
313 struct pod_mode
kono
parents: 67
diff changeset
314 {
kono
parents: 67
diff changeset
315 typedef typename mode_traits<T>::from_int from_int;
kono
parents: 67
diff changeset
316
kono
parents: 67
diff changeset
317 machine_mode m_mode;
kono
parents: 67
diff changeset
318 ALWAYS_INLINE operator machine_mode () const { return m_mode; }
kono
parents: 67
diff changeset
319 ALWAYS_INLINE operator T () const { return from_int (m_mode); }
kono
parents: 67
diff changeset
320 ALWAYS_INLINE pod_mode &operator = (const T &m) { m_mode = m; return *this; }
kono
parents: 67
diff changeset
321 };
kono
parents: 67
diff changeset
322
kono
parents: 67
diff changeset
323 /* Return true if mode M has type T. */
kono
parents: 67
diff changeset
324
kono
parents: 67
diff changeset
325 template<typename T>
kono
parents: 67
diff changeset
326 inline bool
kono
parents: 67
diff changeset
327 is_a (machine_mode m)
kono
parents: 67
diff changeset
328 {
kono
parents: 67
diff changeset
329 return T::includes_p (m);
kono
parents: 67
diff changeset
330 }
kono
parents: 67
diff changeset
331
kono
parents: 67
diff changeset
332 template<typename T, typename U>
kono
parents: 67
diff changeset
333 inline bool
kono
parents: 67
diff changeset
334 is_a (const opt_mode<U> &m)
kono
parents: 67
diff changeset
335 {
kono
parents: 67
diff changeset
336 return T::includes_p (m.else_void ());
kono
parents: 67
diff changeset
337 }
kono
parents: 67
diff changeset
338
kono
parents: 67
diff changeset
339 /* Assert that mode M has type T, and return it in that form. */
kono
parents: 67
diff changeset
340
kono
parents: 67
diff changeset
341 template<typename T>
kono
parents: 67
diff changeset
342 inline T
kono
parents: 67
diff changeset
343 as_a (machine_mode m)
kono
parents: 67
diff changeset
344 {
kono
parents: 67
diff changeset
345 gcc_checking_assert (T::includes_p (m));
kono
parents: 67
diff changeset
346 return typename mode_traits<T>::from_int (m);
kono
parents: 67
diff changeset
347 }
kono
parents: 67
diff changeset
348
kono
parents: 67
diff changeset
349 template<typename T, typename U>
kono
parents: 67
diff changeset
350 inline T
kono
parents: 67
diff changeset
351 as_a (const opt_mode<U> &m)
kono
parents: 67
diff changeset
352 {
kono
parents: 67
diff changeset
353 return as_a <T> (m.else_void ());
kono
parents: 67
diff changeset
354 }
kono
parents: 67
diff changeset
355
kono
parents: 67
diff changeset
356 /* Convert M to an opt_mode<T>. */
kono
parents: 67
diff changeset
357
kono
parents: 67
diff changeset
358 template<typename T>
kono
parents: 67
diff changeset
359 inline opt_mode<T>
kono
parents: 67
diff changeset
360 dyn_cast (machine_mode m)
kono
parents: 67
diff changeset
361 {
kono
parents: 67
diff changeset
362 if (T::includes_p (m))
kono
parents: 67
diff changeset
363 return T (typename mode_traits<T>::from_int (m));
kono
parents: 67
diff changeset
364 return opt_mode<T> ();
kono
parents: 67
diff changeset
365 }
kono
parents: 67
diff changeset
366
kono
parents: 67
diff changeset
367 template<typename T, typename U>
kono
parents: 67
diff changeset
368 inline opt_mode<T>
kono
parents: 67
diff changeset
369 dyn_cast (const opt_mode<U> &m)
kono
parents: 67
diff changeset
370 {
kono
parents: 67
diff changeset
371 return dyn_cast <T> (m.else_void ());
kono
parents: 67
diff changeset
372 }
kono
parents: 67
diff changeset
373
kono
parents: 67
diff changeset
374 /* Return true if mode M has type T, storing it as a T in *RESULT
kono
parents: 67
diff changeset
375 if so. */
kono
parents: 67
diff changeset
376
kono
parents: 67
diff changeset
377 template<typename T, typename U>
kono
parents: 67
diff changeset
378 inline bool
kono
parents: 67
diff changeset
379 is_a (machine_mode m, U *result)
kono
parents: 67
diff changeset
380 {
kono
parents: 67
diff changeset
381 if (T::includes_p (m))
kono
parents: 67
diff changeset
382 {
kono
parents: 67
diff changeset
383 *result = T (typename mode_traits<T>::from_int (m));
kono
parents: 67
diff changeset
384 return true;
kono
parents: 67
diff changeset
385 }
kono
parents: 67
diff changeset
386 return false;
kono
parents: 67
diff changeset
387 }
kono
parents: 67
diff changeset
388
kono
parents: 67
diff changeset
389 /* Represents a machine mode that is known to be a SCALAR_INT_MODE_P. */
kono
parents: 67
diff changeset
390 class scalar_int_mode
kono
parents: 67
diff changeset
391 {
kono
parents: 67
diff changeset
392 public:
kono
parents: 67
diff changeset
393 typedef mode_traits<scalar_int_mode>::from_int from_int;
kono
parents: 67
diff changeset
394
kono
parents: 67
diff changeset
395 ALWAYS_INLINE scalar_int_mode () {}
kono
parents: 67
diff changeset
396 ALWAYS_INLINE scalar_int_mode (from_int m) : m_mode (machine_mode (m)) {}
kono
parents: 67
diff changeset
397 ALWAYS_INLINE operator machine_mode () const { return m_mode; }
kono
parents: 67
diff changeset
398
kono
parents: 67
diff changeset
399 static bool includes_p (machine_mode);
kono
parents: 67
diff changeset
400
kono
parents: 67
diff changeset
401 protected:
kono
parents: 67
diff changeset
402 machine_mode m_mode;
kono
parents: 67
diff changeset
403 };
kono
parents: 67
diff changeset
404
kono
parents: 67
diff changeset
405 /* Return true if M is a scalar_int_mode. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
406
111
kono
parents: 67
diff changeset
407 inline bool
kono
parents: 67
diff changeset
408 scalar_int_mode::includes_p (machine_mode m)
kono
parents: 67
diff changeset
409 {
kono
parents: 67
diff changeset
410 return SCALAR_INT_MODE_P (m);
kono
parents: 67
diff changeset
411 }
kono
parents: 67
diff changeset
412
kono
parents: 67
diff changeset
413 /* Represents a machine mode that is known to be a SCALAR_FLOAT_MODE_P. */
kono
parents: 67
diff changeset
414 class scalar_float_mode
kono
parents: 67
diff changeset
415 {
kono
parents: 67
diff changeset
416 public:
kono
parents: 67
diff changeset
417 typedef mode_traits<scalar_float_mode>::from_int from_int;
kono
parents: 67
diff changeset
418
kono
parents: 67
diff changeset
419 ALWAYS_INLINE scalar_float_mode () {}
kono
parents: 67
diff changeset
420 ALWAYS_INLINE scalar_float_mode (from_int m) : m_mode (machine_mode (m)) {}
kono
parents: 67
diff changeset
421 ALWAYS_INLINE operator machine_mode () const { return m_mode; }
kono
parents: 67
diff changeset
422
kono
parents: 67
diff changeset
423 static bool includes_p (machine_mode);
kono
parents: 67
diff changeset
424
kono
parents: 67
diff changeset
425 protected:
kono
parents: 67
diff changeset
426 machine_mode m_mode;
kono
parents: 67
diff changeset
427 };
kono
parents: 67
diff changeset
428
kono
parents: 67
diff changeset
429 /* Return true if M is a scalar_float_mode. */
kono
parents: 67
diff changeset
430
kono
parents: 67
diff changeset
431 inline bool
kono
parents: 67
diff changeset
432 scalar_float_mode::includes_p (machine_mode m)
kono
parents: 67
diff changeset
433 {
kono
parents: 67
diff changeset
434 return SCALAR_FLOAT_MODE_P (m);
kono
parents: 67
diff changeset
435 }
kono
parents: 67
diff changeset
436
kono
parents: 67
diff changeset
437 /* Represents a machine mode that is known to be scalar. */
kono
parents: 67
diff changeset
438 class scalar_mode
kono
parents: 67
diff changeset
439 {
kono
parents: 67
diff changeset
440 public:
kono
parents: 67
diff changeset
441 typedef mode_traits<scalar_mode>::from_int from_int;
kono
parents: 67
diff changeset
442
kono
parents: 67
diff changeset
443 ALWAYS_INLINE scalar_mode () {}
kono
parents: 67
diff changeset
444 ALWAYS_INLINE scalar_mode (from_int m) : m_mode (machine_mode (m)) {}
kono
parents: 67
diff changeset
445 ALWAYS_INLINE scalar_mode (const scalar_int_mode &m) : m_mode (m) {}
kono
parents: 67
diff changeset
446 ALWAYS_INLINE scalar_mode (const scalar_float_mode &m) : m_mode (m) {}
kono
parents: 67
diff changeset
447 ALWAYS_INLINE scalar_mode (const scalar_int_mode_pod &m) : m_mode (m) {}
kono
parents: 67
diff changeset
448 ALWAYS_INLINE operator machine_mode () const { return m_mode; }
kono
parents: 67
diff changeset
449
kono
parents: 67
diff changeset
450 static bool includes_p (machine_mode);
kono
parents: 67
diff changeset
451
kono
parents: 67
diff changeset
452 protected:
kono
parents: 67
diff changeset
453 machine_mode m_mode;
kono
parents: 67
diff changeset
454 };
kono
parents: 67
diff changeset
455
kono
parents: 67
diff changeset
456 /* Return true if M represents some kind of scalar value. */
kono
parents: 67
diff changeset
457
kono
parents: 67
diff changeset
458 inline bool
kono
parents: 67
diff changeset
459 scalar_mode::includes_p (machine_mode m)
kono
parents: 67
diff changeset
460 {
kono
parents: 67
diff changeset
461 switch (GET_MODE_CLASS (m))
kono
parents: 67
diff changeset
462 {
kono
parents: 67
diff changeset
463 case MODE_INT:
kono
parents: 67
diff changeset
464 case MODE_PARTIAL_INT:
kono
parents: 67
diff changeset
465 case MODE_FRACT:
kono
parents: 67
diff changeset
466 case MODE_UFRACT:
kono
parents: 67
diff changeset
467 case MODE_ACCUM:
kono
parents: 67
diff changeset
468 case MODE_UACCUM:
kono
parents: 67
diff changeset
469 case MODE_FLOAT:
kono
parents: 67
diff changeset
470 case MODE_DECIMAL_FLOAT:
kono
parents: 67
diff changeset
471 case MODE_POINTER_BOUNDS:
kono
parents: 67
diff changeset
472 return true;
kono
parents: 67
diff changeset
473 default:
kono
parents: 67
diff changeset
474 return false;
kono
parents: 67
diff changeset
475 }
kono
parents: 67
diff changeset
476 }
kono
parents: 67
diff changeset
477
kono
parents: 67
diff changeset
478 /* Represents a machine mode that is known to be a COMPLEX_MODE_P. */
kono
parents: 67
diff changeset
479 class complex_mode
kono
parents: 67
diff changeset
480 {
kono
parents: 67
diff changeset
481 public:
kono
parents: 67
diff changeset
482 typedef mode_traits<complex_mode>::from_int from_int;
kono
parents: 67
diff changeset
483
kono
parents: 67
diff changeset
484 ALWAYS_INLINE complex_mode () {}
kono
parents: 67
diff changeset
485 ALWAYS_INLINE complex_mode (from_int m) : m_mode (machine_mode (m)) {}
kono
parents: 67
diff changeset
486 ALWAYS_INLINE operator machine_mode () const { return m_mode; }
kono
parents: 67
diff changeset
487
kono
parents: 67
diff changeset
488 static bool includes_p (machine_mode);
kono
parents: 67
diff changeset
489
kono
parents: 67
diff changeset
490 protected:
kono
parents: 67
diff changeset
491 machine_mode m_mode;
kono
parents: 67
diff changeset
492 };
kono
parents: 67
diff changeset
493
kono
parents: 67
diff changeset
494 /* Return true if M is a complex_mode. */
kono
parents: 67
diff changeset
495
kono
parents: 67
diff changeset
496 inline bool
kono
parents: 67
diff changeset
497 complex_mode::includes_p (machine_mode m)
kono
parents: 67
diff changeset
498 {
kono
parents: 67
diff changeset
499 return COMPLEX_MODE_P (m);
kono
parents: 67
diff changeset
500 }
kono
parents: 67
diff changeset
501
kono
parents: 67
diff changeset
502 /* Return the base GET_MODE_SIZE value for MODE. */
kono
parents: 67
diff changeset
503
kono
parents: 67
diff changeset
504 ALWAYS_INLINE unsigned short
kono
parents: 67
diff changeset
505 mode_to_bytes (machine_mode mode)
kono
parents: 67
diff changeset
506 {
kono
parents: 67
diff changeset
507 #if GCC_VERSION >= 4001
kono
parents: 67
diff changeset
508 return (__builtin_constant_p (mode)
kono
parents: 67
diff changeset
509 ? mode_size_inline (mode) : mode_size[mode]);
kono
parents: 67
diff changeset
510 #else
kono
parents: 67
diff changeset
511 return mode_size[mode];
kono
parents: 67
diff changeset
512 #endif
kono
parents: 67
diff changeset
513 }
kono
parents: 67
diff changeset
514
kono
parents: 67
diff changeset
515 /* Return the base GET_MODE_BITSIZE value for MODE. */
kono
parents: 67
diff changeset
516
kono
parents: 67
diff changeset
517 ALWAYS_INLINE unsigned short
kono
parents: 67
diff changeset
518 mode_to_bits (machine_mode mode)
kono
parents: 67
diff changeset
519 {
kono
parents: 67
diff changeset
520 return mode_to_bytes (mode) * BITS_PER_UNIT;
kono
parents: 67
diff changeset
521 }
kono
parents: 67
diff changeset
522
kono
parents: 67
diff changeset
523 /* Return the base GET_MODE_PRECISION value for MODE. */
kono
parents: 67
diff changeset
524
kono
parents: 67
diff changeset
525 ALWAYS_INLINE unsigned short
kono
parents: 67
diff changeset
526 mode_to_precision (machine_mode mode)
kono
parents: 67
diff changeset
527 {
kono
parents: 67
diff changeset
528 return mode_precision[mode];
kono
parents: 67
diff changeset
529 }
kono
parents: 67
diff changeset
530
kono
parents: 67
diff changeset
531 /* Return the base GET_MODE_INNER value for MODE. */
kono
parents: 67
diff changeset
532
kono
parents: 67
diff changeset
533 ALWAYS_INLINE scalar_mode
kono
parents: 67
diff changeset
534 mode_to_inner (machine_mode mode)
kono
parents: 67
diff changeset
535 {
kono
parents: 67
diff changeset
536 #if GCC_VERSION >= 4001
kono
parents: 67
diff changeset
537 return scalar_mode::from_int (__builtin_constant_p (mode)
kono
parents: 67
diff changeset
538 ? mode_inner_inline (mode)
kono
parents: 67
diff changeset
539 : mode_inner[mode]);
kono
parents: 67
diff changeset
540 #else
kono
parents: 67
diff changeset
541 return scalar_mode::from_int (mode_inner[mode]);
kono
parents: 67
diff changeset
542 #endif
kono
parents: 67
diff changeset
543 }
kono
parents: 67
diff changeset
544
kono
parents: 67
diff changeset
545 /* Return the base GET_MODE_UNIT_SIZE value for MODE. */
kono
parents: 67
diff changeset
546
kono
parents: 67
diff changeset
547 ALWAYS_INLINE unsigned char
kono
parents: 67
diff changeset
548 mode_to_unit_size (machine_mode mode)
kono
parents: 67
diff changeset
549 {
kono
parents: 67
diff changeset
550 #if GCC_VERSION >= 4001
kono
parents: 67
diff changeset
551 return (__builtin_constant_p (mode)
kono
parents: 67
diff changeset
552 ? mode_unit_size_inline (mode) : mode_unit_size[mode]);
kono
parents: 67
diff changeset
553 #else
kono
parents: 67
diff changeset
554 return mode_unit_size[mode];
kono
parents: 67
diff changeset
555 #endif
kono
parents: 67
diff changeset
556 }
kono
parents: 67
diff changeset
557
kono
parents: 67
diff changeset
558 /* Return the base GET_MODE_UNIT_PRECISION value for MODE. */
kono
parents: 67
diff changeset
559
kono
parents: 67
diff changeset
560 ALWAYS_INLINE unsigned short
kono
parents: 67
diff changeset
561 mode_to_unit_precision (machine_mode mode)
kono
parents: 67
diff changeset
562 {
kono
parents: 67
diff changeset
563 #if GCC_VERSION >= 4001
kono
parents: 67
diff changeset
564 return (__builtin_constant_p (mode)
kono
parents: 67
diff changeset
565 ? mode_unit_precision_inline (mode) : mode_unit_precision[mode]);
kono
parents: 67
diff changeset
566 #else
kono
parents: 67
diff changeset
567 return mode_unit_precision[mode];
kono
parents: 67
diff changeset
568 #endif
kono
parents: 67
diff changeset
569 }
kono
parents: 67
diff changeset
570
kono
parents: 67
diff changeset
571 /* Return the base GET_MODE_NUNITS value for MODE. */
kono
parents: 67
diff changeset
572
kono
parents: 67
diff changeset
573 ALWAYS_INLINE unsigned short
kono
parents: 67
diff changeset
574 mode_to_nunits (machine_mode mode)
kono
parents: 67
diff changeset
575 {
kono
parents: 67
diff changeset
576 #if GCC_VERSION >= 4001
kono
parents: 67
diff changeset
577 return (__builtin_constant_p (mode)
kono
parents: 67
diff changeset
578 ? mode_nunits_inline (mode) : mode_nunits[mode]);
kono
parents: 67
diff changeset
579 #else
kono
parents: 67
diff changeset
580 return mode_nunits[mode];
kono
parents: 67
diff changeset
581 #endif
kono
parents: 67
diff changeset
582 }
kono
parents: 67
diff changeset
583
kono
parents: 67
diff changeset
584 /* Get the size in bytes of an object of mode MODE. */
kono
parents: 67
diff changeset
585
kono
parents: 67
diff changeset
586 #define GET_MODE_SIZE(MODE) (mode_to_bytes (MODE))
kono
parents: 67
diff changeset
587
kono
parents: 67
diff changeset
588 /* Get the size in bits of an object of mode MODE. */
kono
parents: 67
diff changeset
589
kono
parents: 67
diff changeset
590 #define GET_MODE_BITSIZE(MODE) (mode_to_bits (MODE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
591
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
592 /* Get the number of value bits of an object of mode MODE. */
111
kono
parents: 67
diff changeset
593
kono
parents: 67
diff changeset
594 #define GET_MODE_PRECISION(MODE) (mode_to_precision (MODE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
595
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
596 /* Get the number of integral bits of an object of mode MODE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 extern CONST_MODE_IBIT unsigned char mode_ibit[NUM_MACHINE_MODES];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 #define GET_MODE_IBIT(MODE) mode_ibit[MODE]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
599
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
600 /* Get the number of fractional bits of an object of mode MODE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
601 extern CONST_MODE_FBIT unsigned char mode_fbit[NUM_MACHINE_MODES];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
602 #define GET_MODE_FBIT(MODE) mode_fbit[MODE]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
603
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
604 /* Get a bitmask containing 1 for all bits in a word
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
605 that fit within mode MODE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
606
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
607 extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
608
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
609 #define GET_MODE_MASK(MODE) mode_mask_array[MODE]
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
610
111
kono
parents: 67
diff changeset
611 /* Return the mode of the basic parts of MODE. For vector modes this is the
kono
parents: 67
diff changeset
612 mode of the vector elements. For complex modes it is the mode of the real
kono
parents: 67
diff changeset
613 and imaginary parts. For other modes it is MODE itself. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
614
111
kono
parents: 67
diff changeset
615 #define GET_MODE_INNER(MODE) (mode_to_inner (MODE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
616
111
kono
parents: 67
diff changeset
617 /* Get the size in bytes or bits of the basic parts of an
kono
parents: 67
diff changeset
618 object of mode MODE. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
619
111
kono
parents: 67
diff changeset
620 #define GET_MODE_UNIT_SIZE(MODE) mode_to_unit_size (MODE)
kono
parents: 67
diff changeset
621
kono
parents: 67
diff changeset
622 #define GET_MODE_UNIT_BITSIZE(MODE) \
kono
parents: 67
diff changeset
623 ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624
111
kono
parents: 67
diff changeset
625 #define GET_MODE_UNIT_PRECISION(MODE) (mode_to_unit_precision (MODE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
626
111
kono
parents: 67
diff changeset
627 /* Get the number of units in an object of mode MODE. This is 2 for
kono
parents: 67
diff changeset
628 complex modes and the number of elements for vector modes. */
kono
parents: 67
diff changeset
629
kono
parents: 67
diff changeset
630 #define GET_MODE_NUNITS(MODE) (mode_to_nunits (MODE))
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
631
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
632 /* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
633
111
kono
parents: 67
diff changeset
634 template<typename T>
kono
parents: 67
diff changeset
635 ALWAYS_INLINE opt_mode<T>
kono
parents: 67
diff changeset
636 GET_MODE_WIDER_MODE (const T &m)
kono
parents: 67
diff changeset
637 {
kono
parents: 67
diff changeset
638 return typename opt_mode<T>::from_int (mode_wider[m]);
kono
parents: 67
diff changeset
639 }
kono
parents: 67
diff changeset
640
kono
parents: 67
diff changeset
641 /* For scalars, this is a mode with twice the precision. For vectors,
kono
parents: 67
diff changeset
642 this is a mode with the same inner mode but with twice the elements. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
643
111
kono
parents: 67
diff changeset
644 template<typename T>
kono
parents: 67
diff changeset
645 ALWAYS_INLINE opt_mode<T>
kono
parents: 67
diff changeset
646 GET_MODE_2XWIDER_MODE (const T &m)
kono
parents: 67
diff changeset
647 {
kono
parents: 67
diff changeset
648 return typename opt_mode<T>::from_int (mode_2xwider[m]);
kono
parents: 67
diff changeset
649 }
kono
parents: 67
diff changeset
650
kono
parents: 67
diff changeset
651 /* Get the complex mode from the component mode. */
kono
parents: 67
diff changeset
652 extern const unsigned char mode_complex[NUM_MACHINE_MODES];
kono
parents: 67
diff changeset
653 #define GET_MODE_COMPLEX_MODE(MODE) ((machine_mode) mode_complex[MODE])
kono
parents: 67
diff changeset
654
kono
parents: 67
diff changeset
655 extern opt_machine_mode mode_for_size (unsigned int, enum mode_class, int);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
656
111
kono
parents: 67
diff changeset
657 /* Return the machine mode to use for a MODE_INT of SIZE bits, if one
kono
parents: 67
diff changeset
658 exists. If LIMIT is nonzero, modes wider than MAX_FIXED_MODE_SIZE
kono
parents: 67
diff changeset
659 will not be used. */
kono
parents: 67
diff changeset
660
kono
parents: 67
diff changeset
661 inline opt_scalar_int_mode
kono
parents: 67
diff changeset
662 int_mode_for_size (unsigned int size, int limit)
kono
parents: 67
diff changeset
663 {
kono
parents: 67
diff changeset
664 return dyn_cast <scalar_int_mode> (mode_for_size (size, MODE_INT, limit));
kono
parents: 67
diff changeset
665 }
kono
parents: 67
diff changeset
666
kono
parents: 67
diff changeset
667 /* Return the machine mode to use for a MODE_FLOAT of SIZE bits, if one
kono
parents: 67
diff changeset
668 exists. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
669
111
kono
parents: 67
diff changeset
670 inline opt_scalar_float_mode
kono
parents: 67
diff changeset
671 float_mode_for_size (unsigned int size)
kono
parents: 67
diff changeset
672 {
kono
parents: 67
diff changeset
673 return dyn_cast <scalar_float_mode> (mode_for_size (size, MODE_FLOAT, 0));
kono
parents: 67
diff changeset
674 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
675
111
kono
parents: 67
diff changeset
676 /* Likewise for MODE_DECIMAL_FLOAT. */
kono
parents: 67
diff changeset
677
kono
parents: 67
diff changeset
678 inline opt_scalar_float_mode
kono
parents: 67
diff changeset
679 decimal_float_mode_for_size (unsigned int size)
kono
parents: 67
diff changeset
680 {
kono
parents: 67
diff changeset
681 return dyn_cast <scalar_float_mode>
kono
parents: 67
diff changeset
682 (mode_for_size (size, MODE_DECIMAL_FLOAT, 0));
kono
parents: 67
diff changeset
683 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
684
111
kono
parents: 67
diff changeset
685 extern machine_mode smallest_mode_for_size (unsigned int, enum mode_class);
kono
parents: 67
diff changeset
686
kono
parents: 67
diff changeset
687 /* Find the narrowest integer mode that contains at least SIZE bits.
kono
parents: 67
diff changeset
688 Such a mode must exist. */
kono
parents: 67
diff changeset
689
kono
parents: 67
diff changeset
690 inline scalar_int_mode
kono
parents: 67
diff changeset
691 smallest_int_mode_for_size (unsigned int size)
kono
parents: 67
diff changeset
692 {
kono
parents: 67
diff changeset
693 return as_a <scalar_int_mode> (smallest_mode_for_size (size, MODE_INT));
kono
parents: 67
diff changeset
694 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
695
111
kono
parents: 67
diff changeset
696 extern opt_scalar_int_mode int_mode_for_mode (machine_mode);
kono
parents: 67
diff changeset
697 extern opt_machine_mode bitwise_mode_for_mode (machine_mode);
kono
parents: 67
diff changeset
698 extern opt_machine_mode mode_for_vector (scalar_mode, unsigned);
kono
parents: 67
diff changeset
699 extern opt_machine_mode mode_for_int_vector (unsigned int, unsigned int);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
700
111
kono
parents: 67
diff changeset
701 /* Return the integer vector equivalent of MODE, if one exists. In other
kono
parents: 67
diff changeset
702 words, return the mode for an integer vector that has the same number
kono
parents: 67
diff changeset
703 of bits as MODE and the same number of elements as MODE, with the
kono
parents: 67
diff changeset
704 latter being 1 if MODE is scalar. The returned mode can be either
kono
parents: 67
diff changeset
705 an integer mode or a vector mode. */
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
706
111
kono
parents: 67
diff changeset
707 inline opt_machine_mode
kono
parents: 67
diff changeset
708 mode_for_int_vector (machine_mode mode)
kono
parents: 67
diff changeset
709 {
kono
parents: 67
diff changeset
710 return mode_for_int_vector (GET_MODE_UNIT_BITSIZE (mode),
kono
parents: 67
diff changeset
711 GET_MODE_NUNITS (mode));
kono
parents: 67
diff changeset
712 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
713
111
kono
parents: 67
diff changeset
714 /* A class for iterating through possible bitfield modes. */
kono
parents: 67
diff changeset
715 class bit_field_mode_iterator
kono
parents: 67
diff changeset
716 {
kono
parents: 67
diff changeset
717 public:
kono
parents: 67
diff changeset
718 bit_field_mode_iterator (HOST_WIDE_INT, HOST_WIDE_INT,
kono
parents: 67
diff changeset
719 HOST_WIDE_INT, HOST_WIDE_INT,
kono
parents: 67
diff changeset
720 unsigned int, bool);
kono
parents: 67
diff changeset
721 bool next_mode (scalar_int_mode *);
kono
parents: 67
diff changeset
722 bool prefer_smaller_modes ();
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
723
111
kono
parents: 67
diff changeset
724 private:
kono
parents: 67
diff changeset
725 opt_scalar_int_mode m_mode;
kono
parents: 67
diff changeset
726 /* We use signed values here because the bit position can be negative
kono
parents: 67
diff changeset
727 for invalid input such as gcc.dg/pr48335-8.c. */
kono
parents: 67
diff changeset
728 HOST_WIDE_INT m_bitsize;
kono
parents: 67
diff changeset
729 HOST_WIDE_INT m_bitpos;
kono
parents: 67
diff changeset
730 HOST_WIDE_INT m_bitregion_start;
kono
parents: 67
diff changeset
731 HOST_WIDE_INT m_bitregion_end;
kono
parents: 67
diff changeset
732 unsigned int m_align;
kono
parents: 67
diff changeset
733 bool m_volatilep;
kono
parents: 67
diff changeset
734 int m_count;
kono
parents: 67
diff changeset
735 };
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
736
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 /* Find the best mode to use to access a bit field. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
738
111
kono
parents: 67
diff changeset
739 extern bool get_best_mode (int, int, unsigned HOST_WIDE_INT,
kono
parents: 67
diff changeset
740 unsigned HOST_WIDE_INT, unsigned int,
kono
parents: 67
diff changeset
741 unsigned HOST_WIDE_INT, bool, scalar_int_mode *);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
742
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
743 /* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
744
111
kono
parents: 67
diff changeset
745 extern CONST_MODE_BASE_ALIGN unsigned short mode_base_align[NUM_MACHINE_MODES];
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
746
111
kono
parents: 67
diff changeset
747 extern unsigned get_mode_alignment (machine_mode);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
748
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
749 #define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
750
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 /* For each class, get the narrowest mode in that class. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
752
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
754 #define GET_CLASS_NARROWEST_MODE(CLASS) \
111
kono
parents: 67
diff changeset
755 ((machine_mode) class_narrowest_mode[CLASS])
kono
parents: 67
diff changeset
756
kono
parents: 67
diff changeset
757 /* The narrowest full integer mode available on the target. */
kono
parents: 67
diff changeset
758
kono
parents: 67
diff changeset
759 #define NARROWEST_INT_MODE \
kono
parents: 67
diff changeset
760 (scalar_int_mode \
kono
parents: 67
diff changeset
761 (scalar_int_mode::from_int (class_narrowest_mode[MODE_INT])))
kono
parents: 67
diff changeset
762
kono
parents: 67
diff changeset
763 /* Return the narrowest mode in T's class. */
kono
parents: 67
diff changeset
764
kono
parents: 67
diff changeset
765 template<typename T>
kono
parents: 67
diff changeset
766 inline T
kono
parents: 67
diff changeset
767 get_narrowest_mode (T mode)
kono
parents: 67
diff changeset
768 {
kono
parents: 67
diff changeset
769 return typename mode_traits<T>::from_int
kono
parents: 67
diff changeset
770 (class_narrowest_mode[GET_MODE_CLASS (mode)]);
kono
parents: 67
diff changeset
771 }
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
772
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
773 /* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
774 and the mode whose class is Pmode and whose size is POINTER_SIZE. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
775
111
kono
parents: 67
diff changeset
776 extern scalar_int_mode byte_mode;
kono
parents: 67
diff changeset
777 extern scalar_int_mode word_mode;
kono
parents: 67
diff changeset
778 extern scalar_int_mode ptr_mode;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
779
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 /* Target-dependent machine mode initialization - in insn-modes.c. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
781 extern void init_adjust_machine_modes (void);
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
782
111
kono
parents: 67
diff changeset
783 #define TRULY_NOOP_TRUNCATION_MODES_P(MODE1, MODE2) \
kono
parents: 67
diff changeset
784 (targetm.truly_noop_truncation (GET_MODE_PRECISION (MODE1), \
kono
parents: 67
diff changeset
785 GET_MODE_PRECISION (MODE2)))
kono
parents: 67
diff changeset
786
kono
parents: 67
diff changeset
787 #define HWI_COMPUTABLE_MODE_P(MODE) \
kono
parents: 67
diff changeset
788 (SCALAR_INT_MODE_P (MODE) \
kono
parents: 67
diff changeset
789 && GET_MODE_PRECISION (MODE) <= HOST_BITS_PER_WIDE_INT)
kono
parents: 67
diff changeset
790
kono
parents: 67
diff changeset
791 struct int_n_data_t {
kono
parents: 67
diff changeset
792 /* These parts are initailized by genmodes output */
kono
parents: 67
diff changeset
793 unsigned int bitsize;
kono
parents: 67
diff changeset
794 scalar_int_mode_pod m;
kono
parents: 67
diff changeset
795 /* RID_* is RID_INTN_BASE + index into this array */
kono
parents: 67
diff changeset
796 };
kono
parents: 67
diff changeset
797
kono
parents: 67
diff changeset
798 /* This is also in tree.h. genmodes.c guarantees the're sorted from
kono
parents: 67
diff changeset
799 smallest bitsize to largest bitsize. */
kono
parents: 67
diff changeset
800 extern bool int_n_enabled_p[NUM_INT_N_ENTS];
kono
parents: 67
diff changeset
801 extern const int_n_data_t int_n_data[NUM_INT_N_ENTS];
kono
parents: 67
diff changeset
802
kono
parents: 67
diff changeset
803 /* Return true if MODE has class MODE_INT, storing it as a scalar_int_mode
kono
parents: 67
diff changeset
804 in *INT_MODE if so. */
kono
parents: 67
diff changeset
805
kono
parents: 67
diff changeset
806 template<typename T>
kono
parents: 67
diff changeset
807 inline bool
kono
parents: 67
diff changeset
808 is_int_mode (machine_mode mode, T *int_mode)
kono
parents: 67
diff changeset
809 {
kono
parents: 67
diff changeset
810 if (GET_MODE_CLASS (mode) == MODE_INT)
kono
parents: 67
diff changeset
811 {
kono
parents: 67
diff changeset
812 *int_mode = scalar_int_mode (scalar_int_mode::from_int (mode));
kono
parents: 67
diff changeset
813 return true;
kono
parents: 67
diff changeset
814 }
kono
parents: 67
diff changeset
815 return false;
kono
parents: 67
diff changeset
816 }
kono
parents: 67
diff changeset
817
kono
parents: 67
diff changeset
818 /* Return true if MODE has class MODE_FLOAT, storing it as a
kono
parents: 67
diff changeset
819 scalar_float_mode in *FLOAT_MODE if so. */
kono
parents: 67
diff changeset
820
kono
parents: 67
diff changeset
821 template<typename T>
kono
parents: 67
diff changeset
822 inline bool
kono
parents: 67
diff changeset
823 is_float_mode (machine_mode mode, T *float_mode)
kono
parents: 67
diff changeset
824 {
kono
parents: 67
diff changeset
825 if (GET_MODE_CLASS (mode) == MODE_FLOAT)
kono
parents: 67
diff changeset
826 {
kono
parents: 67
diff changeset
827 *float_mode = scalar_float_mode (scalar_float_mode::from_int (mode));
kono
parents: 67
diff changeset
828 return true;
kono
parents: 67
diff changeset
829 }
kono
parents: 67
diff changeset
830 return false;
kono
parents: 67
diff changeset
831 }
kono
parents: 67
diff changeset
832
kono
parents: 67
diff changeset
833 /* Return true if MODE has class MODE_COMPLEX_INT, storing it as
kono
parents: 67
diff changeset
834 a complex_mode in *CMODE if so. */
kono
parents: 67
diff changeset
835
kono
parents: 67
diff changeset
836 template<typename T>
kono
parents: 67
diff changeset
837 inline bool
kono
parents: 67
diff changeset
838 is_complex_int_mode (machine_mode mode, T *cmode)
kono
parents: 67
diff changeset
839 {
kono
parents: 67
diff changeset
840 if (GET_MODE_CLASS (mode) == MODE_COMPLEX_INT)
kono
parents: 67
diff changeset
841 {
kono
parents: 67
diff changeset
842 *cmode = complex_mode (complex_mode::from_int (mode));
kono
parents: 67
diff changeset
843 return true;
kono
parents: 67
diff changeset
844 }
kono
parents: 67
diff changeset
845 return false;
kono
parents: 67
diff changeset
846 }
kono
parents: 67
diff changeset
847
kono
parents: 67
diff changeset
848 /* Return true if MODE has class MODE_COMPLEX_FLOAT, storing it as
kono
parents: 67
diff changeset
849 a complex_mode in *CMODE if so. */
kono
parents: 67
diff changeset
850
kono
parents: 67
diff changeset
851 template<typename T>
kono
parents: 67
diff changeset
852 inline bool
kono
parents: 67
diff changeset
853 is_complex_float_mode (machine_mode mode, T *cmode)
kono
parents: 67
diff changeset
854 {
kono
parents: 67
diff changeset
855 if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
kono
parents: 67
diff changeset
856 {
kono
parents: 67
diff changeset
857 *cmode = complex_mode (complex_mode::from_int (mode));
kono
parents: 67
diff changeset
858 return true;
kono
parents: 67
diff changeset
859 }
kono
parents: 67
diff changeset
860 return false;
kono
parents: 67
diff changeset
861 }
kono
parents: 67
diff changeset
862
kono
parents: 67
diff changeset
863 namespace mode_iterator
kono
parents: 67
diff changeset
864 {
kono
parents: 67
diff changeset
865 /* Start mode iterator *ITER at the first mode in class MCLASS, if any. */
kono
parents: 67
diff changeset
866
kono
parents: 67
diff changeset
867 template<typename T>
kono
parents: 67
diff changeset
868 inline void
kono
parents: 67
diff changeset
869 start (opt_mode<T> *iter, enum mode_class mclass)
kono
parents: 67
diff changeset
870 {
kono
parents: 67
diff changeset
871 if (GET_CLASS_NARROWEST_MODE (mclass) == E_VOIDmode)
kono
parents: 67
diff changeset
872 *iter = opt_mode<T> ();
kono
parents: 67
diff changeset
873 else
kono
parents: 67
diff changeset
874 *iter = as_a<T> (GET_CLASS_NARROWEST_MODE (mclass));
kono
parents: 67
diff changeset
875 }
kono
parents: 67
diff changeset
876
kono
parents: 67
diff changeset
877 inline void
kono
parents: 67
diff changeset
878 start (machine_mode *iter, enum mode_class mclass)
kono
parents: 67
diff changeset
879 {
kono
parents: 67
diff changeset
880 *iter = GET_CLASS_NARROWEST_MODE (mclass);
kono
parents: 67
diff changeset
881 }
kono
parents: 67
diff changeset
882
kono
parents: 67
diff changeset
883 /* Return true if mode iterator *ITER has not reached the end. */
kono
parents: 67
diff changeset
884
kono
parents: 67
diff changeset
885 template<typename T>
kono
parents: 67
diff changeset
886 inline bool
kono
parents: 67
diff changeset
887 iterate_p (opt_mode<T> *iter)
kono
parents: 67
diff changeset
888 {
kono
parents: 67
diff changeset
889 return iter->exists ();
kono
parents: 67
diff changeset
890 }
kono
parents: 67
diff changeset
891
kono
parents: 67
diff changeset
892 inline bool
kono
parents: 67
diff changeset
893 iterate_p (machine_mode *iter)
kono
parents: 67
diff changeset
894 {
kono
parents: 67
diff changeset
895 return *iter != E_VOIDmode;
kono
parents: 67
diff changeset
896 }
kono
parents: 67
diff changeset
897
kono
parents: 67
diff changeset
898 /* Set mode iterator *ITER to the next widest mode in the same class,
kono
parents: 67
diff changeset
899 if any. */
kono
parents: 67
diff changeset
900
kono
parents: 67
diff changeset
901 template<typename T>
kono
parents: 67
diff changeset
902 inline void
kono
parents: 67
diff changeset
903 get_wider (opt_mode<T> *iter)
kono
parents: 67
diff changeset
904 {
kono
parents: 67
diff changeset
905 *iter = GET_MODE_WIDER_MODE (iter->require ());
kono
parents: 67
diff changeset
906 }
kono
parents: 67
diff changeset
907
kono
parents: 67
diff changeset
908 inline void
kono
parents: 67
diff changeset
909 get_wider (machine_mode *iter)
kono
parents: 67
diff changeset
910 {
kono
parents: 67
diff changeset
911 *iter = GET_MODE_WIDER_MODE (*iter).else_void ();
kono
parents: 67
diff changeset
912 }
kono
parents: 67
diff changeset
913
kono
parents: 67
diff changeset
914 /* Set mode iterator *ITER to the next widest mode in the same class.
kono
parents: 67
diff changeset
915 Such a mode is known to exist. */
kono
parents: 67
diff changeset
916
kono
parents: 67
diff changeset
917 template<typename T>
kono
parents: 67
diff changeset
918 inline void
kono
parents: 67
diff changeset
919 get_known_wider (T *iter)
kono
parents: 67
diff changeset
920 {
kono
parents: 67
diff changeset
921 *iter = GET_MODE_WIDER_MODE (*iter).require ();
kono
parents: 67
diff changeset
922 }
kono
parents: 67
diff changeset
923
kono
parents: 67
diff changeset
924 /* Set mode iterator *ITER to the mode that is two times wider than the
kono
parents: 67
diff changeset
925 current one, if such a mode exists. */
kono
parents: 67
diff changeset
926
kono
parents: 67
diff changeset
927 template<typename T>
kono
parents: 67
diff changeset
928 inline void
kono
parents: 67
diff changeset
929 get_2xwider (opt_mode<T> *iter)
kono
parents: 67
diff changeset
930 {
kono
parents: 67
diff changeset
931 *iter = GET_MODE_2XWIDER_MODE (iter->require ());
kono
parents: 67
diff changeset
932 }
kono
parents: 67
diff changeset
933
kono
parents: 67
diff changeset
934 inline void
kono
parents: 67
diff changeset
935 get_2xwider (machine_mode *iter)
kono
parents: 67
diff changeset
936 {
kono
parents: 67
diff changeset
937 *iter = GET_MODE_2XWIDER_MODE (*iter).else_void ();
kono
parents: 67
diff changeset
938 }
kono
parents: 67
diff changeset
939 }
kono
parents: 67
diff changeset
940
kono
parents: 67
diff changeset
941 /* Make ITERATOR iterate over all the modes in mode class CLASS,
kono
parents: 67
diff changeset
942 from narrowest to widest. */
kono
parents: 67
diff changeset
943 #define FOR_EACH_MODE_IN_CLASS(ITERATOR, CLASS) \
kono
parents: 67
diff changeset
944 for (mode_iterator::start (&(ITERATOR), CLASS); \
kono
parents: 67
diff changeset
945 mode_iterator::iterate_p (&(ITERATOR)); \
kono
parents: 67
diff changeset
946 mode_iterator::get_wider (&(ITERATOR)))
kono
parents: 67
diff changeset
947
kono
parents: 67
diff changeset
948 /* Make ITERATOR iterate over all the modes in the range [START, END),
kono
parents: 67
diff changeset
949 in order of increasing width. */
kono
parents: 67
diff changeset
950 #define FOR_EACH_MODE(ITERATOR, START, END) \
kono
parents: 67
diff changeset
951 for ((ITERATOR) = (START); \
kono
parents: 67
diff changeset
952 (ITERATOR) != (END); \
kono
parents: 67
diff changeset
953 mode_iterator::get_known_wider (&(ITERATOR)))
kono
parents: 67
diff changeset
954
kono
parents: 67
diff changeset
955 /* Make ITERATOR iterate over START and all wider modes in the same
kono
parents: 67
diff changeset
956 class, in order of increasing width. */
kono
parents: 67
diff changeset
957 #define FOR_EACH_MODE_FROM(ITERATOR, START) \
kono
parents: 67
diff changeset
958 for ((ITERATOR) = (START); \
kono
parents: 67
diff changeset
959 mode_iterator::iterate_p (&(ITERATOR)); \
kono
parents: 67
diff changeset
960 mode_iterator::get_wider (&(ITERATOR)))
kono
parents: 67
diff changeset
961
kono
parents: 67
diff changeset
962 /* Make ITERATOR iterate over modes in the range [NARROWEST, END)
kono
parents: 67
diff changeset
963 in order of increasing width, where NARROWEST is the narrowest mode
kono
parents: 67
diff changeset
964 in END's class. */
kono
parents: 67
diff changeset
965 #define FOR_EACH_MODE_UNTIL(ITERATOR, END) \
kono
parents: 67
diff changeset
966 FOR_EACH_MODE (ITERATOR, get_narrowest_mode (END), END)
kono
parents: 67
diff changeset
967
kono
parents: 67
diff changeset
968 /* Make ITERATOR iterate over modes in the same class as MODE, in order
kono
parents: 67
diff changeset
969 of increasing width. Start at the first mode wider than START,
kono
parents: 67
diff changeset
970 or don't iterate at all if there is no wider mode. */
kono
parents: 67
diff changeset
971 #define FOR_EACH_WIDER_MODE(ITERATOR, START) \
kono
parents: 67
diff changeset
972 for ((ITERATOR) = (START), mode_iterator::get_wider (&(ITERATOR)); \
kono
parents: 67
diff changeset
973 mode_iterator::iterate_p (&(ITERATOR)); \
kono
parents: 67
diff changeset
974 mode_iterator::get_wider (&(ITERATOR)))
kono
parents: 67
diff changeset
975
kono
parents: 67
diff changeset
976 /* Make ITERATOR iterate over modes in the same class as MODE, in order
kono
parents: 67
diff changeset
977 of increasing width, and with each mode being twice the width of the
kono
parents: 67
diff changeset
978 previous mode. Start at the mode that is two times wider than START,
kono
parents: 67
diff changeset
979 or don't iterate at all if there is no such mode. */
kono
parents: 67
diff changeset
980 #define FOR_EACH_2XWIDER_MODE(ITERATOR, START) \
kono
parents: 67
diff changeset
981 for ((ITERATOR) = (START), mode_iterator::get_2xwider (&(ITERATOR)); \
kono
parents: 67
diff changeset
982 mode_iterator::iterate_p (&(ITERATOR)); \
kono
parents: 67
diff changeset
983 mode_iterator::get_2xwider (&(ITERATOR)))
kono
parents: 67
diff changeset
984
kono
parents: 67
diff changeset
985 template<typename T>
kono
parents: 67
diff changeset
986 void
kono
parents: 67
diff changeset
987 gt_ggc_mx (pod_mode<T> *)
kono
parents: 67
diff changeset
988 {
kono
parents: 67
diff changeset
989 }
kono
parents: 67
diff changeset
990
kono
parents: 67
diff changeset
991 template<typename T>
kono
parents: 67
diff changeset
992 void
kono
parents: 67
diff changeset
993 gt_pch_nx (pod_mode<T> *)
kono
parents: 67
diff changeset
994 {
kono
parents: 67
diff changeset
995 }
kono
parents: 67
diff changeset
996
kono
parents: 67
diff changeset
997 template<typename T>
kono
parents: 67
diff changeset
998 void
kono
parents: 67
diff changeset
999 gt_pch_nx (pod_mode<T> *, void (*) (void *, void *), void *)
kono
parents: 67
diff changeset
1000 {
kono
parents: 67
diff changeset
1001 }
kono
parents: 67
diff changeset
1002
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1003 #endif /* not HAVE_MACHINE_MODES */