defaults.h (LOG2_BITS_PER_UNIT): Move from here...
[platform/upstream/gcc.git] / gcc / tree.h
1 /* Definitions for the ubiquitous 'tree' type for GNU compilers.
2    Copyright (C) 1989-2016 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3.  If not see
18 <http://www.gnu.org/licenses/>.  */
19
20 #ifndef GCC_TREE_H
21 #define GCC_TREE_H
22
23 #include "tree-core.h"
24
25 /* Convert a target-independent built-in function code to a combined_fn.  */
26
27 inline combined_fn
28 as_combined_fn (built_in_function fn)
29 {
30   return combined_fn (int (fn));
31 }
32
33 /* Convert an internal function code to a combined_fn.  */
34
35 inline combined_fn
36 as_combined_fn (internal_fn fn)
37 {
38   return combined_fn (int (fn) + int (END_BUILTINS));
39 }
40
41 /* Return true if CODE is a target-independent built-in function.  */
42
43 inline bool
44 builtin_fn_p (combined_fn code)
45 {
46   return int (code) < int (END_BUILTINS);
47 }
48
49 /* Return the target-independent built-in function represented by CODE.
50    Only valid if builtin_fn_p (CODE).  */
51
52 inline built_in_function
53 as_builtin_fn (combined_fn code)
54 {
55   gcc_checking_assert (builtin_fn_p (code));
56   return built_in_function (int (code));
57 }
58
59 /* Return true if CODE is an internal function.  */
60
61 inline bool
62 internal_fn_p (combined_fn code)
63 {
64   return int (code) >= int (END_BUILTINS);
65 }
66
67 /* Return the internal function represented by CODE.  Only valid if
68    internal_fn_p (CODE).  */
69
70 inline internal_fn
71 as_internal_fn (combined_fn code)
72 {
73   gcc_checking_assert (internal_fn_p (code));
74   return internal_fn (int (code) - int (END_BUILTINS));
75 }
76
77 /* Macros for initializing `tree_contains_struct'.  */
78 #define MARK_TS_BASE(C)                                 \
79   do {                                                  \
80     tree_contains_struct[C][TS_BASE] = 1;               \
81   } while (0)
82
83 #define MARK_TS_TYPED(C)                                \
84   do {                                                  \
85     MARK_TS_BASE (C);                                   \
86     tree_contains_struct[C][TS_TYPED] = 1;              \
87   } while (0)
88
89 #define MARK_TS_COMMON(C)                               \
90   do {                                                  \
91     MARK_TS_TYPED (C);                                  \
92     tree_contains_struct[C][TS_COMMON] = 1;             \
93   } while (0)
94
95 #define MARK_TS_TYPE_COMMON(C)                          \
96   do {                                                  \
97     MARK_TS_COMMON (C);                                 \
98     tree_contains_struct[C][TS_TYPE_COMMON] = 1;        \
99   } while (0)
100
101 #define MARK_TS_TYPE_WITH_LANG_SPECIFIC(C)              \
102   do {                                                  \
103     MARK_TS_TYPE_COMMON (C);                            \
104     tree_contains_struct[C][TS_TYPE_WITH_LANG_SPECIFIC] = 1;    \
105   } while (0)
106
107 #define MARK_TS_DECL_MINIMAL(C)                         \
108   do {                                                  \
109     MARK_TS_COMMON (C);                                 \
110     tree_contains_struct[C][TS_DECL_MINIMAL] = 1;       \
111   } while (0)
112
113 #define MARK_TS_DECL_COMMON(C)                          \
114   do {                                                  \
115     MARK_TS_DECL_MINIMAL (C);                           \
116     tree_contains_struct[C][TS_DECL_COMMON] = 1;        \
117   } while (0)
118
119 #define MARK_TS_DECL_WRTL(C)                            \
120   do {                                                  \
121     MARK_TS_DECL_COMMON (C);                            \
122     tree_contains_struct[C][TS_DECL_WRTL] = 1;          \
123   } while (0)
124
125 #define MARK_TS_DECL_WITH_VIS(C)                        \
126   do {                                                  \
127     MARK_TS_DECL_WRTL (C);                              \
128     tree_contains_struct[C][TS_DECL_WITH_VIS] = 1;      \
129   } while (0)
130
131 #define MARK_TS_DECL_NON_COMMON(C)                      \
132   do {                                                  \
133     MARK_TS_DECL_WITH_VIS (C);                          \
134     tree_contains_struct[C][TS_DECL_NON_COMMON] = 1;    \
135   } while (0)
136
137
138 /* Returns the string representing CLASS.  */
139
140 #define TREE_CODE_CLASS_STRING(CLASS)\
141         tree_code_class_strings[(int) (CLASS)]
142
143 #define TREE_CODE_CLASS(CODE)   tree_code_type[(int) (CODE)]
144
145 /* Nonzero if NODE represents an exceptional code.  */
146
147 #define EXCEPTIONAL_CLASS_P(NODE)\
148         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_exceptional)
149
150 /* Nonzero if NODE represents a constant.  */
151
152 #define CONSTANT_CLASS_P(NODE)\
153         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant)
154
155 /* Nonzero if NODE represents a type.  */
156
157 #define TYPE_P(NODE)\
158         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_type)
159
160 /* Nonzero if NODE represents a declaration.  */
161
162 #define DECL_P(NODE)\
163         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_declaration)
164
165 /* True if NODE designates a variable declaration.  */
166 #define VAR_P(NODE) \
167   (TREE_CODE (NODE) == VAR_DECL)
168
169 /* Nonzero if DECL represents a VAR_DECL or FUNCTION_DECL.  */
170
171 #define VAR_OR_FUNCTION_DECL_P(DECL)\
172   (TREE_CODE (DECL) == VAR_DECL || TREE_CODE (DECL) == FUNCTION_DECL)
173
174 /* Nonzero if NODE represents a INDIRECT_REF.  Keep these checks in
175    ascending code order.  */
176
177 #define INDIRECT_REF_P(NODE)\
178   (TREE_CODE (NODE) == INDIRECT_REF)
179
180 /* Nonzero if NODE represents a reference.  */
181
182 #define REFERENCE_CLASS_P(NODE)\
183         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_reference)
184
185 /* Nonzero if NODE represents a comparison.  */
186
187 #define COMPARISON_CLASS_P(NODE)\
188         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_comparison)
189
190 /* Nonzero if NODE represents a unary arithmetic expression.  */
191
192 #define UNARY_CLASS_P(NODE)\
193         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_unary)
194
195 /* Nonzero if NODE represents a binary arithmetic expression.  */
196
197 #define BINARY_CLASS_P(NODE)\
198         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_binary)
199
200 /* Nonzero if NODE represents a statement expression.  */
201
202 #define STATEMENT_CLASS_P(NODE)\
203         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_statement)
204
205 /* Nonzero if NODE represents a function call-like expression with a
206    variable-length operand vector.  */
207
208 #define VL_EXP_CLASS_P(NODE)\
209         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_vl_exp)
210
211 /* Nonzero if NODE represents any other expression.  */
212
213 #define EXPRESSION_CLASS_P(NODE)\
214         (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_expression)
215
216 /* Returns nonzero iff NODE represents a type or declaration.  */
217
218 #define IS_TYPE_OR_DECL_P(NODE)\
219         (TYPE_P (NODE) || DECL_P (NODE))
220
221 /* Returns nonzero iff CLASS is the tree-code class of an
222    expression.  */
223
224 #define IS_EXPR_CODE_CLASS(CLASS)\
225         ((CLASS) >= tcc_reference && (CLASS) <= tcc_expression)
226
227 /* Returns nonzero iff NODE is an expression of some kind.  */
228
229 #define EXPR_P(NODE) IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))
230
231 #define TREE_CODE_LENGTH(CODE)  tree_code_length[(int) (CODE)]
232
233
234 /* Helper macros for math builtins.  */
235
236 #define CASE_FLT_FN(FN) case FN: case FN##F: case FN##L
237 #define CASE_FLT_FN_REENT(FN) case FN##_R: case FN##F_R: case FN##L_R
238 #define CASE_INT_FN(FN) case FN: case FN##L: case FN##LL: case FN##IMAX
239
240 #define NULL_TREE (tree) NULL
241
242 /* Define accessors for the fields that all tree nodes have
243    (though some fields are not used for all kinds of nodes).  */
244
245 /* The tree-code says what kind of node it is.
246    Codes are defined in tree.def.  */
247 #define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code)
248 #define TREE_SET_CODE(NODE, VALUE) ((NODE)->base.code = (VALUE))
249
250 /* When checking is enabled, errors will be generated if a tree node
251    is accessed incorrectly. The macros die with a fatal error.  */
252 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
253
254 #define TREE_CHECK(T, CODE) \
255 (tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
256
257 #define TREE_NOT_CHECK(T, CODE) \
258 (tree_not_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE)))
259
260 #define TREE_CHECK2(T, CODE1, CODE2) \
261 (tree_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2)))
262
263 #define TREE_NOT_CHECK2(T, CODE1, CODE2) \
264 (tree_not_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2)))
265
266 #define TREE_CHECK3(T, CODE1, CODE2, CODE3) \
267 (tree_check3 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2), (CODE3)))
268
269 #define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) \
270 (tree_not_check3 ((T), __FILE__, __LINE__, __FUNCTION__, \
271                                (CODE1), (CODE2), (CODE3)))
272
273 #define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \
274 (tree_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \
275                            (CODE1), (CODE2), (CODE3), (CODE4)))
276
277 #define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \
278 (tree_not_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \
279                                (CODE1), (CODE2), (CODE3), (CODE4)))
280
281 #define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \
282 (tree_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \
283                            (CODE1), (CODE2), (CODE3), (CODE4), (CODE5)))
284
285 #define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \
286 (tree_not_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \
287                                (CODE1), (CODE2), (CODE3), (CODE4), (CODE5)))
288
289 #define CONTAINS_STRUCT_CHECK(T, STRUCT) \
290 (contains_struct_check ((T), (STRUCT), __FILE__, __LINE__, __FUNCTION__))
291
292 #define TREE_CLASS_CHECK(T, CLASS) \
293 (tree_class_check ((T), (CLASS), __FILE__, __LINE__, __FUNCTION__))
294
295 #define TREE_RANGE_CHECK(T, CODE1, CODE2) \
296 (tree_range_check ((T), (CODE1), (CODE2), __FILE__, __LINE__, __FUNCTION__))
297
298 #define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) \
299 (omp_clause_subcode_check ((T), (CODE), __FILE__, __LINE__, __FUNCTION__))
300
301 #define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) \
302 (omp_clause_range_check ((T), (CODE1), (CODE2), \
303                                       __FILE__, __LINE__, __FUNCTION__))
304
305 /* These checks have to be special cased.  */
306 #define EXPR_CHECK(T) \
307 (expr_check ((T), __FILE__, __LINE__, __FUNCTION__))
308
309 /* These checks have to be special cased.  */
310 #define NON_TYPE_CHECK(T) \
311 (non_type_check ((T), __FILE__, __LINE__, __FUNCTION__))
312
313 /* These checks have to be special cased.  */
314 #define ANY_INTEGRAL_TYPE_CHECK(T) \
315 (any_integral_type_check ((T), __FILE__, __LINE__, __FUNCTION__))
316
317 #define TREE_INT_CST_ELT_CHECK(T, I) \
318 (*tree_int_cst_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))
319
320 #define TREE_VEC_ELT_CHECK(T, I) \
321 (*(CONST_CAST2 (tree *, typeof (T)*, \
322      tree_vec_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))))
323
324 #define OMP_CLAUSE_ELT_CHECK(T, I) \
325 (*(omp_clause_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__)))
326
327 /* Special checks for TREE_OPERANDs.  */
328 #define TREE_OPERAND_CHECK(T, I) \
329 (*(CONST_CAST2 (tree*, typeof (T)*, \
330      tree_operand_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))))
331
332 #define TREE_OPERAND_CHECK_CODE(T, CODE, I) \
333 (*(tree_operand_check_code ((T), (CODE), (I), \
334                                          __FILE__, __LINE__, __FUNCTION__)))
335
336 /* Nodes are chained together for many purposes.
337    Types are chained together to record them for being output to the debugger
338    (see the function `chain_type').
339    Decls in the same scope are chained together to record the contents
340    of the scope.
341    Statement nodes for successive statements used to be chained together.
342    Often lists of things are represented by TREE_LIST nodes that
343    are chained together.  */
344
345 #define TREE_CHAIN(NODE) \
346 (CONTAINS_STRUCT_CHECK (NODE, TS_COMMON)->common.chain)
347
348 /* In all nodes that are expressions, this is the data type of the expression.
349    In POINTER_TYPE nodes, this is the type that the pointer points to.
350    In ARRAY_TYPE nodes, this is the type of the elements.
351    In VECTOR_TYPE nodes, this is the type of the elements.  */
352 #define TREE_TYPE(NODE) \
353 (CONTAINS_STRUCT_CHECK (NODE, TS_TYPED)->typed.type)
354
355 extern void tree_contains_struct_check_failed (const_tree,
356                                                const enum tree_node_structure_enum,
357                                                const char *, int, const char *)
358   ATTRIBUTE_NORETURN;
359
360 extern void tree_check_failed (const_tree, const char *, int, const char *,
361                                ...) ATTRIBUTE_NORETURN;
362 extern void tree_not_check_failed (const_tree, const char *, int, const char *,
363                                    ...) ATTRIBUTE_NORETURN;
364 extern void tree_class_check_failed (const_tree, const enum tree_code_class,
365                                      const char *, int, const char *)
366     ATTRIBUTE_NORETURN;
367 extern void tree_range_check_failed (const_tree, const char *, int,
368                                      const char *, enum tree_code,
369                                      enum tree_code)
370     ATTRIBUTE_NORETURN;
371 extern void tree_not_class_check_failed (const_tree,
372                                          const enum tree_code_class,
373                                          const char *, int, const char *)
374     ATTRIBUTE_NORETURN;
375 extern void tree_int_cst_elt_check_failed (int, int, const char *,
376                                            int, const char *)
377     ATTRIBUTE_NORETURN;
378 extern void tree_vec_elt_check_failed (int, int, const char *,
379                                        int, const char *)
380     ATTRIBUTE_NORETURN;
381 extern void phi_node_elt_check_failed (int, int, const char *,
382                                        int, const char *)
383     ATTRIBUTE_NORETURN;
384 extern void tree_operand_check_failed (int, const_tree,
385                                        const char *, int, const char *)
386     ATTRIBUTE_NORETURN;
387 extern void omp_clause_check_failed (const_tree, const char *, int,
388                                      const char *, enum omp_clause_code)
389     ATTRIBUTE_NORETURN;
390 extern void omp_clause_operand_check_failed (int, const_tree, const char *,
391                                              int, const char *)
392     ATTRIBUTE_NORETURN;
393 extern void omp_clause_range_check_failed (const_tree, const char *, int,
394                                const char *, enum omp_clause_code,
395                                enum omp_clause_code)
396     ATTRIBUTE_NORETURN;
397
398 #else /* not ENABLE_TREE_CHECKING, or not gcc */
399
400 #define CONTAINS_STRUCT_CHECK(T, ENUM)          (T)
401 #define TREE_CHECK(T, CODE)                     (T)
402 #define TREE_NOT_CHECK(T, CODE)                 (T)
403 #define TREE_CHECK2(T, CODE1, CODE2)            (T)
404 #define TREE_NOT_CHECK2(T, CODE1, CODE2)        (T)
405 #define TREE_CHECK3(T, CODE1, CODE2, CODE3)     (T)
406 #define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) (T)
407 #define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
408 #define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
409 #define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
410 #define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
411 #define TREE_CLASS_CHECK(T, CODE)               (T)
412 #define TREE_RANGE_CHECK(T, CODE1, CODE2)       (T)
413 #define EXPR_CHECK(T)                           (T)
414 #define NON_TYPE_CHECK(T)                       (T)
415 #define TREE_INT_CST_ELT_CHECK(T, I)            ((T)->int_cst.val[I])
416 #define TREE_VEC_ELT_CHECK(T, I)                ((T)->vec.a[I])
417 #define TREE_OPERAND_CHECK(T, I)                ((T)->exp.operands[I])
418 #define TREE_OPERAND_CHECK_CODE(T, CODE, I)     ((T)->exp.operands[I])
419 #define OMP_CLAUSE_ELT_CHECK(T, i)              ((T)->omp_clause.ops[i])
420 #define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T)
421 #define OMP_CLAUSE_SUBCODE_CHECK(T, CODE)       (T)
422 #define ANY_INTEGRAL_TYPE_CHECK(T)              (T)
423
424 #define TREE_CHAIN(NODE) ((NODE)->common.chain)
425 #define TREE_TYPE(NODE) ((NODE)->typed.type)
426
427 #endif
428
429 #define TREE_BLOCK(NODE)                (tree_block (NODE))
430 #define TREE_SET_BLOCK(T, B)            (tree_set_block ((T), (B)))
431
432 #include "tree-check.h"
433
434 #define TYPE_CHECK(T)           TREE_CLASS_CHECK (T, tcc_type)
435 #define DECL_MINIMAL_CHECK(T)   CONTAINS_STRUCT_CHECK (T, TS_DECL_MINIMAL)
436 #define DECL_COMMON_CHECK(T)    CONTAINS_STRUCT_CHECK (T, TS_DECL_COMMON)
437 #define DECL_WRTL_CHECK(T)      CONTAINS_STRUCT_CHECK (T, TS_DECL_WRTL)
438 #define DECL_WITH_VIS_CHECK(T)  CONTAINS_STRUCT_CHECK (T, TS_DECL_WITH_VIS)
439 #define DECL_NON_COMMON_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_NON_COMMON)
440 #define CST_CHECK(T)            TREE_CLASS_CHECK (T, tcc_constant)
441 #define STMT_CHECK(T)           TREE_CLASS_CHECK (T, tcc_statement)
442 #define VL_EXP_CHECK(T)         TREE_CLASS_CHECK (T, tcc_vl_exp)
443 #define FUNC_OR_METHOD_CHECK(T) TREE_CHECK2 (T, FUNCTION_TYPE, METHOD_TYPE)
444 #define PTR_OR_REF_CHECK(T)     TREE_CHECK2 (T, POINTER_TYPE, REFERENCE_TYPE)
445
446 #define RECORD_OR_UNION_CHECK(T)        \
447   TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
448 #define NOT_RECORD_OR_UNION_CHECK(T) \
449   TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE)
450
451 #define NUMERICAL_TYPE_CHECK(T)                                 \
452   TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE, \
453                FIXED_POINT_TYPE)
454
455 /* Here is how primitive or already-canonicalized types' hash codes
456    are made.  */
457 #define TYPE_HASH(TYPE) (TYPE_UID (TYPE))
458
459 /* A simple hash function for an arbitrary tree node.  This must not be
460    used in hash tables which are saved to a PCH.  */
461 #define TREE_HASH(NODE) ((size_t) (NODE) & 0777777)
462
463 /* Tests if CODE is a conversion expr (NOP_EXPR or CONVERT_EXPR).  */
464 #define CONVERT_EXPR_CODE_P(CODE)                               \
465   ((CODE) == NOP_EXPR || (CODE) == CONVERT_EXPR)
466
467 /* Similarly, but accept an expression instead of a tree code.  */
468 #define CONVERT_EXPR_P(EXP)     CONVERT_EXPR_CODE_P (TREE_CODE (EXP))
469
470 /* Generate case for NOP_EXPR, CONVERT_EXPR.  */
471
472 #define CASE_CONVERT                                            \
473   case NOP_EXPR:                                                \
474   case CONVERT_EXPR
475
476 /* Given an expression as a tree, strip any conversion that generates
477    no instruction.  Accepts both tree and const_tree arguments since
478    we are not modifying the tree itself.  */
479
480 #define STRIP_NOPS(EXP) \
481   (EXP) = tree_strip_nop_conversions (CONST_CAST_TREE (EXP))
482
483 /* Like STRIP_NOPS, but don't let the signedness change either.  */
484
485 #define STRIP_SIGN_NOPS(EXP) \
486   (EXP) = tree_strip_sign_nop_conversions (CONST_CAST_TREE (EXP))
487
488 /* Like STRIP_NOPS, but don't alter the TREE_TYPE either.  */
489
490 #define STRIP_TYPE_NOPS(EXP) \
491   while ((CONVERT_EXPR_P (EXP)                                  \
492           || TREE_CODE (EXP) == NON_LVALUE_EXPR)                \
493          && TREE_OPERAND (EXP, 0) != error_mark_node            \
494          && (TREE_TYPE (EXP)                                    \
495              == TREE_TYPE (TREE_OPERAND (EXP, 0))))             \
496     (EXP) = TREE_OPERAND (EXP, 0)
497
498 /* Remove unnecessary type conversions according to
499    tree_ssa_useless_type_conversion.  */
500
501 #define STRIP_USELESS_TYPE_CONVERSION(EXP) \
502   (EXP) = tree_ssa_strip_useless_type_conversions (EXP)
503
504 /* Nonzero if TYPE represents a vector type.  */
505
506 #define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE)
507
508 /* Nonzero if TYPE represents a vector of booleans.  */
509
510 #define VECTOR_BOOLEAN_TYPE_P(TYPE)                             \
511   (TREE_CODE (TYPE) == VECTOR_TYPE                      \
512    && TREE_CODE (TREE_TYPE (TYPE)) == BOOLEAN_TYPE)
513
514 /* Nonzero if TYPE represents an integral type.  Note that we do not
515    include COMPLEX types here.  Keep these checks in ascending code
516    order.  */
517
518 #define INTEGRAL_TYPE_P(TYPE)  \
519   (TREE_CODE (TYPE) == ENUMERAL_TYPE  \
520    || TREE_CODE (TYPE) == BOOLEAN_TYPE \
521    || TREE_CODE (TYPE) == INTEGER_TYPE)
522
523 /* Nonzero if TYPE represents an integral type, including complex
524    and vector integer types.  */
525
526 #define ANY_INTEGRAL_TYPE_P(TYPE)               \
527   (INTEGRAL_TYPE_P (TYPE)                       \
528    || ((TREE_CODE (TYPE) == COMPLEX_TYPE        \
529         || VECTOR_TYPE_P (TYPE))                \
530        && INTEGRAL_TYPE_P (TREE_TYPE (TYPE))))
531
532 /* Nonzero if TYPE represents a non-saturating fixed-point type.  */
533
534 #define NON_SAT_FIXED_POINT_TYPE_P(TYPE) \
535   (TREE_CODE (TYPE) == FIXED_POINT_TYPE && !TYPE_SATURATING (TYPE))
536
537 /* Nonzero if TYPE represents a saturating fixed-point type.  */
538
539 #define SAT_FIXED_POINT_TYPE_P(TYPE) \
540   (TREE_CODE (TYPE) == FIXED_POINT_TYPE && TYPE_SATURATING (TYPE))
541
542 /* Nonzero if TYPE represents a fixed-point type.  */
543
544 #define FIXED_POINT_TYPE_P(TYPE)        (TREE_CODE (TYPE) == FIXED_POINT_TYPE)
545
546 /* Nonzero if TYPE represents a scalar floating-point type.  */
547
548 #define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE)
549
550 /* Nonzero if TYPE represents a complex floating-point type.  */
551
552 #define COMPLEX_FLOAT_TYPE_P(TYPE)      \
553   (TREE_CODE (TYPE) == COMPLEX_TYPE     \
554    && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
555
556 /* Nonzero if TYPE represents a vector integer type.  */
557                 
558 #define VECTOR_INTEGER_TYPE_P(TYPE)                     \
559   (VECTOR_TYPE_P (TYPE)                                 \
560    && TREE_CODE (TREE_TYPE (TYPE)) == INTEGER_TYPE)
561
562
563 /* Nonzero if TYPE represents a vector floating-point type.  */
564
565 #define VECTOR_FLOAT_TYPE_P(TYPE)       \
566   (VECTOR_TYPE_P (TYPE)                 \
567    && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
568
569 /* Nonzero if TYPE represents a floating-point type, including complex
570    and vector floating-point types.  The vector and complex check does
571    not use the previous two macros to enable early folding.  */
572
573 #define FLOAT_TYPE_P(TYPE)                      \
574   (SCALAR_FLOAT_TYPE_P (TYPE)                   \
575    || ((TREE_CODE (TYPE) == COMPLEX_TYPE        \
576         || VECTOR_TYPE_P (TYPE))                \
577        && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TYPE))))
578
579 /* Nonzero if TYPE represents a decimal floating-point type.  */
580 #define DECIMAL_FLOAT_TYPE_P(TYPE)              \
581   (SCALAR_FLOAT_TYPE_P (TYPE)                   \
582    && DECIMAL_FLOAT_MODE_P (TYPE_MODE (TYPE)))
583
584 /* Nonzero if TYPE is a record or union type.  */
585 #define RECORD_OR_UNION_TYPE_P(TYPE)            \
586   (TREE_CODE (TYPE) == RECORD_TYPE              \
587    || TREE_CODE (TYPE) == UNION_TYPE            \
588    || TREE_CODE (TYPE) == QUAL_UNION_TYPE)
589
590 /* Nonzero if TYPE represents an aggregate (multi-component) type.
591    Keep these checks in ascending code order.  */
592
593 #define AGGREGATE_TYPE_P(TYPE) \
594   (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE))
595
596 /* Nonzero if TYPE represents a pointer or reference type.
597    (It should be renamed to INDIRECT_TYPE_P.)  Keep these checks in
598    ascending code order.  */
599
600 #define POINTER_TYPE_P(TYPE) \
601   (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE)
602
603 /* Nonzero if TYPE represents a pointer to function.  */
604 #define FUNCTION_POINTER_TYPE_P(TYPE) \
605   (POINTER_TYPE_P (TYPE) && TREE_CODE (TREE_TYPE (TYPE)) == FUNCTION_TYPE)
606
607 /* Nonzero if this type is a complete type.  */
608 #define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
609
610 /* Nonzero if this type is a pointer bounds type.  */
611 #define POINTER_BOUNDS_TYPE_P(NODE) \
612   (TREE_CODE (NODE) == POINTER_BOUNDS_TYPE)
613
614 /* Nonzero if this node has a pointer bounds type.  */
615 #define POINTER_BOUNDS_P(NODE) \
616   (POINTER_BOUNDS_TYPE_P (TREE_TYPE (NODE)))
617
618 /* Nonzero if this type supposes bounds existence.  */
619 #define BOUNDED_TYPE_P(type) (POINTER_TYPE_P (type))
620
621 /* Nonzero for objects with bounded type.  */
622 #define BOUNDED_P(node) \
623   BOUNDED_TYPE_P (TREE_TYPE (node))
624
625 /* Nonzero if this type is the (possibly qualified) void type.  */
626 #define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE)
627
628 /* Nonzero if this type is complete or is cv void.  */
629 #define COMPLETE_OR_VOID_TYPE_P(NODE) \
630   (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE))
631
632 /* Nonzero if this type is complete or is an array with unspecified bound.  */
633 #define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
634   (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE)))
635
636 #define FUNC_OR_METHOD_TYPE_P(NODE) \
637   (TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE)
638
639 /* Define many boolean fields that all tree nodes have.  */
640
641 /* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means address
642    of this is needed.  So it cannot be in a register.
643    In a FUNCTION_DECL it has no meaning.
644    In LABEL_DECL nodes, it means a goto for this label has been seen
645    from a place outside all binding contours that restore stack levels.
646    In an artificial SSA_NAME that points to a stack partition with at least
647    two variables, it means that at least one variable has TREE_ADDRESSABLE.
648    In ..._TYPE nodes, it means that objects of this type must be fully
649    addressable.  This means that pieces of this object cannot go into
650    register parameters, for example.  If this a function type, this
651    means that the value must be returned in memory.
652    In CONSTRUCTOR nodes, it means object constructed must be in memory.
653    In IDENTIFIER_NODEs, this means that some extern decl for this name
654    had its address taken.  That matters for inline functions.
655    In a STMT_EXPR, it means we want the result of the enclosed expression.  */
656 #define TREE_ADDRESSABLE(NODE) ((NODE)->base.addressable_flag)
657
658 /* Set on a CALL_EXPR if the call is in a tail position, ie. just before the
659    exit of a function.  Calls for which this is true are candidates for tail
660    call optimizations.  */
661 #define CALL_EXPR_TAILCALL(NODE) \
662   (CALL_EXPR_CHECK (NODE)->base.addressable_flag)
663
664 /* Set on a CALL_EXPR if the call has been marked as requiring tail call
665    optimization for correctness.  */
666 #define CALL_EXPR_MUST_TAIL_CALL(NODE) \
667   (CALL_EXPR_CHECK (NODE)->base.static_flag)
668
669 /* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the
670    CASE_LOW operand has been processed.  */
671 #define CASE_LOW_SEEN(NODE) \
672   (CASE_LABEL_EXPR_CHECK (NODE)->base.addressable_flag)
673
674 #define PREDICT_EXPR_OUTCOME(NODE) \
675   ((enum prediction) (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag))
676 #define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \
677   (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag = (int) OUTCOME)
678 #define PREDICT_EXPR_PREDICTOR(NODE) \
679   ((enum br_predictor)tree_to_shwi (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0)))
680
681 /* In a VAR_DECL, nonzero means allocate static storage.
682    In a FUNCTION_DECL, nonzero if function has been defined.
683    In a CONSTRUCTOR, nonzero means allocate static storage.  */
684 #define TREE_STATIC(NODE) ((NODE)->base.static_flag)
685
686 /* In an ADDR_EXPR, nonzero means do not use a trampoline.  */
687 #define TREE_NO_TRAMPOLINE(NODE) (ADDR_EXPR_CHECK (NODE)->base.static_flag)
688
689 /* In a TARGET_EXPR or WITH_CLEANUP_EXPR, means that the pertinent cleanup
690    should only be executed if an exception is thrown, not on normal exit
691    of its scope.  */
692 #define CLEANUP_EH_ONLY(NODE) ((NODE)->base.static_flag)
693
694 /* In a TRY_CATCH_EXPR, means that the handler should be considered a
695    separate cleanup in honor_protect_cleanup_actions.  */
696 #define TRY_CATCH_IS_CLEANUP(NODE) \
697   (TRY_CATCH_EXPR_CHECK (NODE)->base.static_flag)
698
699 /* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the
700    CASE_HIGH operand has been processed.  */
701 #define CASE_HIGH_SEEN(NODE) \
702   (CASE_LABEL_EXPR_CHECK (NODE)->base.static_flag)
703
704 /* Used to mark scoped enums.  */
705 #define ENUM_IS_SCOPED(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.static_flag)
706
707 /* Determines whether an ENUMERAL_TYPE has defined the list of constants. */
708 #define ENUM_IS_OPAQUE(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.private_flag)
709
710 /* In an expr node (usually a conversion) this means the node was made
711    implicitly and should not lead to any sort of warning.  In a decl node,
712    warnings concerning the decl should be suppressed.  This is used at
713    least for used-before-set warnings, and it set after one warning is
714    emitted.  */
715 #define TREE_NO_WARNING(NODE) ((NODE)->base.nowarning_flag)
716
717 /* Used to indicate that this TYPE represents a compiler-generated entity.  */
718 #define TYPE_ARTIFICIAL(NODE) (TYPE_CHECK (NODE)->base.nowarning_flag)
719
720 /* In an IDENTIFIER_NODE, this means that assemble_name was called with
721    this string as an argument.  */
722 #define TREE_SYMBOL_REFERENCED(NODE) \
723   (IDENTIFIER_NODE_CHECK (NODE)->base.static_flag)
724
725 /* Nonzero in a pointer or reference type means the data pointed to
726    by this type can alias anything.  */
727 #define TYPE_REF_CAN_ALIAS_ALL(NODE) \
728   (PTR_OR_REF_CHECK (NODE)->base.static_flag)
729
730 /* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means
731    there was an overflow in folding.  */
732
733 #define TREE_OVERFLOW(NODE) (CST_CHECK (NODE)->base.public_flag)
734
735 /* TREE_OVERFLOW can only be true for EXPR of CONSTANT_CLASS_P.  */
736
737 #define TREE_OVERFLOW_P(EXPR) \
738  (CONSTANT_CLASS_P (EXPR) && TREE_OVERFLOW (EXPR))
739
740 /* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL,
741    nonzero means name is to be accessible from outside this translation unit.
742    In an IDENTIFIER_NODE, nonzero means an external declaration
743    accessible from outside this translation unit was previously seen
744    for this name in an inner scope.  */
745 #define TREE_PUBLIC(NODE) ((NODE)->base.public_flag)
746
747 /* In a _TYPE, indicates whether TYPE_CACHED_VALUES contains a vector
748    of cached values, or is something else.  */
749 #define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK (NODE)->base.public_flag)
750
751 /* In a SAVE_EXPR, indicates that the original expression has already
752    been substituted with a VAR_DECL that contains the value.  */
753 #define SAVE_EXPR_RESOLVED_P(NODE) \
754   (SAVE_EXPR_CHECK (NODE)->base.public_flag)
755
756 /* Set on a CALL_EXPR if this stdarg call should be passed the argument
757    pack.  */
758 #define CALL_EXPR_VA_ARG_PACK(NODE) \
759   (CALL_EXPR_CHECK (NODE)->base.public_flag)
760
761 /* In any expression, decl, or constant, nonzero means it has side effects or
762    reevaluation of the whole expression could produce a different value.
763    This is set if any subexpression is a function call, a side effect or a
764    reference to a volatile variable.  In a ..._DECL, this is set only if the
765    declaration said `volatile'.  This will never be set for a constant.  */
766 #define TREE_SIDE_EFFECTS(NODE) \
767   (NON_TYPE_CHECK (NODE)->base.side_effects_flag)
768
769 /* In a LABEL_DECL, nonzero means this label had its address taken
770    and therefore can never be deleted and is a jump target for
771    computed gotos.  */
772 #define FORCED_LABEL(NODE) (LABEL_DECL_CHECK (NODE)->base.side_effects_flag)
773
774 /* Nonzero means this expression is volatile in the C sense:
775    its address should be of type `volatile WHATEVER *'.
776    In other words, the declared item is volatile qualified.
777    This is used in _DECL nodes and _REF nodes.
778    On a FUNCTION_DECL node, this means the function does not
779    return normally.  This is the same effect as setting
780    the attribute noreturn on the function in C.
781
782    In a ..._TYPE node, means this type is volatile-qualified.
783    But use TYPE_VOLATILE instead of this macro when the node is a type,
784    because eventually we may make that a different bit.
785
786    If this bit is set in an expression, so is TREE_SIDE_EFFECTS.  */
787 #define TREE_THIS_VOLATILE(NODE) ((NODE)->base.volatile_flag)
788
789 /* Nonzero means this node will not trap.  In an INDIRECT_REF, means
790    accessing the memory pointed to won't generate a trap.  However,
791    this only applies to an object when used appropriately: it doesn't
792    mean that writing a READONLY mem won't trap.
793
794    In ARRAY_REF and ARRAY_RANGE_REF means that we know that the index
795    (or slice of the array) always belongs to the range of the array.
796    I.e. that the access will not trap, provided that the access to
797    the base to the array will not trap.  */
798 #define TREE_THIS_NOTRAP(NODE) \
799   (TREE_CHECK5 (NODE, INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, \
800                 ARRAY_RANGE_REF)->base.nothrow_flag)
801
802 /* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node,
803    nonzero means it may not be the lhs of an assignment.
804    Nonzero in a FUNCTION_DECL means this function should be treated
805    as "const" function (can only read its arguments).  */
806 #define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->base.readonly_flag)
807
808 /* Value of expression is constant.  Always on in all ..._CST nodes.  May
809    also appear in an expression or decl where the value is constant.  */
810 #define TREE_CONSTANT(NODE) (NON_TYPE_CHECK (NODE)->base.constant_flag)
811
812 /* Nonzero if NODE, a type, has had its sizes gimplified.  */
813 #define TYPE_SIZES_GIMPLIFIED(NODE) \
814   (TYPE_CHECK (NODE)->base.constant_flag)
815
816 /* In a decl (most significantly a FIELD_DECL), means an unsigned field.  */
817 #define DECL_UNSIGNED(NODE) \
818   (DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag)
819
820 /* In integral and pointer types, means an unsigned type.  */
821 #define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag)
822
823 /* Same as TYPE_UNSIGNED but converted to SIGNOP.  */
824 #define TYPE_SIGN(NODE) ((signop) TYPE_UNSIGNED (NODE))
825
826 /* True if overflow wraps around for the given integral type.  That
827    is, TYPE_MAX + 1 == TYPE_MIN.  */
828 #define TYPE_OVERFLOW_WRAPS(TYPE) \
829   (ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag || flag_wrapv)
830
831 /* True if overflow is undefined for the given integral type.  We may
832    optimize on the assumption that values in the type never overflow.
833
834    IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED
835    must issue a warning based on warn_strict_overflow.  In some cases
836    it will be appropriate to issue the warning immediately, and in
837    other cases it will be appropriate to simply set a flag and let the
838    caller decide whether a warning is appropriate or not.  */
839 #define TYPE_OVERFLOW_UNDEFINED(TYPE)                           \
840   (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag    \
841    && !flag_wrapv && !flag_trapv && flag_strict_overflow)
842
843 /* True if overflow for the given integral type should issue a
844    trap.  */
845 #define TYPE_OVERFLOW_TRAPS(TYPE) \
846   (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag && flag_trapv)
847
848 /* True if an overflow is to be preserved for sanitization.  */
849 #define TYPE_OVERFLOW_SANITIZED(TYPE)                   \
850   (INTEGRAL_TYPE_P (TYPE)                               \
851    && !TYPE_OVERFLOW_WRAPS (TYPE)                       \
852    && (flag_sanitize & SANITIZE_SI_OVERFLOW))
853
854 /* True if pointer types have undefined overflow.  */
855 #define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow)
856
857 /* Nonzero in a VAR_DECL or STRING_CST means assembler code has been written.
858    Nonzero in a FUNCTION_DECL means that the function has been compiled.
859    This is interesting in an inline function, since it might not need
860    to be compiled separately.
861    Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ENUMERAL_TYPE
862    or TYPE_DECL if the debugging info for the type has been written.
863    In a BLOCK node, nonzero if reorder_blocks has already seen this block.
864    In an SSA_NAME node, nonzero if the SSA_NAME occurs in an abnormal
865    PHI node.  */
866 #define TREE_ASM_WRITTEN(NODE) ((NODE)->base.asm_written_flag)
867
868 /* Nonzero in a _DECL if the name is used in its scope.
869    Nonzero in an expr node means inhibit warning if value is unused.
870    In IDENTIFIER_NODEs, this means that some extern decl for this name
871    was used.
872    In a BLOCK, this means that the block contains variables that are used.  */
873 #define TREE_USED(NODE) ((NODE)->base.used_flag)
874
875 /* In a FUNCTION_DECL, nonzero means a call to the function cannot
876    throw an exception.  In a CALL_EXPR, nonzero means the call cannot
877    throw.  We can't easily check the node type here as the C++
878    frontend also uses this flag (for AGGR_INIT_EXPR).  */
879 #define TREE_NOTHROW(NODE) ((NODE)->base.nothrow_flag)
880
881 /* In a CALL_EXPR, means that it's safe to use the target of the call
882    expansion as the return slot for a call that returns in memory.  */
883 #define CALL_EXPR_RETURN_SLOT_OPT(NODE) \
884   (CALL_EXPR_CHECK (NODE)->base.private_flag)
885
886 /* Cilk keywords accessors.  */
887 #define CILK_SPAWN_FN(NODE) TREE_OPERAND (CILK_SPAWN_STMT_CHECK (NODE), 0)
888
889 /* In a RESULT_DECL, PARM_DECL and VAR_DECL, means that it is
890    passed by invisible reference (and the TREE_TYPE is a pointer to the true
891    type).  */
892 #define DECL_BY_REFERENCE(NODE) \
893   (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, \
894                 RESULT_DECL)->decl_common.decl_by_reference_flag)
895
896 /* In VAR_DECL and PARM_DECL, set when the decl has been used except for
897    being set.  */
898 #define DECL_READ_P(NODE) \
899   (TREE_CHECK2 (NODE, VAR_DECL, PARM_DECL)->decl_common.decl_read_flag)
900
901 /* In VAR_DECL or RESULT_DECL, set when significant code movement precludes
902    attempting to share the stack slot with some other variable.  */
903 #define DECL_NONSHAREABLE(NODE) \
904   (TREE_CHECK2 (NODE, VAR_DECL, \
905                 RESULT_DECL)->decl_common.decl_nonshareable_flag)
906
907 /* In a CALL_EXPR, means that the call is the jump from a thunk to the
908    thunked-to function.  */
909 #define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag)
910
911 /* In a CALL_EXPR, if the function being called is BUILT_IN_ALLOCA, means that
912    it has been built for the declaration of a variable-sized object.  */
913 #define CALL_ALLOCA_FOR_VAR_P(NODE) \
914   (CALL_EXPR_CHECK (NODE)->base.protected_flag)
915
916 /* In a CALL_EXPR, means call was instrumented by Pointer Bounds Checker.  */
917 #define CALL_WITH_BOUNDS_P(NODE) (CALL_EXPR_CHECK (NODE)->base.deprecated_flag)
918
919 /* Used in classes in C++.  */
920 #define TREE_PRIVATE(NODE) ((NODE)->base.private_flag)
921 /* Used in classes in C++. */
922 #define TREE_PROTECTED(NODE) ((NODE)->base.protected_flag)
923
924 /* True if reference type NODE is a C++ rvalue reference.  */
925 #define TYPE_REF_IS_RVALUE(NODE) \
926   (REFERENCE_TYPE_CHECK (NODE)->base.private_flag)
927
928 /* Nonzero in a _DECL if the use of the name is defined as a
929    deprecated feature by __attribute__((deprecated)).  */
930 #define TREE_DEPRECATED(NODE) \
931   ((NODE)->base.deprecated_flag)
932
933 /* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
934    uses are to be substituted for uses of the TREE_CHAINed identifier.  */
935 #define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
936   (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
937
938 /* In an aggregate type, indicates that the scalar fields of the type are
939    stored in reverse order from the target order.  This effectively
940    toggles BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN within the type.  */
941 #define TYPE_REVERSE_STORAGE_ORDER(NODE) \
942   (TREE_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag)
943
944 /* In a non-aggregate type, indicates a saturating type.  */
945 #define TYPE_SATURATING(NODE) \
946   (TREE_NOT_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag)
947
948 /* In a BIT_FIELD_REF and MEM_REF, indicates that the reference is to a group
949    of bits stored in reverse order from the target order.  This effectively
950    toggles both BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN for the reference.
951
952    The overall strategy is to preserve the invariant that every scalar in
953    memory is associated with a single storage order, i.e. all accesses to
954    this scalar are done with the same storage order.  This invariant makes
955    it possible to factor out the storage order in most transformations, as
956    only the address and/or the value (in target order) matter for them.
957    But, of course, the storage order must be preserved when the accesses
958    themselves are rewritten or transformed.  */
959 #define REF_REVERSE_STORAGE_ORDER(NODE) \
960   (TREE_CHECK2 (NODE, BIT_FIELD_REF, MEM_REF)->base.default_def_flag)
961
962 /* These flags are available for each language front end to use internally.  */
963 #define TREE_LANG_FLAG_0(NODE) \
964   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0)
965 #define TREE_LANG_FLAG_1(NODE) \
966   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1)
967 #define TREE_LANG_FLAG_2(NODE) \
968   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2)
969 #define TREE_LANG_FLAG_3(NODE) \
970   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3)
971 #define TREE_LANG_FLAG_4(NODE) \
972   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4)
973 #define TREE_LANG_FLAG_5(NODE) \
974   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5)
975 #define TREE_LANG_FLAG_6(NODE) \
976   (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6)
977
978 /* Define additional fields and accessors for nodes representing constants.  */
979
980 #define TREE_INT_CST_NUNITS(NODE) \
981   (INTEGER_CST_CHECK (NODE)->base.u.int_length.unextended)
982 #define TREE_INT_CST_EXT_NUNITS(NODE) \
983   (INTEGER_CST_CHECK (NODE)->base.u.int_length.extended)
984 #define TREE_INT_CST_OFFSET_NUNITS(NODE) \
985   (INTEGER_CST_CHECK (NODE)->base.u.int_length.offset)
986 #define TREE_INT_CST_ELT(NODE, I) TREE_INT_CST_ELT_CHECK (NODE, I)
987 #define TREE_INT_CST_LOW(NODE) \
988   ((unsigned HOST_WIDE_INT) TREE_INT_CST_ELT (NODE, 0))
989
990 #define TREE_REAL_CST_PTR(NODE) (REAL_CST_CHECK (NODE)->real_cst.real_cst_ptr)
991 #define TREE_REAL_CST(NODE) (*TREE_REAL_CST_PTR (NODE))
992
993 #define TREE_FIXED_CST_PTR(NODE) \
994   (FIXED_CST_CHECK (NODE)->fixed_cst.fixed_cst_ptr)
995 #define TREE_FIXED_CST(NODE) (*TREE_FIXED_CST_PTR (NODE))
996
997 /* In a STRING_CST */
998 /* In C terms, this is sizeof, not strlen.  */
999 #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length)
1000 #define TREE_STRING_POINTER(NODE) \
1001   ((const char *)(STRING_CST_CHECK (NODE)->string.str))
1002
1003 /* In a COMPLEX_CST node.  */
1004 #define TREE_REALPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.real)
1005 #define TREE_IMAGPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.imag)
1006
1007 /* In a VECTOR_CST node.  */
1008 #define VECTOR_CST_NELTS(NODE) (TYPE_VECTOR_SUBPARTS (TREE_TYPE (NODE)))
1009 #define VECTOR_CST_ELTS(NODE) (VECTOR_CST_CHECK (NODE)->vector.elts)
1010 #define VECTOR_CST_ELT(NODE,IDX) (VECTOR_CST_CHECK (NODE)->vector.elts[IDX])
1011
1012 /* Define fields and accessors for some special-purpose tree nodes.  */
1013
1014 #define IDENTIFIER_LENGTH(NODE) \
1015   (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len)
1016 #define IDENTIFIER_POINTER(NODE) \
1017   ((const char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str)
1018 #define IDENTIFIER_HASH_VALUE(NODE) \
1019   (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.hash_value)
1020
1021 /* Translate a hash table identifier pointer to a tree_identifier
1022    pointer, and vice versa.  */
1023
1024 #define HT_IDENT_TO_GCC_IDENT(NODE) \
1025   ((tree) ((char *) (NODE) - sizeof (struct tree_common)))
1026 #define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NODE))->id)
1027
1028 /* In a TREE_LIST node.  */
1029 #define TREE_PURPOSE(NODE) (TREE_LIST_CHECK (NODE)->list.purpose)
1030 #define TREE_VALUE(NODE) (TREE_LIST_CHECK (NODE)->list.value)
1031
1032 /* In a TREE_VEC node.  */
1033 #define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->base.u.length)
1034 #define TREE_VEC_END(NODE) \
1035   ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.base.u.length]))
1036
1037 #define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I)
1038
1039 /* In a CONSTRUCTOR node.  */
1040 #define CONSTRUCTOR_ELTS(NODE) (CONSTRUCTOR_CHECK (NODE)->constructor.elts)
1041 #define CONSTRUCTOR_ELT(NODE,IDX) \
1042   (&(*CONSTRUCTOR_ELTS (NODE))[IDX])
1043 #define CONSTRUCTOR_NELTS(NODE) \
1044   (vec_safe_length (CONSTRUCTOR_ELTS (NODE)))
1045 #define CONSTRUCTOR_NO_CLEARING(NODE) \
1046   (CONSTRUCTOR_CHECK (NODE)->base.public_flag)
1047
1048 /* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding the
1049    value of each element (stored within VAL). IX must be a scratch variable
1050    of unsigned integer type.  */
1051 #define FOR_EACH_CONSTRUCTOR_VALUE(V, IX, VAL) \
1052   for (IX = 0; (IX >= vec_safe_length (V)) \
1053                ? false \
1054                : ((VAL = (*(V))[IX].value), \
1055                true); \
1056        (IX)++)
1057
1058 /* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding both
1059    the value of each element (stored within VAL) and its index (stored
1060    within INDEX). IX must be a scratch variable of unsigned integer type.  */
1061 #define FOR_EACH_CONSTRUCTOR_ELT(V, IX, INDEX, VAL) \
1062   for (IX = 0; (IX >= vec_safe_length (V)) \
1063                ? false \
1064                : (((void) (VAL = (*V)[IX].value)), \
1065                   (INDEX = (*V)[IX].index), \
1066                   true); \
1067        (IX)++)
1068
1069 /* Append a new constructor element to V, with the specified INDEX and VAL.  */
1070 #define CONSTRUCTOR_APPEND_ELT(V, INDEX, VALUE) \
1071   do { \
1072     constructor_elt _ce___ = {INDEX, VALUE}; \
1073     vec_safe_push ((V), _ce___); \
1074   } while (0)
1075
1076 /* True if NODE, a FIELD_DECL, is to be processed as a bitfield for
1077    constructor output purposes.  */
1078 #define CONSTRUCTOR_BITFIELD_P(NODE) \
1079   (DECL_BIT_FIELD (FIELD_DECL_CHECK (NODE)) && DECL_MODE (NODE) != BLKmode)
1080
1081 /* True if NODE is a clobber right hand side, an expression of indeterminate
1082    value that clobbers the LHS in a copy instruction.  We use a volatile
1083    empty CONSTRUCTOR for this, as it matches most of the necessary semantic.
1084    In particular the volatile flag causes us to not prematurely remove
1085    such clobber instructions.  */
1086 #define TREE_CLOBBER_P(NODE) \
1087   (TREE_CODE (NODE) == CONSTRUCTOR && TREE_THIS_VOLATILE (NODE))
1088
1089 /* Define fields and accessors for some nodes that represent expressions.  */
1090
1091 /* Nonzero if NODE is an empty statement (NOP_EXPR <0>).  */
1092 #define IS_EMPTY_STMT(NODE)     (TREE_CODE (NODE) == NOP_EXPR \
1093                                  && VOID_TYPE_P (TREE_TYPE (NODE)) \
1094                                  && integer_zerop (TREE_OPERAND (NODE, 0)))
1095
1096 /* In ordinary expression nodes.  */
1097 #define TREE_OPERAND_LENGTH(NODE) tree_operand_length (NODE)
1098 #define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I)
1099
1100 /* In a tcc_vl_exp node, operand 0 is an INT_CST node holding the operand
1101    length.  Its value includes the length operand itself; that is,
1102    the minimum valid length is 1.
1103    Note that we have to bypass the use of TREE_OPERAND to access
1104    that field to avoid infinite recursion in expanding the macros.  */
1105 #define VL_EXP_OPERAND_LENGTH(NODE) \
1106   ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0]))
1107
1108 /* Nonzero if is_gimple_debug() may possibly hold.  */
1109 #define MAY_HAVE_DEBUG_STMTS    (flag_var_tracking_assignments)
1110
1111 /* In a LOOP_EXPR node.  */
1112 #define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)
1113
1114 /* The source location of this expression.  Non-tree_exp nodes such as
1115    decls and constants can be shared among multiple locations, so
1116    return nothing.  */
1117 #define EXPR_LOCATION(NODE) \
1118   (CAN_HAVE_LOCATION_P ((NODE)) ? (NODE)->exp.locus : UNKNOWN_LOCATION)
1119 #define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))->exp.locus = (LOCUS)
1120 #define EXPR_HAS_LOCATION(NODE) (LOCATION_LOCUS (EXPR_LOCATION (NODE))  \
1121   != UNKNOWN_LOCATION)
1122 /* The location to be used in a diagnostic about this expression.  Do not
1123    use this macro if the location will be assigned to other expressions.  */
1124 #define EXPR_LOC_OR_LOC(NODE, LOCUS) (EXPR_HAS_LOCATION (NODE) \
1125                                       ? (NODE)->exp.locus : (LOCUS))
1126 #define EXPR_FILENAME(NODE) LOCATION_FILE (EXPR_CHECK ((NODE))->exp.locus)
1127 #define EXPR_LINENO(NODE) LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus)
1128
1129 #define CAN_HAVE_RANGE_P(NODE) (CAN_HAVE_LOCATION_P (NODE))
1130 #define EXPR_LOCATION_RANGE(NODE) (get_expr_source_range (EXPR_CHECK ((NODE))))
1131
1132 #define EXPR_HAS_RANGE(NODE) \
1133     (CAN_HAVE_RANGE_P (NODE) \
1134      ? EXPR_LOCATION_RANGE (NODE).m_start != UNKNOWN_LOCATION \
1135      : false)
1136
1137 /* True if a tree is an expression or statement that can have a
1138    location.  */
1139 #define CAN_HAVE_LOCATION_P(NODE) ((NODE) && EXPR_P (NODE))
1140
1141 static inline source_range
1142 get_expr_source_range (tree expr)
1143 {
1144   location_t loc = EXPR_LOCATION (expr);
1145   return get_range_from_loc (line_table, loc);
1146 }
1147
1148 extern void protected_set_expr_location (tree, location_t);
1149
1150 /* In a TARGET_EXPR node.  */
1151 #define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0)
1152 #define TARGET_EXPR_INITIAL(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 1)
1153 #define TARGET_EXPR_CLEANUP(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 2)
1154
1155 /* DECL_EXPR accessor. This gives access to the DECL associated with
1156    the given declaration statement.  */
1157 #define DECL_EXPR_DECL(NODE)    TREE_OPERAND (DECL_EXPR_CHECK (NODE), 0)
1158
1159 #define EXIT_EXPR_COND(NODE)         TREE_OPERAND (EXIT_EXPR_CHECK (NODE), 0)
1160
1161 /* COMPOUND_LITERAL_EXPR accessors.  */
1162 #define COMPOUND_LITERAL_EXPR_DECL_EXPR(NODE)           \
1163   TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0)
1164 #define COMPOUND_LITERAL_EXPR_DECL(NODE)                        \
1165   DECL_EXPR_DECL (COMPOUND_LITERAL_EXPR_DECL_EXPR (NODE))
1166
1167 /* SWITCH_EXPR accessors. These give access to the condition, body and
1168    original condition type (before any compiler conversions)
1169    of the switch statement, respectively.  */
1170 #define SWITCH_COND(NODE)       TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0)
1171 #define SWITCH_BODY(NODE)       TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1)
1172 #define SWITCH_LABELS(NODE)     TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 2)
1173
1174 /* CASE_LABEL_EXPR accessors. These give access to the high and low values
1175    of a case label, respectively.  */
1176 #define CASE_LOW(NODE)                  TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 0)
1177 #define CASE_HIGH(NODE)                 TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 1)
1178 #define CASE_LABEL(NODE)                TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 2)
1179 #define CASE_CHAIN(NODE)                TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 3)
1180
1181 /* The operands of a TARGET_MEM_REF.  Operands 0 and 1 have to match
1182    corresponding MEM_REF operands.  */
1183 #define TMR_BASE(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 0))
1184 #define TMR_OFFSET(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 1))
1185 #define TMR_INDEX(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 2))
1186 #define TMR_STEP(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 3))
1187 #define TMR_INDEX2(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 4))
1188
1189 #define MR_DEPENDENCE_CLIQUE(NODE) \
1190   (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.clique)
1191 #define MR_DEPENDENCE_BASE(NODE) \
1192   (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.base)
1193
1194 /* The operands of a BIND_EXPR.  */
1195 #define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0))
1196 #define BIND_EXPR_BODY(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 1))
1197 #define BIND_EXPR_BLOCK(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 2))
1198
1199 /* GOTO_EXPR accessor. This gives access to the label associated with
1200    a goto statement.  */
1201 #define GOTO_DESTINATION(NODE)  TREE_OPERAND ((NODE), 0)
1202
1203 /* ASM_EXPR accessors. ASM_STRING returns a STRING_CST for the
1204    instruction (e.g., "mov x, y"). ASM_OUTPUTS, ASM_INPUTS, and
1205    ASM_CLOBBERS represent the outputs, inputs, and clobbers for the
1206    statement.  */
1207 #define ASM_STRING(NODE)        TREE_OPERAND (ASM_EXPR_CHECK (NODE), 0)
1208 #define ASM_OUTPUTS(NODE)       TREE_OPERAND (ASM_EXPR_CHECK (NODE), 1)
1209 #define ASM_INPUTS(NODE)        TREE_OPERAND (ASM_EXPR_CHECK (NODE), 2)
1210 #define ASM_CLOBBERS(NODE)      TREE_OPERAND (ASM_EXPR_CHECK (NODE), 3)
1211 #define ASM_LABELS(NODE)        TREE_OPERAND (ASM_EXPR_CHECK (NODE), 4)
1212 /* Nonzero if we want to create an ASM_INPUT instead of an
1213    ASM_OPERAND with no operands.  */
1214 #define ASM_INPUT_P(NODE) (ASM_EXPR_CHECK (NODE)->base.static_flag)
1215 #define ASM_VOLATILE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.public_flag)
1216
1217 /* COND_EXPR accessors.  */
1218 #define COND_EXPR_COND(NODE)    (TREE_OPERAND (COND_EXPR_CHECK (NODE), 0))
1219 #define COND_EXPR_THEN(NODE)    (TREE_OPERAND (COND_EXPR_CHECK (NODE), 1))
1220 #define COND_EXPR_ELSE(NODE)    (TREE_OPERAND (COND_EXPR_CHECK (NODE), 2))
1221
1222 /* Accessors for the chains of recurrences.  */
1223 #define CHREC_VAR(NODE)           TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0)
1224 #define CHREC_LEFT(NODE)          TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1)
1225 #define CHREC_RIGHT(NODE)         TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 2)
1226 #define CHREC_VARIABLE(NODE)      TREE_INT_CST_LOW (CHREC_VAR (NODE))
1227
1228 /* LABEL_EXPR accessor. This gives access to the label associated with
1229    the given label expression.  */
1230 #define LABEL_EXPR_LABEL(NODE)  TREE_OPERAND (LABEL_EXPR_CHECK (NODE), 0)
1231
1232 /* CATCH_EXPR accessors.  */
1233 #define CATCH_TYPES(NODE)       TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 0)
1234 #define CATCH_BODY(NODE)        TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 1)
1235
1236 /* EH_FILTER_EXPR accessors.  */
1237 #define EH_FILTER_TYPES(NODE)   TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 0)
1238 #define EH_FILTER_FAILURE(NODE) TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 1)
1239
1240 /* OBJ_TYPE_REF accessors.  */
1241 #define OBJ_TYPE_REF_EXPR(NODE)   TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 0)
1242 #define OBJ_TYPE_REF_OBJECT(NODE) TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 1)
1243 #define OBJ_TYPE_REF_TOKEN(NODE)  TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 2)
1244
1245 /* ASSERT_EXPR accessors.  */
1246 #define ASSERT_EXPR_VAR(NODE)   TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 0)
1247 #define ASSERT_EXPR_COND(NODE)  TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 1)
1248
1249 /* CALL_EXPR accessors.  */
1250 #define CALL_EXPR_FN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 1)
1251 #define CALL_EXPR_STATIC_CHAIN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 2)
1252 #define CALL_EXPR_ARG(NODE, I) TREE_OPERAND (CALL_EXPR_CHECK (NODE), (I) + 3)
1253 #define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH (NODE) - 3)
1254 #define CALL_EXPR_IFN(NODE) (CALL_EXPR_CHECK (NODE)->base.u.ifn)
1255
1256 /* CALL_EXPR_ARGP returns a pointer to the argument vector for NODE.
1257    We can't use &CALL_EXPR_ARG (NODE, 0) because that will complain if
1258    the argument count is zero when checking is enabled.  Instead, do
1259    the pointer arithmetic to advance past the 3 fixed operands in a
1260    CALL_EXPR.  That produces a valid pointer to just past the end of the
1261    operand array, even if it's not valid to dereference it.  */
1262 #define CALL_EXPR_ARGP(NODE) \
1263   (&(TREE_OPERAND (CALL_EXPR_CHECK (NODE), 0)) + 3)
1264
1265 /* TM directives and accessors.  */
1266 #define TRANSACTION_EXPR_BODY(NODE) \
1267   TREE_OPERAND (TRANSACTION_EXPR_CHECK (NODE), 0)
1268 #define TRANSACTION_EXPR_OUTER(NODE) \
1269   (TRANSACTION_EXPR_CHECK (NODE)->base.static_flag)
1270 #define TRANSACTION_EXPR_RELAXED(NODE) \
1271   (TRANSACTION_EXPR_CHECK (NODE)->base.public_flag)
1272
1273 /* OpenMP and OpenACC directive and clause accessors.  */
1274
1275 /* Generic accessors for OMP nodes that keep the body as operand 0, and clauses
1276    as operand 1.  */
1277 #define OMP_BODY(NODE) \
1278   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_TASKGROUP), 0)
1279 #define OMP_CLAUSES(NODE) \
1280   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_SINGLE), 1)
1281
1282 /* Generic accessors for OMP nodes that keep clauses as operand 0.  */
1283 #define OMP_STANDALONE_CLAUSES(NODE) \
1284   TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_CACHE, OMP_TARGET_EXIT_DATA), 0)
1285
1286 #define OACC_DATA_BODY(NODE) \
1287   TREE_OPERAND (OACC_DATA_CHECK (NODE), 0)
1288 #define OACC_DATA_CLAUSES(NODE) \
1289   TREE_OPERAND (OACC_DATA_CHECK (NODE), 1)
1290
1291 #define OACC_HOST_DATA_BODY(NODE) \
1292   TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 0)
1293 #define OACC_HOST_DATA_CLAUSES(NODE) \
1294   TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 1)
1295
1296 #define OACC_CACHE_CLAUSES(NODE) \
1297   TREE_OPERAND (OACC_CACHE_CHECK (NODE), 0)
1298
1299 #define OACC_DECLARE_CLAUSES(NODE) \
1300   TREE_OPERAND (OACC_DECLARE_CHECK (NODE), 0)
1301
1302 #define OACC_ENTER_DATA_CLAUSES(NODE) \
1303   TREE_OPERAND (OACC_ENTER_DATA_CHECK (NODE), 0)
1304
1305 #define OACC_EXIT_DATA_CLAUSES(NODE) \
1306   TREE_OPERAND (OACC_EXIT_DATA_CHECK (NODE), 0)
1307
1308 #define OACC_UPDATE_CLAUSES(NODE) \
1309   TREE_OPERAND (OACC_UPDATE_CHECK (NODE), 0)
1310
1311 #define OMP_PARALLEL_BODY(NODE)    TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 0)
1312 #define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 1)
1313
1314 #define OMP_TASK_BODY(NODE)        TREE_OPERAND (OMP_TASK_CHECK (NODE), 0)
1315 #define OMP_TASK_CLAUSES(NODE)     TREE_OPERAND (OMP_TASK_CHECK (NODE), 1)
1316
1317 #define OMP_TASKREG_CHECK(NODE)   TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_TASK)
1318 #define OMP_TASKREG_BODY(NODE)    TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 0)
1319 #define OMP_TASKREG_CLAUSES(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 1)
1320
1321 #define OMP_LOOP_CHECK(NODE) TREE_RANGE_CHECK (NODE, OMP_FOR, OACC_LOOP)
1322 #define OMP_FOR_BODY(NODE)         TREE_OPERAND (OMP_LOOP_CHECK (NODE), 0)
1323 #define OMP_FOR_CLAUSES(NODE)      TREE_OPERAND (OMP_LOOP_CHECK (NODE), 1)
1324 #define OMP_FOR_INIT(NODE)         TREE_OPERAND (OMP_LOOP_CHECK (NODE), 2)
1325 #define OMP_FOR_COND(NODE)         TREE_OPERAND (OMP_LOOP_CHECK (NODE), 3)
1326 #define OMP_FOR_INCR(NODE)         TREE_OPERAND (OMP_LOOP_CHECK (NODE), 4)
1327 #define OMP_FOR_PRE_BODY(NODE)     TREE_OPERAND (OMP_LOOP_CHECK (NODE), 5)
1328 #define OMP_FOR_ORIG_DECLS(NODE)   TREE_OPERAND (OMP_LOOP_CHECK (NODE), 6)
1329
1330 #define OMP_SECTIONS_BODY(NODE)    TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0)
1331 #define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1)
1332
1333 #define OMP_SECTION_BODY(NODE)     TREE_OPERAND (OMP_SECTION_CHECK (NODE), 0)
1334
1335 #define OMP_SINGLE_BODY(NODE)      TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 0)
1336 #define OMP_SINGLE_CLAUSES(NODE)   TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 1)
1337
1338 #define OMP_MASTER_BODY(NODE)      TREE_OPERAND (OMP_MASTER_CHECK (NODE), 0)
1339
1340 #define OMP_TASKGROUP_BODY(NODE)   TREE_OPERAND (OMP_TASKGROUP_CHECK (NODE), 0)
1341
1342 #define OMP_ORDERED_BODY(NODE)     TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 0)
1343 #define OMP_ORDERED_CLAUSES(NODE)  TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 1)
1344
1345 #define OMP_CRITICAL_BODY(NODE)    TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 0)
1346 #define OMP_CRITICAL_CLAUSES(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 1)
1347 #define OMP_CRITICAL_NAME(NODE)    TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 2)
1348
1349 #define OMP_TEAMS_BODY(NODE)       TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 0)
1350 #define OMP_TEAMS_CLAUSES(NODE)    TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 1)
1351
1352 #define OMP_TARGET_DATA_BODY(NODE) \
1353   TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 0)
1354 #define OMP_TARGET_DATA_CLAUSES(NODE)\
1355   TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 1)
1356
1357 #define OMP_TARGET_BODY(NODE)      TREE_OPERAND (OMP_TARGET_CHECK (NODE), 0)
1358 #define OMP_TARGET_CLAUSES(NODE)   TREE_OPERAND (OMP_TARGET_CHECK (NODE), 1)
1359
1360 #define OMP_TARGET_UPDATE_CLAUSES(NODE)\
1361   TREE_OPERAND (OMP_TARGET_UPDATE_CHECK (NODE), 0)
1362
1363 #define OMP_TARGET_ENTER_DATA_CLAUSES(NODE)\
1364   TREE_OPERAND (OMP_TARGET_ENTER_DATA_CHECK (NODE), 0)
1365
1366 #define OMP_TARGET_EXIT_DATA_CLAUSES(NODE)\
1367   TREE_OPERAND (OMP_TARGET_EXIT_DATA_CHECK (NODE), 0)
1368
1369 #define OMP_CLAUSE_SIZE(NODE)                                           \
1370   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE),  \
1371                                               OMP_CLAUSE_FROM,          \
1372                                               OMP_CLAUSE__CACHE_), 1)
1373
1374 #define OMP_CLAUSE_CHAIN(NODE)     TREE_CHAIN (OMP_CLAUSE_CHECK (NODE))
1375 #define OMP_CLAUSE_DECL(NODE)                                           \
1376   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE),  \
1377                                               OMP_CLAUSE_PRIVATE,       \
1378                                               OMP_CLAUSE__LOOPTEMP_), 0)
1379 #define OMP_CLAUSE_HAS_LOCATION(NODE) \
1380   (LOCATION_LOCUS ((OMP_CLAUSE_CHECK (NODE))->omp_clause.locus)         \
1381   != UNKNOWN_LOCATION)
1382 #define OMP_CLAUSE_LOCATION(NODE)  (OMP_CLAUSE_CHECK (NODE))->omp_clause.locus
1383
1384 /* True on an OMP_SECTION statement that was the last lexical member.
1385    This status is meaningful in the implementation of lastprivate.  */
1386 #define OMP_SECTION_LAST(NODE) \
1387   (OMP_SECTION_CHECK (NODE)->base.private_flag)
1388
1389 /* True on an OMP_PARALLEL statement if it represents an explicit
1390    combined parallel work-sharing constructs.  */
1391 #define OMP_PARALLEL_COMBINED(NODE) \
1392   (OMP_PARALLEL_CHECK (NODE)->base.private_flag)
1393
1394 /* True on an OMP_TEAMS statement if it represents an explicit
1395    combined teams distribute constructs.  */
1396 #define OMP_TEAMS_COMBINED(NODE) \
1397   (OMP_TEAMS_CHECK (NODE)->base.private_flag)
1398
1399 /* True on an OMP_TARGET statement if it represents explicit
1400    combined target teams, target parallel or target simd constructs.  */
1401 #define OMP_TARGET_COMBINED(NODE) \
1402   (OMP_TARGET_CHECK (NODE)->base.private_flag)
1403
1404 /* True if OMP_ATOMIC* is supposed to be sequentially consistent
1405    as opposed to relaxed.  */
1406 #define OMP_ATOMIC_SEQ_CST(NODE) \
1407   (TREE_RANGE_CHECK (NODE, OMP_ATOMIC, \
1408                      OMP_ATOMIC_CAPTURE_NEW)->base.private_flag)
1409
1410 /* True on a PRIVATE clause if its decl is kept around for debugging
1411    information only and its DECL_VALUE_EXPR is supposed to point
1412    to what it has been remapped to.  */
1413 #define OMP_CLAUSE_PRIVATE_DEBUG(NODE) \
1414   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE)->base.public_flag)
1415
1416 /* True on a PRIVATE clause if ctor needs access to outer region's
1417    variable.  */
1418 #define OMP_CLAUSE_PRIVATE_OUTER_REF(NODE) \
1419   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE))
1420
1421 /* True if a PRIVATE clause is for a C++ class IV on taskloop construct
1422    (thus should be private on the outer taskloop and firstprivate on
1423    task).  */
1424 #define OMP_CLAUSE_PRIVATE_TASKLOOP_IV(NODE) \
1425   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE))
1426
1427 /* True on a FIRSTPRIVATE clause if it has been added implicitly.  */
1428 #define OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT(NODE) \
1429   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE)->base.public_flag)
1430
1431 /* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same
1432    decl is present in the chain.  */
1433 #define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \
1434   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE)->base.public_flag)
1435 #define OMP_CLAUSE_LASTPRIVATE_STMT(NODE) \
1436   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE,                   \
1437                                                 OMP_CLAUSE_LASTPRIVATE),\
1438                       1)
1439 #define OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ(NODE) \
1440   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
1441
1442 /* True if a LASTPRIVATE clause is for a C++ class IV on taskloop construct
1443    (thus should be lastprivate on the outer taskloop and firstprivate on
1444    task).  */
1445 #define OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV(NODE) \
1446   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE))
1447
1448 /* True on a SHARED clause if a FIRSTPRIVATE clause for the same
1449    decl is present in the chain (this can happen only for taskloop
1450    with FIRSTPRIVATE/LASTPRIVATE on it originally.  */
1451 #define OMP_CLAUSE_SHARED_FIRSTPRIVATE(NODE) \
1452   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED)->base.public_flag)
1453
1454 /* True on a SHARED clause if a scalar is not modified in the body and
1455    thus could be optimized as firstprivate.  */
1456 #define OMP_CLAUSE_SHARED_READONLY(NODE) \
1457   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED))
1458
1459 #define OMP_CLAUSE_IF_MODIFIER(NODE)    \
1460   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF)->omp_clause.subcode.if_modifier)
1461
1462 #define OMP_CLAUSE_FINAL_EXPR(NODE) \
1463   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FINAL), 0)
1464 #define OMP_CLAUSE_IF_EXPR(NODE) \
1465   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0)
1466 #define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \
1467   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_THREADS),0)
1468 #define OMP_CLAUSE_SCHEDULE_CHUNK_EXPR(NODE) \
1469   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE), 0)
1470 #define OMP_CLAUSE_NUM_TASKS_EXPR(NODE) \
1471   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TASKS), 0)
1472 #define OMP_CLAUSE_HINT_EXPR(NODE) \
1473   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_HINT), 0)
1474
1475 #define OMP_CLAUSE_GRAINSIZE_EXPR(NODE) \
1476   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE),0)
1477
1478 #define OMP_CLAUSE_PRIORITY_EXPR(NODE) \
1479   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIORITY),0)
1480
1481 /* OpenACC clause expressions  */
1482 #define OMP_CLAUSE_EXPR(NODE, CLAUSE) \
1483   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, CLAUSE), 0)
1484 #define OMP_CLAUSE_GANG_EXPR(NODE) \
1485   OMP_CLAUSE_OPERAND ( \
1486     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 0)
1487 #define OMP_CLAUSE_GANG_STATIC_EXPR(NODE) \
1488   OMP_CLAUSE_OPERAND ( \
1489     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 1)
1490 #define OMP_CLAUSE_ASYNC_EXPR(NODE) \
1491   OMP_CLAUSE_OPERAND ( \
1492     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ASYNC), 0)
1493 #define OMP_CLAUSE_WAIT_EXPR(NODE) \
1494   OMP_CLAUSE_OPERAND ( \
1495     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WAIT), 0)
1496 #define OMP_CLAUSE_VECTOR_EXPR(NODE) \
1497   OMP_CLAUSE_OPERAND ( \
1498     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR), 0)
1499 #define OMP_CLAUSE_WORKER_EXPR(NODE) \
1500   OMP_CLAUSE_OPERAND ( \
1501     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WORKER), 0)
1502 #define OMP_CLAUSE_NUM_GANGS_EXPR(NODE) \
1503   OMP_CLAUSE_OPERAND ( \
1504     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_GANGS), 0)
1505 #define OMP_CLAUSE_NUM_WORKERS_EXPR(NODE) \
1506   OMP_CLAUSE_OPERAND ( \
1507     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_WORKERS), 0)
1508 #define OMP_CLAUSE_VECTOR_LENGTH_EXPR(NODE) \
1509   OMP_CLAUSE_OPERAND ( \
1510     OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR_LENGTH), 0)
1511
1512 #define OMP_CLAUSE_DEPEND_KIND(NODE) \
1513   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEPEND)->omp_clause.subcode.depend_kind)
1514
1515 #define OMP_CLAUSE_DEPEND_SINK_NEGATIVE(NODE) \
1516   TREE_PUBLIC (TREE_LIST_CHECK (NODE))
1517
1518 #define OMP_CLAUSE_MAP_KIND(NODE) \
1519   ((enum gomp_map_kind) OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind)
1520 #define OMP_CLAUSE_SET_MAP_KIND(NODE, MAP_KIND) \
1521   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind \
1522    = (unsigned int) (MAP_KIND))
1523
1524 /* Nonzero if this map clause is for array (rather than pointer) based array
1525    section with zero bias.  Both the non-decl OMP_CLAUSE_MAP and corresponding
1526    OMP_CLAUSE_MAP with GOMP_MAP_POINTER are marked with this flag.  */
1527 #define OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION(NODE) \
1528   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.public_flag)
1529 /* Nonzero if this is a mapped array section, that might need special
1530    treatment if OMP_CLAUSE_SIZE is zero.  */
1531 #define OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION(NODE) \
1532   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
1533 /* Nonzero if this map clause is for an ACC parallel reduction variable.  */
1534 #define OMP_CLAUSE_MAP_IN_REDUCTION(NODE) \
1535   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP))
1536
1537 #define OMP_CLAUSE_PROC_BIND_KIND(NODE) \
1538   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PROC_BIND)->omp_clause.subcode.proc_bind_kind)
1539
1540 #define OMP_CLAUSE_COLLAPSE_EXPR(NODE) \
1541   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 0)
1542 #define OMP_CLAUSE_COLLAPSE_ITERVAR(NODE) \
1543   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 1)
1544 #define OMP_CLAUSE_COLLAPSE_COUNT(NODE) \
1545   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 2)
1546
1547 #define OMP_CLAUSE_ORDERED_EXPR(NODE) \
1548   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ORDERED), 0)
1549
1550 #define OMP_CLAUSE_REDUCTION_CODE(NODE) \
1551   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->omp_clause.subcode.reduction_code)
1552 #define OMP_CLAUSE_REDUCTION_INIT(NODE) \
1553   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 1)
1554 #define OMP_CLAUSE_REDUCTION_MERGE(NODE) \
1555   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 2)
1556 #define OMP_CLAUSE_REDUCTION_GIMPLE_INIT(NODE) \
1557   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
1558 #define OMP_CLAUSE_REDUCTION_GIMPLE_MERGE(NODE) \
1559   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_merge
1560 #define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \
1561   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 3)
1562 #define OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER(NODE) \
1563   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 4)
1564
1565 /* True if a REDUCTION clause may reference the original list item (omp_orig)
1566    in its OMP_CLAUSE_REDUCTION_{,GIMPLE_}INIT.  */
1567 #define OMP_CLAUSE_REDUCTION_OMP_ORIG_REF(NODE) \
1568   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->base.public_flag)
1569
1570 /* True if a LINEAR clause doesn't need copy in.  True for iterator vars which
1571    are always initialized inside of the loop construct, false otherwise.  */
1572 #define OMP_CLAUSE_LINEAR_NO_COPYIN(NODE) \
1573   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.public_flag)
1574
1575 /* True if a LINEAR clause doesn't need copy out.  True for iterator vars which
1576    are declared inside of the simd construct.  */
1577 #define OMP_CLAUSE_LINEAR_NO_COPYOUT(NODE) \
1578   TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR))
1579
1580 /* True if a LINEAR clause has a stride that is variable.  */
1581 #define OMP_CLAUSE_LINEAR_VARIABLE_STRIDE(NODE) \
1582   TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR))
1583
1584 /* True if a LINEAR clause is for an array or allocatable variable that
1585    needs special handling by the frontend.  */
1586 #define OMP_CLAUSE_LINEAR_ARRAY(NODE) \
1587   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.deprecated_flag)
1588
1589 #define OMP_CLAUSE_LINEAR_STEP(NODE) \
1590   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 1)
1591
1592 #define OMP_CLAUSE_LINEAR_STMT(NODE) \
1593   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 2)
1594
1595 #define OMP_CLAUSE_LINEAR_GIMPLE_SEQ(NODE) \
1596   (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init
1597
1598 #define OMP_CLAUSE_LINEAR_KIND(NODE) \
1599   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->omp_clause.subcode.linear_kind)
1600
1601 #define OMP_CLAUSE_ALIGNED_ALIGNMENT(NODE) \
1602   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALIGNED), 1)
1603
1604 #define OMP_CLAUSE_NUM_TEAMS_EXPR(NODE) \
1605   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TEAMS), 0)
1606
1607 #define OMP_CLAUSE_THREAD_LIMIT_EXPR(NODE) \
1608   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \
1609                                                 OMP_CLAUSE_THREAD_LIMIT), 0)
1610
1611 #define OMP_CLAUSE_DEVICE_ID(NODE) \
1612   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEVICE), 0)
1613
1614 #define OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR(NODE) \
1615   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \
1616                                                 OMP_CLAUSE_DIST_SCHEDULE), 0)
1617
1618 #define OMP_CLAUSE_SAFELEN_EXPR(NODE) \
1619   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SAFELEN), 0)
1620
1621 #define OMP_CLAUSE_SIMDLEN_EXPR(NODE) \
1622   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SIMDLEN), 0)
1623
1624 #define OMP_CLAUSE__SIMDUID__DECL(NODE) \
1625   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__SIMDUID_), 0)
1626
1627 #define OMP_CLAUSE_SCHEDULE_KIND(NODE) \
1628   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->omp_clause.subcode.schedule_kind)
1629
1630 /* True if a SCHEDULE clause has the simd modifier on it.  */
1631 #define OMP_CLAUSE_SCHEDULE_SIMD(NODE) \
1632   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->base.public_flag)
1633
1634 #define OMP_CLAUSE_DEFAULT_KIND(NODE) \
1635   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind)
1636
1637 #define OMP_CLAUSE_TILE_LIST(NODE) \
1638   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 0)
1639
1640 #define OMP_CLAUSE__GRIDDIM__DIMENSION(NODE) \
1641   (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_)\
1642    ->omp_clause.subcode.dimension)
1643 #define OMP_CLAUSE__GRIDDIM__SIZE(NODE) \
1644   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 0)
1645 #define OMP_CLAUSE__GRIDDIM__GROUP(NODE) \
1646   OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 1)
1647
1648 /* SSA_NAME accessors.  */
1649
1650 /* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE
1651    if there is no name associated with it.  */
1652 #define SSA_NAME_IDENTIFIER(NODE)                               \
1653   (SSA_NAME_CHECK (NODE)->ssa_name.var != NULL_TREE             \
1654    ? (TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE       \
1655       ? (NODE)->ssa_name.var                                    \
1656       : DECL_NAME ((NODE)->ssa_name.var))                       \
1657    : NULL_TREE)
1658
1659 /* Returns the variable being referenced.  This can be NULL_TREE for
1660    temporaries not associated with any user variable.
1661    Once released, this is the only field that can be relied upon.  */
1662 #define SSA_NAME_VAR(NODE)                                      \
1663   (SSA_NAME_CHECK (NODE)->ssa_name.var == NULL_TREE             \
1664    || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE       \
1665    ? NULL_TREE : (NODE)->ssa_name.var)
1666
1667 #define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \
1668   do { SSA_NAME_CHECK (NODE)->ssa_name.var = (VAR); } while (0)
1669
1670 /* Returns the statement which defines this SSA name.  */
1671 #define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt
1672
1673 /* Returns the SSA version number of this SSA name.  Note that in
1674    tree SSA, version numbers are not per variable and may be recycled.  */
1675 #define SSA_NAME_VERSION(NODE)  SSA_NAME_CHECK (NODE)->base.u.version
1676
1677 /* Nonzero if this SSA name occurs in an abnormal PHI.  SSA_NAMES are
1678    never output, so we can safely use the ASM_WRITTEN_FLAG for this
1679    status bit.  */
1680 #define SSA_NAME_OCCURS_IN_ABNORMAL_PHI(NODE) \
1681     SSA_NAME_CHECK (NODE)->base.asm_written_flag
1682
1683 /* Nonzero if this SSA_NAME expression is currently on the free list of
1684    SSA_NAMES.  Using NOTHROW_FLAG seems reasonably safe since throwing
1685    has no meaning for an SSA_NAME.  */
1686 #define SSA_NAME_IN_FREE_LIST(NODE) \
1687     SSA_NAME_CHECK (NODE)->base.nothrow_flag
1688
1689 /* Nonzero if this SSA_NAME is the default definition for the
1690    underlying symbol.  A default SSA name is created for symbol S if
1691    the very first reference to S in the function is a read operation.
1692    Default definitions are always created by an empty statement and
1693    belong to no basic block.  */
1694 #define SSA_NAME_IS_DEFAULT_DEF(NODE) \
1695     SSA_NAME_CHECK (NODE)->base.default_def_flag
1696
1697 /* Attributes for SSA_NAMEs for pointer-type variables.  */
1698 #define SSA_NAME_PTR_INFO(N) \
1699    SSA_NAME_CHECK (N)->ssa_name.info.ptr_info
1700
1701 /* True if SSA_NAME_RANGE_INFO describes an anti-range.  */
1702 #define SSA_NAME_ANTI_RANGE_P(N) \
1703     SSA_NAME_CHECK (N)->base.static_flag
1704
1705 /* The type of range described by SSA_NAME_RANGE_INFO.  */
1706 #define SSA_NAME_RANGE_TYPE(N) \
1707     (SSA_NAME_ANTI_RANGE_P (N) ? VR_ANTI_RANGE : VR_RANGE)
1708
1709 /* Value range info attributes for SSA_NAMEs of non pointer-type variables.  */
1710 #define SSA_NAME_RANGE_INFO(N) \
1711     SSA_NAME_CHECK (N)->ssa_name.info.range_info
1712
1713 /* Return the immediate_use information for an SSA_NAME. */
1714 #define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses
1715
1716 #define OMP_CLAUSE_CODE(NODE)                                   \
1717         (OMP_CLAUSE_CHECK (NODE))->omp_clause.code
1718
1719 #define OMP_CLAUSE_SET_CODE(NODE, CODE)                         \
1720         ((OMP_CLAUSE_CHECK (NODE))->omp_clause.code = (CODE))
1721
1722 #define OMP_CLAUSE_OPERAND(NODE, I)                             \
1723         OMP_CLAUSE_ELT_CHECK (NODE, I)
1724
1725 /* In a BLOCK node.  */
1726 #define BLOCK_VARS(NODE) (BLOCK_CHECK (NODE)->block.vars)
1727 #define BLOCK_NONLOCALIZED_VARS(NODE) \
1728   (BLOCK_CHECK (NODE)->block.nonlocalized_vars)
1729 #define BLOCK_NUM_NONLOCALIZED_VARS(NODE) \
1730   vec_safe_length (BLOCK_NONLOCALIZED_VARS (NODE))
1731 #define BLOCK_NONLOCALIZED_VAR(NODE,N) (*BLOCK_NONLOCALIZED_VARS (NODE))[N]
1732 #define BLOCK_SUBBLOCKS(NODE) (BLOCK_CHECK (NODE)->block.subblocks)
1733 #define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext)
1734 #define BLOCK_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.chain)
1735 #define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin)
1736 #define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag)
1737 #define BLOCK_DIE(NODE) (BLOCK_CHECK (NODE)->block.die)
1738
1739 /* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT.  */
1740 #define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.u.bits.nameless_flag)
1741
1742 /* An index number for this block.  These values are not guaranteed to
1743    be unique across functions -- whether or not they are depends on
1744    the debugging output format in use.  */
1745 #define BLOCK_NUMBER(NODE) (BLOCK_CHECK (NODE)->block.block_num)
1746
1747 /* If block reordering splits a lexical block into discontiguous
1748    address ranges, we'll make a copy of the original block.
1749
1750    Note that this is logically distinct from BLOCK_ABSTRACT_ORIGIN.
1751    In that case, we have one source block that has been replicated
1752    (through inlining or unrolling) into many logical blocks, and that
1753    these logical blocks have different physical variables in them.
1754
1755    In this case, we have one logical block split into several
1756    non-contiguous address ranges.  Most debug formats can't actually
1757    represent this idea directly, so we fake it by creating multiple
1758    logical blocks with the same variables in them.  However, for those
1759    that do support non-contiguous regions, these allow the original
1760    logical block to be reconstructed, along with the set of address
1761    ranges.
1762
1763    One of the logical block fragments is arbitrarily chosen to be
1764    the ORIGIN.  The other fragments will point to the origin via
1765    BLOCK_FRAGMENT_ORIGIN; the origin itself will have this pointer
1766    be null.  The list of fragments will be chained through
1767    BLOCK_FRAGMENT_CHAIN from the origin.  */
1768
1769 #define BLOCK_FRAGMENT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_origin)
1770 #define BLOCK_FRAGMENT_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_chain)
1771
1772 /* For an inlined function, this gives the location where it was called
1773    from.  This is only set in the top level block, which corresponds to the
1774    inlined function scope.  This is used in the debug output routines.  */
1775
1776 #define BLOCK_SOURCE_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.locus)
1777
1778 /* This gives the location of the end of the block, useful to attach
1779    code implicitly generated for outgoing paths.  */
1780
1781 #define BLOCK_SOURCE_END_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.end_locus)
1782
1783 /* Define fields and accessors for nodes representing data types.  */
1784
1785 /* See tree.def for documentation of the use of these fields.
1786    Look at the documentation of the various ..._TYPE tree codes.
1787
1788    Note that the type.values, type.minval, and type.maxval fields are
1789    overloaded and used for different macros in different kinds of types.
1790    Each macro must check to ensure the tree node is of the proper kind of
1791    type.  Note also that some of the front-ends also overload these fields,
1792    so they must be checked as well.  */
1793
1794 #define TYPE_UID(NODE) (TYPE_CHECK (NODE)->type_common.uid)
1795 #define TYPE_SIZE(NODE) (TYPE_CHECK (NODE)->type_common.size)
1796 #define TYPE_SIZE_UNIT(NODE) (TYPE_CHECK (NODE)->type_common.size_unit)
1797 #define TYPE_POINTER_TO(NODE) (TYPE_CHECK (NODE)->type_common.pointer_to)
1798 #define TYPE_REFERENCE_TO(NODE) (TYPE_CHECK (NODE)->type_common.reference_to)
1799 #define TYPE_PRECISION(NODE) (TYPE_CHECK (NODE)->type_common.precision)
1800 #define TYPE_NAME(NODE) (TYPE_CHECK (NODE)->type_common.name)
1801 #define TYPE_NEXT_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.next_variant)
1802 #define TYPE_MAIN_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.main_variant)
1803 #define TYPE_CONTEXT(NODE) (TYPE_CHECK (NODE)->type_common.context)
1804
1805 #define TYPE_MODE_RAW(NODE) (TYPE_CHECK (NODE)->type_common.mode)
1806 #define TYPE_MODE(NODE) \
1807   (VECTOR_TYPE_P (TYPE_CHECK (NODE)) \
1808    ? vector_type_mode (NODE) : (NODE)->type_common.mode)
1809 #define SET_TYPE_MODE(NODE, MODE) \
1810   (TYPE_CHECK (NODE)->type_common.mode = (MODE))
1811
1812 extern machine_mode element_mode (const_tree t);
1813
1814 /* The "canonical" type for this type node, which is used by frontends to
1815    compare the type for equality with another type.  If two types are
1816    equal (based on the semantics of the language), then they will have
1817    equivalent TYPE_CANONICAL entries.
1818
1819    As a special case, if TYPE_CANONICAL is NULL_TREE, and thus
1820    TYPE_STRUCTURAL_EQUALITY_P is true, then it cannot
1821    be used for comparison against other types.  Instead, the type is
1822    said to require structural equality checks, described in
1823    TYPE_STRUCTURAL_EQUALITY_P.
1824
1825    For unqualified aggregate and function types the middle-end relies on
1826    TYPE_CANONICAL to tell whether two variables can be assigned
1827    to each other without a conversion.  The middle-end also makes sure
1828    to assign the same alias-sets to the type partition with equal
1829    TYPE_CANONICAL of their unqualified variants.  */
1830 #define TYPE_CANONICAL(NODE) (TYPE_CHECK (NODE)->type_common.canonical)
1831 /* Indicates that the type node requires structural equality
1832    checks.  The compiler will need to look at the composition of the
1833    type to determine whether it is equal to another type, rather than
1834    just comparing canonical type pointers.  For instance, we would need
1835    to look at the return and parameter types of a FUNCTION_TYPE
1836    node.  */
1837 #define TYPE_STRUCTURAL_EQUALITY_P(NODE) (TYPE_CANONICAL (NODE) == NULL_TREE)
1838 /* Sets the TYPE_CANONICAL field to NULL_TREE, indicating that the
1839    type node requires structural equality.  */
1840 #define SET_TYPE_STRUCTURAL_EQUALITY(NODE) (TYPE_CANONICAL (NODE) = NULL_TREE)
1841
1842 #define TYPE_IBIT(NODE) (GET_MODE_IBIT (TYPE_MODE (NODE)))
1843 #define TYPE_FBIT(NODE) (GET_MODE_FBIT (TYPE_MODE (NODE)))
1844
1845 /* The (language-specific) typed-based alias set for this type.
1846    Objects whose TYPE_ALIAS_SETs are different cannot alias each
1847    other.  If the TYPE_ALIAS_SET is -1, no alias set has yet been
1848    assigned to this type.  If the TYPE_ALIAS_SET is 0, objects of this
1849    type can alias objects of any type.  */
1850 #define TYPE_ALIAS_SET(NODE) (TYPE_CHECK (NODE)->type_common.alias_set)
1851
1852 /* Nonzero iff the typed-based alias set for this type has been
1853    calculated.  */
1854 #define TYPE_ALIAS_SET_KNOWN_P(NODE) \
1855   (TYPE_CHECK (NODE)->type_common.alias_set != -1)
1856
1857 /* A TREE_LIST of IDENTIFIER nodes of the attributes that apply
1858    to this type.  */
1859 #define TYPE_ATTRIBUTES(NODE) (TYPE_CHECK (NODE)->type_common.attributes)
1860
1861 /* The alignment necessary for objects of this type.
1862    The value is an int, measured in bits and must be a power of two.
1863    We support also an "alignment" of zero.  */
1864 #define TYPE_ALIGN(NODE) \
1865     (TYPE_CHECK (NODE)->type_common.align \
1866      ? ((unsigned)1) << ((NODE)->type_common.align - 1) : 0)
1867
1868 /* Specify that TYPE_ALIGN(NODE) is X.  */
1869 #define SET_TYPE_ALIGN(NODE, X) \
1870     (TYPE_CHECK (NODE)->type_common.align = ffs_hwi (X))
1871
1872 /* 1 if the alignment for this type was requested by "aligned" attribute,
1873    0 if it is the default for this type.  */
1874 #define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.u.bits.user_align)
1875
1876 /* The alignment for NODE, in bytes.  */
1877 #define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT)
1878
1879 /* If your language allows you to declare types, and you want debug info
1880    for them, then you need to generate corresponding TYPE_DECL nodes.
1881    These "stub" TYPE_DECL nodes have no name, and simply point at the
1882    type node.  You then set the TYPE_STUB_DECL field of the type node
1883    to point back at the TYPE_DECL node.  This allows the debug routines
1884    to know that the two nodes represent the same type, so that we only
1885    get one debug info record for them.  */
1886 #define TYPE_STUB_DECL(NODE) (TREE_CHAIN (TYPE_CHECK (NODE)))
1887
1888 /* In a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ARRAY_TYPE, it means
1889    the type has BLKmode only because it lacks the alignment required for
1890    its size.  */
1891 #define TYPE_NO_FORCE_BLK(NODE) \
1892   (TYPE_CHECK (NODE)->type_common.no_force_blk_flag)
1893
1894 /* Nonzero in a type considered volatile as a whole.  */
1895 #define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag)
1896
1897 /* Nonzero in a type considered atomic as a whole.  */
1898 #define TYPE_ATOMIC(NODE) (TYPE_CHECK (NODE)->base.u.bits.atomic_flag)
1899
1900 /* Means this type is const-qualified.  */
1901 #define TYPE_READONLY(NODE) (TYPE_CHECK (NODE)->base.readonly_flag)
1902
1903 /* If nonzero, this type is `restrict'-qualified, in the C sense of
1904    the term.  */
1905 #define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag)
1906
1907 /* If nonzero, type's name shouldn't be emitted into debug info.  */
1908 #define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag)
1909
1910 /* The address space the type is in.  */
1911 #define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.u.bits.address_space)
1912
1913 /* Encode/decode the named memory support as part of the qualifier.  If more
1914    than 8 qualifiers are added, these macros need to be adjusted.  */
1915 #define ENCODE_QUAL_ADDR_SPACE(NUM) ((NUM & 0xFF) << 8)
1916 #define DECODE_QUAL_ADDR_SPACE(X) (((X) >> 8) & 0xFF)
1917
1918 /* Return all qualifiers except for the address space qualifiers.  */
1919 #define CLEAR_QUAL_ADDR_SPACE(X) ((X) & ~0xFF00)
1920
1921 /* Only keep the address space out of the qualifiers and discard the other
1922    qualifiers.  */
1923 #define KEEP_QUAL_ADDR_SPACE(X) ((X) & 0xFF00)
1924
1925 /* The set of type qualifiers for this type.  */
1926 #define TYPE_QUALS(NODE)                                        \
1927   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)              \
1928           | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)         \
1929           | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC)             \
1930           | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)         \
1931           | (ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (NODE)))))
1932
1933 /* The same as TYPE_QUALS without the address space qualifications.  */
1934 #define TYPE_QUALS_NO_ADDR_SPACE(NODE)                          \
1935   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)              \
1936           | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)         \
1937           | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC)             \
1938           | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
1939
1940 /* The same as TYPE_QUALS without the address space and atomic 
1941    qualifications.  */
1942 #define TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC(NODE)                \
1943   ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST)              \
1944           | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE)         \
1945           | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT)))
1946
1947 /* These flags are available for each language front end to use internally.  */
1948 #define TYPE_LANG_FLAG_0(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_0)
1949 #define TYPE_LANG_FLAG_1(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_1)
1950 #define TYPE_LANG_FLAG_2(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_2)
1951 #define TYPE_LANG_FLAG_3(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_3)
1952 #define TYPE_LANG_FLAG_4(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_4)
1953 #define TYPE_LANG_FLAG_5(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_5)
1954 #define TYPE_LANG_FLAG_6(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_6)
1955 #define TYPE_LANG_FLAG_7(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_7)
1956
1957 /* Used to keep track of visited nodes in tree traversals.  This is set to
1958    0 by copy_node and make_node.  */
1959 #define TREE_VISITED(NODE) ((NODE)->base.visited)
1960
1961 /* If set in an ARRAY_TYPE, indicates a string type (for languages
1962    that distinguish string from array of char).
1963    If set in a INTEGER_TYPE, indicates a character type.  */
1964 #define TYPE_STRING_FLAG(NODE) (TYPE_CHECK (NODE)->type_common.string_flag)
1965
1966 /* For a VECTOR_TYPE, this is the number of sub-parts of the vector.  */
1967 #define TYPE_VECTOR_SUBPARTS(VECTOR_TYPE) \
1968   (HOST_WIDE_INT_1U \
1969    << VECTOR_TYPE_CHECK (VECTOR_TYPE)->type_common.precision)
1970
1971 /* Set precision to n when we have 2^n sub-parts of the vector.  */
1972 #define SET_TYPE_VECTOR_SUBPARTS(VECTOR_TYPE, X) \
1973   (VECTOR_TYPE_CHECK (VECTOR_TYPE)->type_common.precision = exact_log2 (X))
1974
1975 /* Nonzero in a VECTOR_TYPE if the frontends should not emit warnings
1976    about missing conversions to other vector types of the same size.  */
1977 #define TYPE_VECTOR_OPAQUE(NODE) \
1978   (VECTOR_TYPE_CHECK (NODE)->base.default_def_flag)
1979
1980 /* Indicates that objects of this type must be initialized by calling a
1981    function when they are created.  */
1982 #define TYPE_NEEDS_CONSTRUCTING(NODE) \
1983   (TYPE_CHECK (NODE)->type_common.needs_constructing_flag)
1984
1985 /* Indicates that a UNION_TYPE object should be passed the same way that
1986    the first union alternative would be passed, or that a RECORD_TYPE
1987    object should be passed the same way that the first (and only) member
1988    would be passed.  */
1989 #define TYPE_TRANSPARENT_AGGR(NODE) \
1990   (RECORD_OR_UNION_CHECK (NODE)->type_common.transparent_aggr_flag)
1991
1992 /* For an ARRAY_TYPE, indicates that it is not permitted to take the
1993    address of a component of the type.  This is the counterpart of
1994    DECL_NONADDRESSABLE_P for arrays, see the definition of this flag.  */
1995 #define TYPE_NONALIASED_COMPONENT(NODE) \
1996   (ARRAY_TYPE_CHECK (NODE)->type_common.transparent_aggr_flag)
1997
1998 /* Indicated that objects of this type should be laid out in as
1999    compact a way as possible.  */
2000 #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag)
2001
2002 /* Used by type_contains_placeholder_p to avoid recomputation.
2003    Values are: 0 (unknown), 1 (false), 2 (true).  Never access
2004    this field directly.  */
2005 #define TYPE_CONTAINS_PLACEHOLDER_INTERNAL(NODE) \
2006   (TYPE_CHECK (NODE)->type_common.contains_placeholder_bits)
2007
2008 /* Nonzero if RECORD_TYPE represents a final derivation of class.  */
2009 #define TYPE_FINAL_P(NODE) \
2010   (RECORD_OR_UNION_CHECK (NODE)->base.default_def_flag)
2011
2012 /* The debug output functions use the symtab union field to store
2013    information specific to the debugging format.  The different debug
2014    output hooks store different types in the union field.  These three
2015    macros are used to access different fields in the union.  The debug
2016    hooks are responsible for consistently using only a specific
2017    macro.  */
2018
2019 /* Symtab field as an integer.  Used by stabs generator in dbxout.c to
2020    hold the type's number in the generated stabs.  */
2021 #define TYPE_SYMTAB_ADDRESS(NODE) \
2022   (TYPE_CHECK (NODE)->type_common.symtab.address)
2023
2024 /* Symtab field as a string.  Used by COFF generator in sdbout.c to
2025    hold struct/union type tag names.  */
2026 #define TYPE_SYMTAB_POINTER(NODE) \
2027   (TYPE_CHECK (NODE)->type_common.symtab.pointer)
2028
2029 /* Symtab field as a pointer to a DWARF DIE.  Used by DWARF generator
2030    in dwarf2out.c to point to the DIE generated for the type.  */
2031 #define TYPE_SYMTAB_DIE(NODE) \
2032   (TYPE_CHECK (NODE)->type_common.symtab.die)
2033
2034 /* The garbage collector needs to know the interpretation of the
2035    symtab field.  These constants represent the different types in the
2036    union.  */
2037
2038 #define TYPE_SYMTAB_IS_ADDRESS (0)
2039 #define TYPE_SYMTAB_IS_POINTER (1)
2040 #define TYPE_SYMTAB_IS_DIE (2)
2041
2042 #define TYPE_LANG_SPECIFIC(NODE) \
2043   (TYPE_CHECK (NODE)->type_with_lang_specific.lang_specific)
2044
2045 #define TYPE_VALUES(NODE) (ENUMERAL_TYPE_CHECK (NODE)->type_non_common.values)
2046 #define TYPE_DOMAIN(NODE) (ARRAY_TYPE_CHECK (NODE)->type_non_common.values)
2047 #define TYPE_FIELDS(NODE) \
2048   (RECORD_OR_UNION_CHECK (NODE)->type_non_common.values)
2049 #define TYPE_CACHED_VALUES(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
2050 #define TYPE_ARG_TYPES(NODE) \
2051   (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.values)
2052 #define TYPE_VALUES_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
2053
2054 #define TYPE_METHODS(NODE) \
2055   (RECORD_OR_UNION_CHECK (NODE)->type_non_common.maxval)
2056 #define TYPE_VFIELD(NODE) \
2057   (RECORD_OR_UNION_CHECK (NODE)->type_non_common.minval)
2058 #define TYPE_METHOD_BASETYPE(NODE) \
2059   (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.maxval)
2060 #define TYPE_OFFSET_BASETYPE(NODE) \
2061   (OFFSET_TYPE_CHECK (NODE)->type_non_common.maxval)
2062 #define TYPE_MAXVAL(NODE) (TYPE_CHECK (NODE)->type_non_common.maxval)
2063 #define TYPE_MINVAL(NODE) (TYPE_CHECK (NODE)->type_non_common.minval)
2064 #define TYPE_NEXT_PTR_TO(NODE) \
2065   (POINTER_TYPE_CHECK (NODE)->type_non_common.minval)
2066 #define TYPE_NEXT_REF_TO(NODE) \
2067   (REFERENCE_TYPE_CHECK (NODE)->type_non_common.minval)
2068 #define TYPE_MIN_VALUE(NODE) \
2069   (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.minval)
2070 #define TYPE_MAX_VALUE(NODE) \
2071   (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.maxval)
2072
2073 /* If non-NULL, this is an upper bound of the size (in bytes) of an
2074    object of the given ARRAY_TYPE_NON_COMMON.  This allows temporaries to be
2075    allocated.  */
2076 #define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \
2077   (ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval)
2078
2079 /* For record and union types, information about this type, as a base type
2080    for itself.  */
2081 #define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo)
2082
2083 /* For non record and union types, used in a language-dependent way.  */
2084 #define TYPE_LANG_SLOT_1(NODE) \
2085   (NOT_RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo)
2086
2087 /* Define accessor macros for information about type inheritance
2088    and basetypes.
2089
2090    A "basetype" means a particular usage of a data type for inheritance
2091    in another type.  Each such basetype usage has its own "binfo"
2092    object to describe it.  The binfo object is a TREE_VEC node.
2093
2094    Inheritance is represented by the binfo nodes allocated for a
2095    given type.  For example, given types C and D, such that D is
2096    inherited by C, 3 binfo nodes will be allocated: one for describing
2097    the binfo properties of C, similarly one for D, and one for
2098    describing the binfo properties of D as a base type for C.
2099    Thus, given a pointer to class C, one can get a pointer to the binfo
2100    of D acting as a basetype for C by looking at C's binfo's basetypes.  */
2101
2102 /* BINFO specific flags.  */
2103
2104 /* Nonzero means that the derivation chain is via a `virtual' declaration.  */
2105 #define BINFO_VIRTUAL_P(NODE) (TREE_BINFO_CHECK (NODE)->base.static_flag)
2106
2107 /* Flags for language dependent use.  */
2108 #define BINFO_FLAG_0(NODE) TREE_LANG_FLAG_0 (TREE_BINFO_CHECK (NODE))
2109 #define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (NODE))
2110 #define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2 (TREE_BINFO_CHECK (NODE))
2111 #define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3 (TREE_BINFO_CHECK (NODE))
2112 #define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4 (TREE_BINFO_CHECK (NODE))
2113 #define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5 (TREE_BINFO_CHECK (NODE))
2114 #define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6 (TREE_BINFO_CHECK (NODE))
2115
2116 /* The actual data type node being inherited in this basetype.  */
2117 #define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK (NODE))
2118
2119 /* The offset where this basetype appears in its containing type.
2120    BINFO_OFFSET slot holds the offset (in bytes)
2121    from the base of the complete object to the base of the part of the
2122    object that is allocated on behalf of this `type'.
2123    This is always 0 except when there is multiple inheritance.  */
2124
2125 #define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK (NODE)->binfo.offset)
2126 #define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE)))
2127
2128 /* The virtual function table belonging to this basetype.  Virtual
2129    function tables provide a mechanism for run-time method dispatching.
2130    The entries of a virtual function table are language-dependent.  */
2131
2132 #define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtable)
2133
2134 /* The virtual functions in the virtual function table.  This is
2135    a TREE_LIST that is used as an initial approximation for building
2136    a virtual function table for this basetype.  */
2137 #define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK (NODE)->binfo.virtuals)
2138
2139 /* A vector of binfos for the direct basetypes inherited by this
2140    basetype.
2141
2142    If this basetype describes type D as inherited in C, and if the
2143    basetypes of D are E and F, then this vector contains binfos for
2144    inheritance of E and F by C.  */
2145 #define BINFO_BASE_BINFOS(NODE) (&TREE_BINFO_CHECK (NODE)->binfo.base_binfos)
2146
2147 /* The number of basetypes for NODE.  */
2148 #define BINFO_N_BASE_BINFOS(NODE) (BINFO_BASE_BINFOS (NODE)->length ())
2149
2150 /* Accessor macro to get to the Nth base binfo of this binfo.  */
2151 #define BINFO_BASE_BINFO(NODE,N) \
2152  ((*BINFO_BASE_BINFOS (NODE))[(N)])
2153 #define BINFO_BASE_ITERATE(NODE,N,B) \
2154  (BINFO_BASE_BINFOS (NODE)->iterate ((N), &(B)))
2155 #define BINFO_BASE_APPEND(NODE,T) \
2156  (BINFO_BASE_BINFOS (NODE)->quick_push ((T)))
2157
2158 /* For a BINFO record describing a virtual base class, i.e., one where
2159    TREE_VIA_VIRTUAL is set, this field assists in locating the virtual
2160    base.  The actual contents are language-dependent.  In the C++
2161    front-end this field is an INTEGER_CST giving an offset into the
2162    vtable where the offset to the virtual base can be found.  */
2163 #define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vptr_field)
2164
2165 /* Indicates the accesses this binfo has to its bases. The values are
2166    access_public_node, access_protected_node or access_private_node.
2167    If this array is not present, public access is implied.  */
2168 #define BINFO_BASE_ACCESSES(NODE) \
2169   (TREE_BINFO_CHECK (NODE)->binfo.base_accesses)
2170
2171 #define BINFO_BASE_ACCESS(NODE,N) \
2172   (*BINFO_BASE_ACCESSES (NODE))[(N)]
2173 #define BINFO_BASE_ACCESS_APPEND(NODE,T) \
2174   BINFO_BASE_ACCESSES (NODE)->quick_push ((T))
2175
2176 /* The index in the VTT where this subobject's sub-VTT can be found.
2177    NULL_TREE if there is no sub-VTT.  */
2178 #define BINFO_SUBVTT_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_subvtt)
2179
2180 /* The index in the VTT where the vptr for this subobject can be
2181    found.  NULL_TREE if there is no secondary vptr in the VTT.  */
2182 #define BINFO_VPTR_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_vptr)
2183
2184 /* The BINFO_INHERITANCE_CHAIN points at the binfo for the base
2185    inheriting this base for non-virtual bases. For virtual bases it
2186    points either to the binfo for which this is a primary binfo, or to
2187    the binfo of the most derived type.  */
2188 #define BINFO_INHERITANCE_CHAIN(NODE) \
2189         (TREE_BINFO_CHECK (NODE)->binfo.inheritance)
2190
2191
2192 /* Define fields and accessors for nodes representing declared names.  */
2193
2194 /* Nonzero if DECL represents an SSA name or a variable that can possibly
2195    have an associated SSA name.  */
2196 #define SSA_VAR_P(DECL)                                                 \
2197         (TREE_CODE (DECL) == VAR_DECL                                   \
2198          || TREE_CODE (DECL) == PARM_DECL                               \
2199          || TREE_CODE (DECL) == RESULT_DECL                             \
2200          || TREE_CODE (DECL) == SSA_NAME)
2201
2202
2203 #define DECL_CHAIN(NODE) (TREE_CHAIN (DECL_MINIMAL_CHECK (NODE)))
2204
2205 /* This is the name of the object as written by the user.
2206    It is an IDENTIFIER_NODE.  */
2207 #define DECL_NAME(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.name)
2208
2209 /* The IDENTIFIER_NODE associated with the TYPE_NAME field.  */
2210 #define TYPE_IDENTIFIER(NODE) \
2211   (TYPE_NAME (NODE) && DECL_P (TYPE_NAME (NODE)) \
2212    ? DECL_NAME (TYPE_NAME (NODE)) : TYPE_NAME (NODE))
2213
2214 /* Every ..._DECL node gets a unique number.  */
2215 #define DECL_UID(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.uid)
2216
2217 /* DEBUG_EXPR_DECLs get negative UID numbers, to catch erroneous
2218    uses.  */
2219 #define DEBUG_TEMP_UID(NODE) (-DECL_UID (TREE_CHECK ((NODE), DEBUG_EXPR_DECL)))
2220
2221 /* Every ..._DECL node gets a unique number that stays the same even
2222    when the decl is copied by the inliner once it is set.  */
2223 #define DECL_PT_UID(NODE) \
2224   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid == -1u \
2225    ? (NODE)->decl_minimal.uid : (NODE)->decl_common.pt_uid)
2226 /* Initialize the ..._DECL node pt-uid to the decls uid.  */
2227 #define SET_DECL_PT_UID(NODE, UID) \
2228   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid = (UID))
2229 /* Whether the ..._DECL node pt-uid has been initialized and thus needs to
2230    be preserved when copyin the decl.  */
2231 #define DECL_PT_UID_SET_P(NODE) \
2232   (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid != -1u)
2233
2234 /* These two fields describe where in the source code the declaration
2235    was.  If the declaration appears in several places (as for a C
2236    function that is declared first and then defined later), this
2237    information should refer to the definition.  */
2238 #define DECL_SOURCE_LOCATION(NODE) \
2239   (DECL_MINIMAL_CHECK (NODE)->decl_minimal.locus)
2240 #define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE))
2241 #define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE))
2242 #define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE))
2243 /* This accessor returns TRUE if the decl it operates on was created
2244    by a front-end or back-end rather than by user code.  In this case
2245    builtin-ness is indicated by source location.  */
2246 #define DECL_IS_BUILTIN(DECL) \
2247   (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)
2248
2249 #define DECL_LOCATION_RANGE(NODE) \
2250   (get_decl_source_range (DECL_MINIMAL_CHECK (NODE)))
2251
2252 /*  For FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or
2253     QUAL_UNION_TYPE node that the field is a member of.  For VAR_DECL,
2254     PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and CONST_DECL
2255     nodes, this points to either the FUNCTION_DECL for the containing
2256     function, the RECORD_TYPE or UNION_TYPE for the containing type, or
2257     NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file
2258     scope".  In particular, for VAR_DECLs which are virtual table pointers
2259     (they have DECL_VIRTUAL set), we use DECL_CONTEXT to determine the type
2260     they belong to.  */
2261 #define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context)
2262 #define DECL_FIELD_CONTEXT(NODE) \
2263   (FIELD_DECL_CHECK (NODE)->decl_minimal.context)
2264
2265 /* If nonzero, decl's name shouldn't be emitted into debug info.  */
2266 #define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.u.bits.nameless_flag)
2267
2268 /* For any sort of a ..._DECL node, this points to the original (abstract)
2269    decl node which this decl is an inlined/cloned instance of, or else it
2270    is NULL indicating that this decl is not an instance of some other decl.
2271
2272    The C front-end also uses this in a nested declaration of an inline
2273    function, to point back to the definition.  */
2274 #define DECL_ABSTRACT_ORIGIN(NODE) \
2275   (DECL_COMMON_CHECK (NODE)->decl_common.abstract_origin)
2276
2277 /* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract
2278    origin.  This is useful when setting the DECL_ABSTRACT_ORIGIN.  */
2279 #define DECL_ORIGIN(NODE) \
2280   (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : (NODE))
2281
2282 /* Nonzero for any sort of ..._DECL node means this decl node represents an
2283    inline instance of some original (abstract) decl from an inline function;
2284    suppress any warnings about shadowing some other variable.  FUNCTION_DECL
2285    nodes can also have their abstract origin set to themselves.  */
2286 #define DECL_FROM_INLINE(NODE) \
2287   (DECL_ABSTRACT_ORIGIN (NODE) != NULL_TREE \
2288    && DECL_ABSTRACT_ORIGIN (NODE) != (NODE))
2289
2290 /* In a DECL this is the field where attributes are stored.  */
2291 #define DECL_ATTRIBUTES(NODE) \
2292   (DECL_COMMON_CHECK (NODE)->decl_common.attributes)
2293
2294 /* For a FUNCTION_DECL, holds the tree of BINDINGs.
2295    For a TRANSLATION_UNIT_DECL, holds the namespace's BLOCK.
2296    For a VAR_DECL, holds the initial value.
2297    For a PARM_DECL, used for DECL_ARG_TYPE--default
2298    values for parameters are encoded in the type of the function,
2299    not in the PARM_DECL slot.
2300    For a FIELD_DECL, this is used for enumeration values and the C
2301    frontend uses it for temporarily storing bitwidth of bitfields.
2302
2303    ??? Need to figure out some way to check this isn't a PARM_DECL.  */
2304 #define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial)
2305
2306 /* Holds the size of the datum, in bits, as a tree expression.
2307    Need not be constant.  */
2308 #define DECL_SIZE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size)
2309 /* Likewise for the size in bytes.  */
2310 #define DECL_SIZE_UNIT(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size_unit)
2311 /* Returns the alignment required for the datum, in bits.  It must
2312    be a power of two, but an "alignment" of zero is supported
2313    (e.g. as "uninitialized" sentinel).  */
2314 #define DECL_ALIGN(NODE) \
2315     (DECL_COMMON_CHECK (NODE)->decl_common.align \
2316      ? ((unsigned)1) << ((NODE)->decl_common.align - 1) : 0)
2317 /* Specify that DECL_ALIGN(NODE) is X.  */
2318 #define SET_DECL_ALIGN(NODE, X) \
2319     (DECL_COMMON_CHECK (NODE)->decl_common.align = ffs_hwi (X))
2320
2321 /* The alignment of NODE, in bytes.  */
2322 #define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT)
2323 /* Set if the alignment of this DECL has been set by the user, for
2324    example with an 'aligned' attribute.  */
2325 #define DECL_USER_ALIGN(NODE) \
2326   (DECL_COMMON_CHECK (NODE)->base.u.bits.user_align)
2327 /* Holds the machine mode corresponding to the declaration of a variable or
2328    field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
2329    FIELD_DECL.  */
2330 #define DECL_MODE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.mode)
2331
2332 /* For FUNCTION_DECL, if it is built-in, this identifies which built-in
2333    operation it is.  Note, however, that this field is overloaded, with
2334    DECL_BUILT_IN_CLASS as the discriminant, so the latter must always be
2335    checked before any access to the former.  */
2336 #define DECL_FUNCTION_CODE(NODE) \
2337   (FUNCTION_DECL_CHECK (NODE)->function_decl.function_code)
2338
2339 #define DECL_FUNCTION_PERSONALITY(NODE) \
2340   (FUNCTION_DECL_CHECK (NODE)->function_decl.personality)
2341
2342 /* Nonzero for a given ..._DECL node means that the name of this node should
2343    be ignored for symbolic debug purposes.  For a TYPE_DECL, this means that
2344    the associated type should be ignored.  For a FUNCTION_DECL, the body of
2345    the function should also be ignored.  */
2346 #define DECL_IGNORED_P(NODE) \
2347   (DECL_COMMON_CHECK (NODE)->decl_common.ignored_flag)
2348
2349 /* Nonzero for a given ..._DECL node means that this node represents an
2350    "abstract instance" of the given declaration (e.g. in the original
2351    declaration of an inline function).  When generating symbolic debugging
2352    information, we mustn't try to generate any address information for nodes
2353    marked as "abstract instances" because we don't actually generate
2354    any code or allocate any data space for such instances.  */
2355 #define DECL_ABSTRACT_P(NODE) \
2356   (DECL_COMMON_CHECK (NODE)->decl_common.abstract_flag)
2357
2358 /* Language-specific decl information.  */
2359 #define DECL_LANG_SPECIFIC(NODE) \
2360   (DECL_COMMON_CHECK (NODE)->decl_common.lang_specific)
2361
2362 /* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference:
2363    do not allocate storage, and refer to a definition elsewhere.  Note that
2364    this does not necessarily imply the entity represented by NODE
2365    has no program source-level definition in this translation unit.  For
2366    example, for a FUNCTION_DECL, DECL_SAVED_TREE may be non-NULL and
2367    DECL_EXTERNAL may be true simultaneously; that can be the case for
2368    a C99 "extern inline" function.  */
2369 #define DECL_EXTERNAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.decl_flag_1)
2370
2371 /* Nonzero in a ..._DECL means this variable is ref'd from a nested function.
2372    For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes.
2373
2374    For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted.
2375
2376    Also set in some languages for variables, etc., outside the normal
2377    lexical scope, such as class instance variables.  */
2378 #define DECL_NONLOCAL(NODE) \
2379   (DECL_COMMON_CHECK (NODE)->decl_common.nonlocal_flag)
2380
2381 /* Used in VAR_DECLs to indicate that the variable is a vtable.
2382    Used in FIELD_DECLs for vtable pointers.
2383    Used in FUNCTION_DECLs to indicate that the function is virtual.  */
2384 #define DECL_VIRTUAL_P(NODE) \
2385   (DECL_COMMON_CHECK (NODE)->decl_common.virtual_flag)
2386
2387 /* Used to indicate that this DECL represents a compiler-generated entity.  */
2388 #define DECL_ARTIFICIAL(NODE) \
2389   (DECL_COMMON_CHECK (NODE)->decl_common.artificial_flag)
2390
2391 /* Additional flags for language-specific uses.  */
2392 #define DECL_LANG_FLAG_0(NODE) \
2393   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_0)
2394 #define DECL_LANG_FLAG_1(NODE) \
2395   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_1)
2396 #define DECL_LANG_FLAG_2(NODE) \
2397   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_2)
2398 #define DECL_LANG_FLAG_3(NODE) \
2399   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_3)
2400 #define DECL_LANG_FLAG_4(NODE) \
2401   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_4)
2402 #define DECL_LANG_FLAG_5(NODE) \
2403   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_5)
2404 #define DECL_LANG_FLAG_6(NODE) \
2405   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_6)
2406 #define DECL_LANG_FLAG_7(NODE) \
2407   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_7)
2408 #define DECL_LANG_FLAG_8(NODE) \
2409   (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_8)
2410
2411 /* Nonzero for a scope which is equal to file scope.  */
2412 #define SCOPE_FILE_SCOPE_P(EXP) \
2413   (! (EXP) || TREE_CODE (EXP) == TRANSLATION_UNIT_DECL)
2414 /* Nonzero for a decl which is at file scope.  */
2415 #define DECL_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (DECL_CONTEXT (EXP))
2416 /* Nonzero for a type which is at file scope.  */
2417 #define TYPE_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (TYPE_CONTEXT (EXP))
2418
2419 /* Nonzero for a decl that is decorated using attribute used.
2420    This indicates to compiler tools that this decl needs to be preserved.  */
2421 #define DECL_PRESERVE_P(DECL) \
2422   DECL_COMMON_CHECK (DECL)->decl_common.preserve_flag
2423
2424 /* For function local variables of COMPLEX and VECTOR types,
2425    indicates that the variable is not aliased, and that all
2426    modifications to the variable have been adjusted so that
2427    they are killing assignments.  Thus the variable may now
2428    be treated as a GIMPLE register, and use real instead of
2429    virtual ops in SSA form.  */
2430 #define DECL_GIMPLE_REG_P(DECL) \
2431   DECL_COMMON_CHECK (DECL)->decl_common.gimple_reg_flag
2432
2433 extern tree decl_value_expr_lookup (tree);
2434 extern void decl_value_expr_insert (tree, tree);
2435
2436 /* In a VAR_DECL or PARM_DECL, the location at which the value may be found,
2437    if transformations have made this more complicated than evaluating the
2438    decl itself.  This should only be used for debugging; once this field has
2439    been set, the decl itself may not legitimately appear in the function.  */
2440 #define DECL_HAS_VALUE_EXPR_P(NODE) \
2441   (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, RESULT_DECL) \
2442    ->decl_common.decl_flag_2)
2443 #define DECL_VALUE_EXPR(NODE) \
2444   (decl_value_expr_lookup (DECL_WRTL_CHECK (NODE)))
2445 #define SET_DECL_VALUE_EXPR(NODE, VAL) \
2446   (decl_value_expr_insert (DECL_WRTL_CHECK (NODE), VAL))
2447
2448 /* Holds the RTL expression for the value of a variable or function.
2449    This value can be evaluated lazily for functions, variables with
2450    static storage duration, and labels.  */
2451 #define DECL_RTL(NODE)                                  \
2452   (DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl            \
2453    ? (NODE)->decl_with_rtl.rtl                                  \
2454    : (make_decl_rtl (NODE), (NODE)->decl_with_rtl.rtl))
2455
2456 /* Set the DECL_RTL for NODE to RTL.  */
2457 #define SET_DECL_RTL(NODE, RTL) set_decl_rtl (NODE, RTL)
2458
2459 /* Returns nonzero if NODE is a tree node that can contain RTL.  */
2460 #define HAS_RTL_P(NODE) (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WRTL))
2461
2462 /* Returns nonzero if the DECL_RTL for NODE has already been set.  */
2463 #define DECL_RTL_SET_P(NODE) \
2464   (HAS_RTL_P (NODE) && DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl != NULL)
2465
2466 /* Copy the RTL from NODE1 to NODE2.  If the RTL was not set for
2467    NODE1, it will not be set for NODE2; this is a lazy copy.  */
2468 #define COPY_DECL_RTL(NODE1, NODE2) \
2469   (DECL_WRTL_CHECK (NODE2)->decl_with_rtl.rtl \
2470    = DECL_WRTL_CHECK (NODE1)->decl_with_rtl.rtl)
2471
2472 /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set.  */
2473 #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL)
2474
2475 #if (GCC_VERSION >= 2007)
2476 #define DECL_RTL_KNOWN_SET(decl) __extension__                          \
2477 ({  tree const __d = (decl);                                            \
2478     gcc_checking_assert (DECL_RTL_SET_P (__d));                         \
2479     /* Dereference it so the compiler knows it can't be NULL even       \
2480        without assertion checking.  */                                  \
2481     &*DECL_RTL_IF_SET (__d); })
2482 #else
2483 #define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl))
2484 #endif
2485
2486 /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'.  */
2487 #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0)
2488
2489 /* In a FIELD_DECL, this is the field position, counting in bytes, of the
2490    DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning
2491    of the structure.  */
2492 #define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset)
2493
2494 /* In a FIELD_DECL, this is the offset, in bits, of the first bit of the
2495    field from DECL_FIELD_OFFSET.  This field may be nonzero even for fields
2496    that are not bit fields (since DECL_OFFSET_ALIGN may be larger than the
2497    natural alignment of the field's type).  */
2498 #define DECL_FIELD_BIT_OFFSET(NODE) \
2499   (FIELD_DECL_CHECK (NODE)->field_decl.bit_offset)
2500
2501 /* In a FIELD_DECL, this indicates whether the field was a bit-field and
2502    if so, the type that was originally specified for it.
2503    TREE_TYPE may have been modified (in finish_struct).  */
2504 #define DECL_BIT_FIELD_TYPE(NODE) \
2505   (FIELD_DECL_CHECK (NODE)->field_decl.bit_field_type)
2506
2507 /* In a FIELD_DECL of a RECORD_TYPE, this is a pointer to the storage
2508    representative FIELD_DECL.  */
2509 #define DECL_BIT_FIELD_REPRESENTATIVE(NODE) \
2510   (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
2511
2512 /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
2513    if nonzero, indicates that the field occupies the type.  */
2514 #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.qualifier)
2515
2516 /* For FIELD_DECLs, off_align holds the number of low-order bits of
2517    DECL_FIELD_OFFSET which are known to be always zero.
2518    DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET
2519    has.  */
2520 #define DECL_OFFSET_ALIGN(NODE) \
2521   (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.off_align)
2522
2523 /* Specify that DECL_OFFSET_ALIGN(NODE) is X.  */
2524 #define SET_DECL_OFFSET_ALIGN(NODE, X) \
2525   (FIELD_DECL_CHECK (NODE)->decl_common.off_align = ffs_hwi (X) - 1)
2526
2527 /* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in
2528    which this FIELD_DECL is defined.  This information is needed when
2529    writing debugging information about vfield and vbase decls for C++.  */
2530 #define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext)
2531
2532 /* In a FIELD_DECL, indicates this field should be bit-packed.  */
2533 #define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.u.bits.packed_flag)
2534
2535 /* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed
2536    specially.  */
2537 #define DECL_BIT_FIELD(NODE) (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_1)
2538
2539 /* Used in a FIELD_DECL to indicate that we cannot form the address of
2540    this component.  This makes it possible for Type-Based Alias Analysis
2541    to disambiguate accesses to this field with indirect accesses using
2542    the field's type:
2543
2544      struct S { int i; } s;
2545      int *p;
2546
2547    If the flag is set on 'i', TBAA computes that s.i and *p never conflict.
2548
2549    From the implementation's viewpoint, the alias set of the type of the
2550    field 'i' (int) will not be recorded as a subset of that of the type of
2551    's' (struct S) in record_component_aliases.  The counterpart is that
2552    accesses to s.i must not be given the alias set of the type of 'i'
2553    (int) but instead directly that of the type of 's' (struct S).  */
2554 #define DECL_NONADDRESSABLE_P(NODE) \
2555   (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_2)
2556
2557 /* A numeric unique identifier for a LABEL_DECL.  The UID allocation is
2558    dense, unique within any one function, and may be used to index arrays.
2559    If the value is -1, then no UID has been assigned.  */
2560 #define LABEL_DECL_UID(NODE) \
2561   (LABEL_DECL_CHECK (NODE)->label_decl.label_decl_uid)
2562
2563 /* In a LABEL_DECL, the EH region number for which the label is the
2564    post_landing_pad.  */
2565 #define EH_LANDING_PAD_NR(NODE) \
2566   (LABEL_DECL_CHECK (NODE)->label_decl.eh_landing_pad_nr)
2567
2568 /* For a PARM_DECL, records the data type used to pass the argument,
2569    which may be different from the type seen in the program.  */
2570 #define DECL_ARG_TYPE(NODE) (PARM_DECL_CHECK (NODE)->decl_common.initial)
2571
2572 /* For PARM_DECL, holds an RTL for the stack slot or register
2573    where the data was actually passed.  */
2574 #define DECL_INCOMING_RTL(NODE) \
2575   (PARM_DECL_CHECK (NODE)->parm_decl.incoming_rtl)
2576
2577 /* Nonzero for a given ..._DECL node means that no warnings should be
2578    generated just because this node is unused.  */
2579 #define DECL_IN_SYSTEM_HEADER(NODE) \
2580   (in_system_header_at (DECL_SOURCE_LOCATION (NODE)))
2581
2582 /* Used to indicate that the linkage status of this DECL is not yet known,
2583    so it should not be output now.  */
2584 #define DECL_DEFER_OUTPUT(NODE) \
2585   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.defer_output)
2586
2587 /* In a VAR_DECL that's static,
2588    nonzero if the space is in the text section.  */
2589 #define DECL_IN_TEXT_SECTION(NODE) \
2590   (VAR_DECL_CHECK (NODE)->decl_with_vis.in_text_section)
2591
2592 /* In a VAR_DECL that's static,
2593    nonzero if it belongs to the global constant pool.  */
2594 #define DECL_IN_CONSTANT_POOL(NODE) \
2595   (VAR_DECL_CHECK (NODE)->decl_with_vis.in_constant_pool)
2596
2597 /* Nonzero for a given ..._DECL node means that this node should be
2598    put in .common, if possible.  If a DECL_INITIAL is given, and it
2599    is not error_mark_node, then the decl cannot be put in .common.  */
2600 #define DECL_COMMON(NODE) \
2601   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.common_flag)
2602
2603 /* In a VAR_DECL, nonzero if the decl is a register variable with
2604    an explicit asm specification.  */
2605 #define DECL_HARD_REGISTER(NODE)  \
2606   (VAR_DECL_CHECK (NODE)->decl_with_vis.hard_register)
2607
2608   /* Used to indicate that this DECL has weak linkage.  */
2609 #define DECL_WEAK(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.weak_flag)
2610
2611 /* Used to indicate that the DECL is a dllimport.  */
2612 #define DECL_DLLIMPORT_P(NODE) \
2613   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.dllimport_flag)
2614
2615 /* Used in a DECL to indicate that, even if it TREE_PUBLIC, it need
2616    not be put out unless it is needed in this translation unit.
2617    Entities like this are shared across translation units (like weak
2618    entities), but are guaranteed to be generated by any translation
2619    unit that needs them, and therefore need not be put out anywhere
2620    where they are not needed.  DECL_COMDAT is just a hint to the
2621    back-end; it is up to front-ends which set this flag to ensure
2622    that there will never be any harm, other than bloat, in putting out
2623    something which is DECL_COMDAT.  */
2624 #define DECL_COMDAT(NODE) \
2625   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_flag)
2626
2627 #define DECL_COMDAT_GROUP(NODE) \
2628   decl_comdat_group (NODE)
2629
2630 /* Used in TREE_PUBLIC decls to indicate that copies of this DECL in
2631    multiple translation units should be merged.  */
2632 #define DECL_ONE_ONLY(NODE) (DECL_COMDAT_GROUP (NODE) != NULL_TREE \
2633                              && (TREE_PUBLIC (NODE) || DECL_EXTERNAL (NODE)))
2634
2635 /* The name of the object as the assembler will see it (but before any
2636    translations made by ASM_OUTPUT_LABELREF).  Often this is the same
2637    as DECL_NAME.  It is an IDENTIFIER_NODE.
2638
2639    ASSEMBLER_NAME of TYPE_DECLS may store global name of type used for
2640    One Definition Rule based type merging at LTO.  It is computed only for
2641    LTO compilation and C++.  */
2642 #define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE)
2643
2644 /* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME.
2645    This is true of all DECL nodes except FIELD_DECL.  */
2646 #define HAS_DECL_ASSEMBLER_NAME_P(NODE) \
2647   (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WITH_VIS))
2648
2649 /* Returns nonzero if the DECL_ASSEMBLER_NAME for NODE has been set.  If zero,
2650    the NODE might still have a DECL_ASSEMBLER_NAME -- it just hasn't been set
2651    yet.  */
2652 #define DECL_ASSEMBLER_NAME_SET_P(NODE) \
2653   (HAS_DECL_ASSEMBLER_NAME_P (NODE) \
2654    && DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name != NULL_TREE)
2655
2656 /* Set the DECL_ASSEMBLER_NAME for NODE to NAME.  */
2657 #define SET_DECL_ASSEMBLER_NAME(NODE, NAME) \
2658   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name = (NAME))
2659
2660 /* Copy the DECL_ASSEMBLER_NAME from DECL1 to DECL2.  Note that if DECL1's
2661    DECL_ASSEMBLER_NAME has not yet been set, using this macro will not cause
2662    the DECL_ASSEMBLER_NAME of either DECL to be set.  In other words, the
2663    semantics of using this macro, are different than saying:
2664
2665      SET_DECL_ASSEMBLER_NAME(DECL2, DECL_ASSEMBLER_NAME (DECL1))
2666
2667    which will try to set the DECL_ASSEMBLER_NAME for DECL1.  */
2668
2669 #define COPY_DECL_ASSEMBLER_NAME(DECL1, DECL2)                          \
2670   (DECL_ASSEMBLER_NAME_SET_P (DECL1)                                    \
2671    ? (void) SET_DECL_ASSEMBLER_NAME (DECL2,                             \
2672                                      DECL_ASSEMBLER_NAME (DECL1))       \
2673    : (void) 0)
2674
2675 /* Records the section name in a section attribute.  Used to pass
2676    the name from decl_attributes to make_function_rtl and make_decl_rtl.  */
2677 #define DECL_SECTION_NAME(NODE) decl_section_name (NODE)
2678
2679 /* Nonzero in a decl means that the gimplifier has seen (or placed)
2680    this variable in a BIND_EXPR.  */
2681 #define DECL_SEEN_IN_BIND_EXPR_P(NODE) \
2682   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.seen_in_bind_expr)
2683
2684 /* Value of the decls's visibility attribute */
2685 #define DECL_VISIBILITY(NODE) \
2686   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility)
2687
2688 /* Nonzero means that the decl had its visibility specified rather than
2689    being inferred.  */
2690 #define DECL_VISIBILITY_SPECIFIED(NODE) \
2691   (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility_specified)
2692
2693 /* In a VAR_DECL, the model to use if the data should be allocated from
2694    thread-local storage.  */
2695 #define DECL_TLS_MODEL(NODE) decl_tls_model (NODE)
2696
2697 /* In a VAR_DECL, nonzero if the data should be allocated from
2698    thread-local storage.  */
2699 #define DECL_THREAD_LOCAL_P(NODE) \
2700   ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >= TLS_MODEL_REAL)
2701
2702 /* In a non-local VAR_DECL with static storage duration, true if the
2703    variable has an initialization priority.  If false, the variable
2704    will be initialized at the DEFAULT_INIT_PRIORITY.  */
2705 #define DECL_HAS_INIT_PRIORITY_P(NODE) \
2706   (VAR_DECL_CHECK (NODE)->decl_with_vis.init_priority_p)
2707
2708 extern tree decl_debug_expr_lookup (tree);
2709 extern void decl_debug_expr_insert (tree, tree);
2710
2711 /* For VAR_DECL, this is set to an expression that it was split from.  */
2712 #define DECL_HAS_DEBUG_EXPR_P(NODE) \
2713   (VAR_DECL_CHECK (NODE)->decl_common.debug_expr_is_from)
2714 #define DECL_DEBUG_EXPR(NODE) \
2715   (decl_debug_expr_lookup (VAR_DECL_CHECK (NODE)))
2716
2717 #define SET_DECL_DEBUG_EXPR(NODE, VAL) \
2718   (decl_debug_expr_insert (VAR_DECL_CHECK (NODE), VAL))
2719
2720 extern priority_type decl_init_priority_lookup (tree);
2721 extern priority_type decl_fini_priority_lookup (tree);
2722 extern void decl_init_priority_insert (tree, priority_type);
2723 extern void decl_fini_priority_insert (tree, priority_type);
2724
2725 /* For a VAR_DECL or FUNCTION_DECL the initialization priority of
2726    NODE.  */
2727 #define DECL_INIT_PRIORITY(NODE) \
2728   (decl_init_priority_lookup (NODE))
2729 /* Set the initialization priority for NODE to VAL.  */
2730 #define SET_DECL_INIT_PRIORITY(NODE, VAL) \
2731   (decl_init_priority_insert (NODE, VAL))
2732
2733 /* For a FUNCTION_DECL the finalization priority of NODE.  */
2734 #define DECL_FINI_PRIORITY(NODE) \
2735   (decl_fini_priority_lookup (NODE))
2736 /* Set the finalization priority for NODE to VAL.  */
2737 #define SET_DECL_FINI_PRIORITY(NODE, VAL) \
2738   (decl_fini_priority_insert (NODE, VAL))
2739
2740 /* The initialization priority for entities for which no explicit
2741    initialization priority has been specified.  */
2742 #define DEFAULT_INIT_PRIORITY 65535
2743
2744 /* The maximum allowed initialization priority.  */
2745 #define MAX_INIT_PRIORITY 65535
2746
2747 /* The largest priority value reserved for use by system runtime
2748    libraries.  */
2749 #define MAX_RESERVED_INIT_PRIORITY 100
2750
2751 /* In a VAR_DECL, nonzero if this is a global variable for VOPs.  */
2752 #define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \
2753   (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag)
2754
2755 /* In a VAR_DECL, nonzero if this is a non-local frame structure.  */
2756 #define DECL_NONLOCAL_FRAME(NODE)  \
2757   (VAR_DECL_CHECK (NODE)->base.default_def_flag)
2758
2759 /* In a VAR_DECL, nonzero if this variable is not aliased by any pointer.  */
2760 #define DECL_NONALIASED(NODE) \
2761   (VAR_DECL_CHECK (NODE)->base.nothrow_flag)
2762
2763 /* This field is used to reference anything in decl.result and is meant only
2764    for use by the garbage collector.  */
2765 #define DECL_RESULT_FLD(NODE) \
2766   (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.result)
2767
2768 /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
2769    Before the struct containing the FUNCTION_DECL is laid out,
2770    DECL_VINDEX may point to a FUNCTION_DECL in a base class which
2771    is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
2772    function.  When the class is laid out, this pointer is changed
2773    to an INTEGER_CST node which is suitable for use as an index
2774    into the virtual function table. */
2775 #define DECL_VINDEX(NODE) \
2776   (FUNCTION_DECL_CHECK (NODE)->function_decl.vindex)
2777
2778 /* In FUNCTION_DECL, holds the decl for the return value.  */
2779 #define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.result)
2780
2781 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined.  */
2782 #define DECL_UNINLINABLE(NODE) \
2783   (FUNCTION_DECL_CHECK (NODE)->function_decl.uninlinable)
2784
2785 /* In a FUNCTION_DECL, the saved representation of the body of the
2786    entire function.  */
2787 #define DECL_SAVED_TREE(NODE) \
2788   (FUNCTION_DECL_CHECK (NODE)->function_decl.saved_tree)
2789
2790 /* Nonzero in a FUNCTION_DECL means this function should be treated
2791    as if it were a malloc, meaning it returns a pointer that is
2792    not an alias.  */
2793 #define DECL_IS_MALLOC(NODE) \
2794   (FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag)
2795
2796 /* Nonzero in a FUNCTION_DECL means this function should be treated as
2797    C++ operator new, meaning that it returns a pointer for which we
2798    should not use type based aliasing.  */
2799 #define DECL_IS_OPERATOR_NEW(NODE) \
2800   (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag)
2801
2802 /* Nonzero in a FUNCTION_DECL means this function may return more
2803    than once.  */
2804 #define DECL_IS_RETURNS_TWICE(NODE) \
2805   (FUNCTION_DECL_CHECK (NODE)->function_decl.returns_twice_flag)
2806
2807 /* Nonzero in a FUNCTION_DECL means this function should be treated
2808    as "pure" function (like const function, but may read global memory).  */
2809 #define DECL_PURE_P(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.pure_flag)
2810
2811 /* Nonzero only if one of TREE_READONLY or DECL_PURE_P is nonzero AND
2812    the const or pure function may not terminate.  When this is nonzero
2813    for a const or pure function, it can be dealt with by cse passes
2814    but cannot be removed by dce passes since you are not allowed to
2815    change an infinite looping program into one that terminates without
2816    error.  */
2817 #define DECL_LOOPING_CONST_OR_PURE_P(NODE) \
2818   (FUNCTION_DECL_CHECK (NODE)->function_decl.looping_const_or_pure_flag)
2819
2820 /* Nonzero in a FUNCTION_DECL means this function should be treated
2821    as "novops" function (function that does not read global memory,
2822    but may have arbitrary side effects).  */
2823 #define DECL_IS_NOVOPS(NODE) \
2824   (FUNCTION_DECL_CHECK (NODE)->function_decl.novops_flag)
2825
2826 /* Used in FUNCTION_DECLs to indicate that they should be run automatically
2827    at the beginning or end of execution.  */
2828 #define DECL_STATIC_CONSTRUCTOR(NODE) \
2829   (FUNCTION_DECL_CHECK (NODE)->function_decl.static_ctor_flag)
2830
2831 #define DECL_STATIC_DESTRUCTOR(NODE) \
2832 (FUNCTION_DECL_CHECK (NODE)->function_decl.static_dtor_flag)
2833
2834 /* Used in FUNCTION_DECLs to indicate that function entry and exit should
2835    be instrumented with calls to support routines.  */
2836 #define DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT(NODE) \
2837   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_instrument_function_entry_exit)
2838
2839 /* Used in FUNCTION_DECLs to indicate that limit-stack-* should be
2840    disabled in this function.  */
2841 #define DECL_NO_LIMIT_STACK(NODE) \
2842   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_limit_stack)
2843
2844 /* In a FUNCTION_DECL indicates that a static chain is needed.  */
2845 #define DECL_STATIC_CHAIN(NODE) \
2846   (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.regdecl_flag)
2847
2848 /* Nonzero for a decl that cgraph has decided should be inlined into
2849    at least one call site.  It is not meaningful to look at this
2850    directly; always use cgraph_function_possibly_inlined_p.  */
2851 #define DECL_POSSIBLY_INLINED(DECL) \
2852   FUNCTION_DECL_CHECK (DECL)->function_decl.possibly_inlined
2853
2854 /* Nonzero in a FUNCTION_DECL means that this function was declared inline,
2855    such as via the `inline' keyword in C/C++.  This flag controls the linkage
2856    semantics of 'inline'  */
2857 #define DECL_DECLARED_INLINE_P(NODE) \
2858   (FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag)
2859
2860 /* Nonzero in a FUNCTION_DECL means this function should not get
2861    -Winline warnings.  */
2862 #define DECL_NO_INLINE_WARNING_P(NODE) \
2863   (FUNCTION_DECL_CHECK (NODE)->function_decl.no_inline_warning_flag)
2864
2865 /* Nonzero if a FUNCTION_CODE is a TM load/store.  */
2866 #define BUILTIN_TM_LOAD_STORE_P(FN) \
2867   ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE)
2868
2869 /* Nonzero if a FUNCTION_CODE is a TM load.  */
2870 #define BUILTIN_TM_LOAD_P(FN) \
2871   ((FN) >= BUILT_IN_TM_LOAD_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE)
2872
2873 /* Nonzero if a FUNCTION_CODE is a TM store.  */
2874 #define BUILTIN_TM_STORE_P(FN) \
2875   ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_STORE_WAW_LDOUBLE)
2876
2877 #define CASE_BUILT_IN_TM_LOAD(FN)       \
2878   case BUILT_IN_TM_LOAD_##FN:           \
2879   case BUILT_IN_TM_LOAD_RAR_##FN:       \
2880   case BUILT_IN_TM_LOAD_RAW_##FN:       \
2881   case BUILT_IN_TM_LOAD_RFW_##FN
2882
2883 #define CASE_BUILT_IN_TM_STORE(FN)      \
2884   case BUILT_IN_TM_STORE_##FN:          \
2885   case BUILT_IN_TM_STORE_WAR_##FN:      \
2886   case BUILT_IN_TM_STORE_WAW_##FN
2887
2888 /* Nonzero in a FUNCTION_DECL that should be always inlined by the inliner
2889    disregarding size and cost heuristics.  This is equivalent to using
2890    the always_inline attribute without the required diagnostics if the
2891    function cannot be inlined.  */
2892 #define DECL_DISREGARD_INLINE_LIMITS(NODE) \
2893   (FUNCTION_DECL_CHECK (NODE)->function_decl.disregard_inline_limits)
2894
2895 extern vec<tree, va_gc> **decl_debug_args_lookup (tree);
2896 extern vec<tree, va_gc> **decl_debug_args_insert (tree);
2897
2898 /* Nonzero if a FUNCTION_DECL has DEBUG arguments attached to it.  */
2899 #define DECL_HAS_DEBUG_ARGS_P(NODE) \
2900   (FUNCTION_DECL_CHECK (NODE)->function_decl.has_debug_args_flag)
2901
2902 /* For FUNCTION_DECL, this holds a pointer to a structure ("struct function")
2903    that describes the status of this function.  */
2904 #define DECL_STRUCT_FUNCTION(NODE) \
2905   (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
2906
2907 /* In a FUNCTION_DECL, nonzero means a built in function of a
2908    standard library or more generally a built in function that is
2909    recognized by optimizers and expanders.
2910
2911    Note that it is different from the DECL_IS_BUILTIN accessor.  For
2912    instance, user declared prototypes of C library functions are not
2913    DECL_IS_BUILTIN but may be DECL_BUILT_IN.  */
2914 #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
2915
2916 /* For a builtin function, identify which part of the compiler defined it.  */
2917 #define DECL_BUILT_IN_CLASS(NODE) \
2918    (FUNCTION_DECL_CHECK (NODE)->function_decl.built_in_class)
2919
2920 /* In FUNCTION_DECL, a chain of ..._DECL nodes.  */
2921 #define DECL_ARGUMENTS(NODE) \
2922    (FUNCTION_DECL_CHECK (NODE)->function_decl.arguments)
2923
2924 /* In FUNCTION_DECL, the function specific target options to use when compiling
2925    this function.  */
2926 #define DECL_FUNCTION_SPECIFIC_TARGET(NODE) \
2927    (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_target)
2928
2929 /* In FUNCTION_DECL, the function specific optimization options to use when
2930    compiling this function.  */
2931 #define DECL_FUNCTION_SPECIFIC_OPTIMIZATION(NODE) \
2932    (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_optimization)
2933
2934 /* In FUNCTION_DECL, this is set if this function has other versions generated
2935    using "target" attributes.  The default version is the one which does not
2936    have any "target" attribute set. */
2937 #define DECL_FUNCTION_VERSIONED(NODE)\
2938    (FUNCTION_DECL_CHECK (NODE)->function_decl.versioned_function)
2939
2940 /* In FUNCTION_DECL, this is set if this function is a C++ constructor.
2941    Devirtualization machinery uses this knowledge for determing type of the
2942    object constructed.  Also we assume that constructor address is not
2943    important.  */
2944 #define DECL_CXX_CONSTRUCTOR_P(NODE)\
2945    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_constructor)
2946
2947 /* In FUNCTION_DECL, this is set if this function is a C++ destructor.
2948    Devirtualization machinery uses this to track types in destruction.  */
2949 #define DECL_CXX_DESTRUCTOR_P(NODE)\
2950    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_destructor)
2951
2952 /* In FUNCTION_DECL that represent an virtual method this is set when
2953    the method is final.  */
2954 #define DECL_FINAL_P(NODE)\
2955    (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.final)
2956
2957 /* The source language of the translation-unit.  */
2958 #define TRANSLATION_UNIT_LANGUAGE(NODE) \
2959   (TRANSLATION_UNIT_DECL_CHECK (NODE)->translation_unit_decl.language)
2960
2961 /* TRANSLATION_UNIT_DECL inherits from DECL_MINIMAL.  */
2962
2963 /* For a TYPE_DECL, holds the "original" type.  (TREE_TYPE has the copy.) */
2964 #define DECL_ORIGINAL_TYPE(NODE) \
2965   (TYPE_DECL_CHECK (NODE)->decl_non_common.result)
2966
2967 /* In a TYPE_DECL nonzero means the detail info about this type is not dumped
2968    into stabs.  Instead it will generate cross reference ('x') of names.
2969    This uses the same flag as DECL_EXTERNAL.  */
2970 #define TYPE_DECL_SUPPRESS_DEBUG(NODE) \
2971   (TYPE_DECL_CHECK (NODE)->decl_common.decl_flag_1)
2972
2973 /* Getter of the imported declaration associated to the
2974    IMPORTED_DECL node.  */
2975 #define IMPORTED_DECL_ASSOCIATED_DECL(NODE) \
2976 (DECL_INITIAL (IMPORTED_DECL_CHECK (NODE)))
2977
2978 /* Getter of the symbol declaration associated with the
2979    NAMELIST_DECL node.  */
2980 #define NAMELIST_DECL_ASSOCIATED_DECL(NODE) \
2981   (DECL_INITIAL (NODE))
2982
2983 /* A STATEMENT_LIST chains statements together in GENERIC and GIMPLE.
2984    To reduce overhead, the nodes containing the statements are not trees.
2985    This avoids the overhead of tree_common on all linked list elements.
2986
2987    Use the interface in tree-iterator.h to access this node.  */
2988
2989 #define STATEMENT_LIST_HEAD(NODE) \
2990   (STATEMENT_LIST_CHECK (NODE)->stmt_list.head)
2991 #define STATEMENT_LIST_TAIL(NODE) \
2992   (STATEMENT_LIST_CHECK (NODE)->stmt_list.tail)
2993
2994 #define TREE_OPTIMIZATION(NODE) \
2995   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts)
2996
2997 #define TREE_OPTIMIZATION_OPTABS(NODE) \
2998   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs)
2999
3000 #define TREE_OPTIMIZATION_BASE_OPTABS(NODE) \
3001   (OPTIMIZATION_NODE_CHECK (NODE)->optimization.base_optabs)
3002
3003 /* Return a tree node that encapsulates the optimization options in OPTS.  */
3004 extern tree build_optimization_node (struct gcc_options *opts);
3005
3006 #define TREE_TARGET_OPTION(NODE) \
3007   (TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts)
3008
3009 #define TREE_TARGET_GLOBALS(NODE) \
3010   (TARGET_OPTION_NODE_CHECK (NODE)->target_option.globals)
3011
3012 /* Return a tree node that encapsulates the target options in OPTS.  */
3013 extern tree build_target_option_node (struct gcc_options *opts);
3014
3015 extern void prepare_target_option_nodes_for_pch (void);
3016
3017 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
3018
3019 inline tree
3020 tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c)
3021 {
3022   if (TREE_CODE (__t) != __c)
3023     tree_check_failed (__t, __f, __l, __g, __c, 0);
3024   return __t;
3025 }
3026
3027 inline tree
3028 tree_not_check (tree __t, const char *__f, int __l, const char *__g,
3029                 enum tree_code __c)
3030 {
3031   if (TREE_CODE (__t) == __c)
3032     tree_not_check_failed (__t, __f, __l, __g, __c, 0);
3033   return __t;
3034 }
3035
3036 inline tree
3037 tree_check2 (tree __t, const char *__f, int __l, const char *__g,
3038              enum tree_code __c1, enum tree_code __c2)
3039 {
3040   if (TREE_CODE (__t) != __c1
3041       && TREE_CODE (__t) != __c2)
3042     tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
3043   return __t;
3044 }
3045
3046 inline tree
3047 tree_not_check2 (tree __t, const char *__f, int __l, const char *__g,
3048                  enum tree_code __c1, enum tree_code __c2)
3049 {
3050   if (TREE_CODE (__t) == __c1
3051       || TREE_CODE (__t) == __c2)
3052     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
3053   return __t;
3054 }
3055
3056 inline tree
3057 tree_check3 (tree __t, const char *__f, int __l, const char *__g,
3058              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
3059 {
3060   if (TREE_CODE (__t) != __c1
3061       && TREE_CODE (__t) != __c2
3062       && TREE_CODE (__t) != __c3)
3063     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
3064   return __t;
3065 }
3066
3067 inline tree
3068 tree_not_check3 (tree __t, const char *__f, int __l, const char *__g,
3069                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
3070 {
3071   if (TREE_CODE (__t) == __c1
3072       || TREE_CODE (__t) == __c2
3073       || TREE_CODE (__t) == __c3)
3074     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
3075   return __t;
3076 }
3077
3078 inline tree
3079 tree_check4 (tree __t, const char *__f, int __l, const char *__g,
3080              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3081              enum tree_code __c4)
3082 {
3083   if (TREE_CODE (__t) != __c1
3084       && TREE_CODE (__t) != __c2
3085       && TREE_CODE (__t) != __c3
3086       && TREE_CODE (__t) != __c4)
3087     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
3088   return __t;
3089 }
3090
3091 inline tree
3092 tree_not_check4 (tree __t, const char *__f, int __l, const char *__g,
3093                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3094                  enum tree_code __c4)
3095 {
3096   if (TREE_CODE (__t) == __c1
3097       || TREE_CODE (__t) == __c2
3098       || TREE_CODE (__t) == __c3
3099       || TREE_CODE (__t) == __c4)
3100     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
3101   return __t;
3102 }
3103
3104 inline tree
3105 tree_check5 (tree __t, const char *__f, int __l, const char *__g,
3106              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3107              enum tree_code __c4, enum tree_code __c5)
3108 {
3109   if (TREE_CODE (__t) != __c1
3110       && TREE_CODE (__t) != __c2
3111       && TREE_CODE (__t) != __c3
3112       && TREE_CODE (__t) != __c4
3113       && TREE_CODE (__t) != __c5)
3114     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
3115   return __t;
3116 }
3117
3118 inline tree
3119 tree_not_check5 (tree __t, const char *__f, int __l, const char *__g,
3120                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3121                  enum tree_code __c4, enum tree_code __c5)
3122 {
3123   if (TREE_CODE (__t) == __c1
3124       || TREE_CODE (__t) == __c2
3125       || TREE_CODE (__t) == __c3
3126       || TREE_CODE (__t) == __c4
3127       || TREE_CODE (__t) == __c5)
3128     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
3129   return __t;
3130 }
3131
3132 inline tree
3133 contains_struct_check (tree __t, const enum tree_node_structure_enum __s,
3134                        const char *__f, int __l, const char *__g)
3135 {
3136   if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
3137       tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
3138   return __t;
3139 }
3140
3141 inline tree
3142 tree_class_check (tree __t, const enum tree_code_class __class,
3143                   const char *__f, int __l, const char *__g)
3144 {
3145   if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
3146     tree_class_check_failed (__t, __class, __f, __l, __g);
3147   return __t;
3148 }
3149
3150 inline tree
3151 tree_range_check (tree __t,
3152                   enum tree_code __code1, enum tree_code __code2,
3153                   const char *__f, int __l, const char *__g)
3154 {
3155   if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2)
3156     tree_range_check_failed (__t, __f, __l, __g, __code1, __code2);
3157   return __t;
3158 }
3159
3160 inline tree
3161 omp_clause_subcode_check (tree __t, enum omp_clause_code __code,
3162                           const char *__f, int __l, const char *__g)
3163 {
3164   if (TREE_CODE (__t) != OMP_CLAUSE)
3165     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3166   if (__t->omp_clause.code != __code)
3167     omp_clause_check_failed (__t, __f, __l, __g, __code);
3168   return __t;
3169 }
3170
3171 inline tree
3172 omp_clause_range_check (tree __t,
3173                         enum omp_clause_code __code1,
3174                         enum omp_clause_code __code2,
3175                         const char *__f, int __l, const char *__g)
3176 {
3177   if (TREE_CODE (__t) != OMP_CLAUSE)
3178     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3179   if ((int) __t->omp_clause.code < (int) __code1
3180       || (int) __t->omp_clause.code > (int) __code2)
3181     omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2);
3182   return __t;
3183 }
3184
3185 /* These checks have to be special cased.  */
3186
3187 inline tree
3188 expr_check (tree __t, const char *__f, int __l, const char *__g)
3189 {
3190   char const __c = TREE_CODE_CLASS (TREE_CODE (__t));
3191   if (!IS_EXPR_CODE_CLASS (__c))
3192     tree_class_check_failed (__t, tcc_expression, __f, __l, __g);
3193   return __t;
3194 }
3195
3196 /* These checks have to be special cased.  */
3197
3198 inline tree
3199 non_type_check (tree __t, const char *__f, int __l, const char *__g)
3200 {
3201   if (TYPE_P (__t))
3202     tree_not_class_check_failed (__t, tcc_type, __f, __l, __g);
3203   return __t;
3204 }
3205
3206 inline const HOST_WIDE_INT *
3207 tree_int_cst_elt_check (const_tree __t, int __i,
3208                         const char *__f, int __l, const char *__g)
3209 {
3210   if (TREE_CODE (__t) != INTEGER_CST)
3211     tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0);
3212   if (__i < 0 || __i >= __t->base.u.int_length.extended)
3213     tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended,
3214                                    __f, __l, __g);
3215   return &CONST_CAST_TREE (__t)->int_cst.val[__i];
3216 }
3217
3218 inline HOST_WIDE_INT *
3219 tree_int_cst_elt_check (tree __t, int __i,
3220                         const char *__f, int __l, const char *__g)
3221 {
3222   if (TREE_CODE (__t) != INTEGER_CST)
3223     tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0);
3224   if (__i < 0 || __i >= __t->base.u.int_length.extended)
3225     tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended,
3226                                    __f, __l, __g);
3227   return &CONST_CAST_TREE (__t)->int_cst.val[__i];
3228 }
3229
3230 /* Workaround -Wstrict-overflow false positive during profiledbootstrap.  */
3231
3232 # if GCC_VERSION >= 4006
3233 #pragma GCC diagnostic push
3234 #pragma GCC diagnostic ignored "-Wstrict-overflow"
3235 #endif
3236
3237 inline tree *
3238 tree_vec_elt_check (tree __t, int __i,
3239                     const char *__f, int __l, const char *__g)
3240 {
3241   if (TREE_CODE (__t) != TREE_VEC)
3242     tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
3243   if (__i < 0 || __i >= __t->base.u.length)
3244     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
3245   return &CONST_CAST_TREE (__t)->vec.a[__i];
3246 }
3247
3248 # if GCC_VERSION >= 4006
3249 #pragma GCC diagnostic pop
3250 #endif
3251
3252 inline tree *
3253 omp_clause_elt_check (tree __t, int __i,
3254                       const char *__f, int __l, const char *__g)
3255 {
3256   if (TREE_CODE (__t) != OMP_CLAUSE)
3257     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3258   if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code])
3259     omp_clause_operand_check_failed (__i, __t, __f, __l, __g);
3260   return &__t->omp_clause.ops[__i];
3261 }
3262
3263 /* These checks have to be special cased.  */
3264
3265 inline tree
3266 any_integral_type_check (tree __t, const char *__f, int __l, const char *__g)
3267 {
3268   if (!ANY_INTEGRAL_TYPE_P (__t))
3269     tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE,
3270                        INTEGER_TYPE, 0);
3271   return __t;
3272 }
3273
3274 inline const_tree
3275 tree_check (const_tree __t, const char *__f, int __l, const char *__g,
3276             tree_code __c)
3277 {
3278   if (TREE_CODE (__t) != __c)
3279     tree_check_failed (__t, __f, __l, __g, __c, 0);
3280   return __t;
3281 }
3282
3283 inline const_tree
3284 tree_not_check (const_tree __t, const char *__f, int __l, const char *__g,
3285                 enum tree_code __c)
3286 {
3287   if (TREE_CODE (__t) == __c)
3288     tree_not_check_failed (__t, __f, __l, __g, __c, 0);
3289   return __t;
3290 }
3291
3292 inline const_tree
3293 tree_check2 (const_tree __t, const char *__f, int __l, const char *__g,
3294              enum tree_code __c1, enum tree_code __c2)
3295 {
3296   if (TREE_CODE (__t) != __c1
3297       && TREE_CODE (__t) != __c2)
3298     tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
3299   return __t;
3300 }
3301
3302 inline const_tree
3303 tree_not_check2 (const_tree __t, const char *__f, int __l, const char *__g,
3304                  enum tree_code __c1, enum tree_code __c2)
3305 {
3306   if (TREE_CODE (__t) == __c1
3307       || TREE_CODE (__t) == __c2)
3308     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0);
3309   return __t;
3310 }
3311
3312 inline const_tree
3313 tree_check3 (const_tree __t, const char *__f, int __l, const char *__g,
3314              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
3315 {
3316   if (TREE_CODE (__t) != __c1
3317       && TREE_CODE (__t) != __c2
3318       && TREE_CODE (__t) != __c3)
3319     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
3320   return __t;
3321 }
3322
3323 inline const_tree
3324 tree_not_check3 (const_tree __t, const char *__f, int __l, const char *__g,
3325                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3)
3326 {
3327   if (TREE_CODE (__t) == __c1
3328       || TREE_CODE (__t) == __c2
3329       || TREE_CODE (__t) == __c3)
3330     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0);
3331   return __t;
3332 }
3333
3334 inline const_tree
3335 tree_check4 (const_tree __t, const char *__f, int __l, const char *__g,
3336              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3337              enum tree_code __c4)
3338 {
3339   if (TREE_CODE (__t) != __c1
3340       && TREE_CODE (__t) != __c2
3341       && TREE_CODE (__t) != __c3
3342       && TREE_CODE (__t) != __c4)
3343     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
3344   return __t;
3345 }
3346
3347 inline const_tree
3348 tree_not_check4 (const_tree __t, const char *__f, int __l, const char *__g,
3349                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3350                  enum tree_code __c4)
3351 {
3352   if (TREE_CODE (__t) == __c1
3353       || TREE_CODE (__t) == __c2
3354       || TREE_CODE (__t) == __c3
3355       || TREE_CODE (__t) == __c4)
3356     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0);
3357   return __t;
3358 }
3359
3360 inline const_tree
3361 tree_check5 (const_tree __t, const char *__f, int __l, const char *__g,
3362              enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3363              enum tree_code __c4, enum tree_code __c5)
3364 {
3365   if (TREE_CODE (__t) != __c1
3366       && TREE_CODE (__t) != __c2
3367       && TREE_CODE (__t) != __c3
3368       && TREE_CODE (__t) != __c4
3369       && TREE_CODE (__t) != __c5)
3370     tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
3371   return __t;
3372 }
3373
3374 inline const_tree
3375 tree_not_check5 (const_tree __t, const char *__f, int __l, const char *__g,
3376                  enum tree_code __c1, enum tree_code __c2, enum tree_code __c3,
3377                  enum tree_code __c4, enum tree_code __c5)
3378 {
3379   if (TREE_CODE (__t) == __c1
3380       || TREE_CODE (__t) == __c2
3381       || TREE_CODE (__t) == __c3
3382       || TREE_CODE (__t) == __c4
3383       || TREE_CODE (__t) == __c5)
3384     tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0);
3385   return __t;
3386 }
3387
3388 inline const_tree
3389 contains_struct_check (const_tree __t, const enum tree_node_structure_enum __s,
3390                        const char *__f, int __l, const char *__g)
3391 {
3392   if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
3393       tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
3394   return __t;
3395 }
3396
3397 inline const_tree
3398 tree_class_check (const_tree __t, const enum tree_code_class __class,
3399                   const char *__f, int __l, const char *__g)
3400 {
3401   if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
3402     tree_class_check_failed (__t, __class, __f, __l, __g);
3403   return __t;
3404 }
3405
3406 inline const_tree
3407 tree_range_check (const_tree __t,
3408                   enum tree_code __code1, enum tree_code __code2,
3409                   const char *__f, int __l, const char *__g)
3410 {
3411   if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2)
3412     tree_range_check_failed (__t, __f, __l, __g, __code1, __code2);
3413   return __t;
3414 }
3415
3416 inline const_tree
3417 omp_clause_subcode_check (const_tree __t, enum omp_clause_code __code,
3418                           const char *__f, int __l, const char *__g)
3419 {
3420   if (TREE_CODE (__t) != OMP_CLAUSE)
3421     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3422   if (__t->omp_clause.code != __code)
3423     omp_clause_check_failed (__t, __f, __l, __g, __code);
3424   return __t;
3425 }
3426
3427 inline const_tree
3428 omp_clause_range_check (const_tree __t,
3429                         enum omp_clause_code __code1,
3430                         enum omp_clause_code __code2,
3431                         const char *__f, int __l, const char *__g)
3432 {
3433   if (TREE_CODE (__t) != OMP_CLAUSE)
3434     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3435   if ((int) __t->omp_clause.code < (int) __code1
3436       || (int) __t->omp_clause.code > (int) __code2)
3437     omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2);
3438   return __t;
3439 }
3440
3441 inline const_tree
3442 expr_check (const_tree __t, const char *__f, int __l, const char *__g)
3443 {
3444   char const __c = TREE_CODE_CLASS (TREE_CODE (__t));
3445   if (!IS_EXPR_CODE_CLASS (__c))
3446     tree_class_check_failed (__t, tcc_expression, __f, __l, __g);
3447   return __t;
3448 }
3449
3450 inline const_tree
3451 non_type_check (const_tree __t, const char *__f, int __l, const char *__g)
3452 {
3453   if (TYPE_P (__t))
3454     tree_not_class_check_failed (__t, tcc_type, __f, __l, __g);
3455   return __t;
3456 }
3457
3458 # if GCC_VERSION >= 4006
3459 #pragma GCC diagnostic push
3460 #pragma GCC diagnostic ignored "-Wstrict-overflow"
3461 #endif
3462
3463 inline const_tree *
3464 tree_vec_elt_check (const_tree __t, int __i,
3465                     const char *__f, int __l, const char *__g)
3466 {
3467   if (TREE_CODE (__t) != TREE_VEC)
3468     tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0);
3469   if (__i < 0 || __i >= __t->base.u.length)
3470     tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g);
3471   return CONST_CAST (const_tree *, &__t->vec.a[__i]);
3472   //return &__t->vec.a[__i];
3473 }
3474
3475 # if GCC_VERSION >= 4006
3476 #pragma GCC diagnostic pop
3477 #endif
3478
3479 inline const_tree *
3480 omp_clause_elt_check (const_tree __t, int __i,
3481                       const char *__f, int __l, const char *__g)
3482 {
3483   if (TREE_CODE (__t) != OMP_CLAUSE)
3484     tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0);
3485   if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code])
3486     omp_clause_operand_check_failed (__i, __t, __f, __l, __g);
3487   return CONST_CAST (const_tree *, &__t->omp_clause.ops[__i]);
3488 }
3489
3490 inline const_tree
3491 any_integral_type_check (const_tree __t, const char *__f, int __l,
3492                          const char *__g)
3493 {
3494   if (!ANY_INTEGRAL_TYPE_P (__t))
3495     tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE,
3496                        INTEGER_TYPE, 0);
3497   return __t;
3498 }
3499
3500 #endif
3501
3502 /* Compute the number of operands in an expression node NODE.  For
3503    tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself,
3504    otherwise it is looked up from the node's code.  */
3505 static inline int
3506 tree_operand_length (const_tree node)
3507 {
3508   if (VL_EXP_CLASS_P (node))
3509     return VL_EXP_OPERAND_LENGTH (node);
3510   else
3511     return TREE_CODE_LENGTH (TREE_CODE (node));
3512 }
3513
3514 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
3515
3516 /* Special checks for TREE_OPERANDs.  */
3517 inline tree *
3518 tree_operand_check (tree __t, int __i,
3519                     const char *__f, int __l, const char *__g)
3520 {
3521   const_tree __u = EXPR_CHECK (__t);
3522   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u))
3523     tree_operand_check_failed (__i, __u, __f, __l, __g);
3524   return &CONST_CAST_TREE (__u)->exp.operands[__i];
3525 }
3526
3527 inline tree *
3528 tree_operand_check_code (tree __t, enum tree_code __code, int __i,
3529                          const char *__f, int __l, const char *__g)
3530 {
3531   if (TREE_CODE (__t) != __code)
3532     tree_check_failed (__t, __f, __l, __g, __code, 0);
3533   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t))
3534     tree_operand_check_failed (__i, __t, __f, __l, __g);
3535   return &__t->exp.operands[__i];
3536 }
3537
3538 inline const_tree *
3539 tree_operand_check (const_tree __t, int __i,
3540                     const char *__f, int __l, const char *__g)
3541 {
3542   const_tree __u = EXPR_CHECK (__t);
3543   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u))
3544     tree_operand_check_failed (__i, __u, __f, __l, __g);
3545   return CONST_CAST (const_tree *, &__u->exp.operands[__i]);
3546 }
3547
3548 inline const_tree *
3549 tree_operand_check_code (const_tree __t, enum tree_code __code, int __i,
3550                          const char *__f, int __l, const char *__g)
3551 {
3552   if (TREE_CODE (__t) != __code)
3553     tree_check_failed (__t, __f, __l, __g, __code, 0);
3554   if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t))
3555     tree_operand_check_failed (__i, __t, __f, __l, __g);
3556   return CONST_CAST (const_tree *, &__t->exp.operands[__i]);
3557 }
3558
3559 #endif
3560
3561 #define error_mark_node                 global_trees[TI_ERROR_MARK]
3562
3563 #define intQI_type_node                 global_trees[TI_INTQI_TYPE]
3564 #define intHI_type_node                 global_trees[TI_INTHI_TYPE]
3565 #define intSI_type_node                 global_trees[TI_INTSI_TYPE]
3566 #define intDI_type_node                 global_trees[TI_INTDI_TYPE]
3567 #define intTI_type_node                 global_trees[TI_INTTI_TYPE]
3568
3569 #define unsigned_intQI_type_node        global_trees[TI_UINTQI_TYPE]
3570 #define unsigned_intHI_type_node        global_trees[TI_UINTHI_TYPE]
3571 #define unsigned_intSI_type_node        global_trees[TI_UINTSI_TYPE]
3572 #define unsigned_intDI_type_node        global_trees[TI_UINTDI_TYPE]
3573 #define unsigned_intTI_type_node        global_trees[TI_UINTTI_TYPE]
3574
3575 #define atomicQI_type_node      global_trees[TI_ATOMICQI_TYPE]
3576 #define atomicHI_type_node      global_trees[TI_ATOMICHI_TYPE]
3577 #define atomicSI_type_node      global_trees[TI_ATOMICSI_TYPE]
3578 #define atomicDI_type_node      global_trees[TI_ATOMICDI_TYPE]
3579 #define atomicTI_type_node      global_trees[TI_ATOMICTI_TYPE]
3580
3581 #define uint16_type_node                global_trees[TI_UINT16_TYPE]
3582 #define uint32_type_node                global_trees[TI_UINT32_TYPE]
3583 #define uint64_type_node                global_trees[TI_UINT64_TYPE]
3584
3585 #define void_node                       global_trees[TI_VOID]
3586
3587 #define integer_zero_node               global_trees[TI_INTEGER_ZERO]
3588 #define integer_one_node                global_trees[TI_INTEGER_ONE]
3589 #define integer_three_node              global_trees[TI_INTEGER_THREE]
3590 #define integer_minus_one_node          global_trees[TI_INTEGER_MINUS_ONE]
3591 #define size_zero_node                  global_trees[TI_SIZE_ZERO]
3592 #define size_one_node                   global_trees[TI_SIZE_ONE]
3593 #define bitsize_zero_node               global_trees[TI_BITSIZE_ZERO]
3594 #define bitsize_one_node                global_trees[TI_BITSIZE_ONE]
3595 #define bitsize_unit_node               global_trees[TI_BITSIZE_UNIT]
3596
3597 /* Base access nodes.  */
3598 #define access_public_node              global_trees[TI_PUBLIC]
3599 #define access_protected_node           global_trees[TI_PROTECTED]
3600 #define access_private_node             global_trees[TI_PRIVATE]
3601
3602 #define null_pointer_node               global_trees[TI_NULL_POINTER]
3603
3604 #define float_type_node                 global_trees[TI_FLOAT_TYPE]
3605 #define double_type_node                global_trees[TI_DOUBLE_TYPE]
3606 #define long_double_type_node           global_trees[TI_LONG_DOUBLE_TYPE]
3607
3608 #define float_ptr_type_node             global_trees[TI_FLOAT_PTR_TYPE]
3609 #define double_ptr_type_node            global_trees[TI_DOUBLE_PTR_TYPE]
3610 #define long_double_ptr_type_node       global_trees[TI_LONG_DOUBLE_PTR_TYPE]
3611 #define integer_ptr_type_node           global_trees[TI_INTEGER_PTR_TYPE]
3612
3613 #define complex_integer_type_node       global_trees[TI_COMPLEX_INTEGER_TYPE]
3614 #define complex_float_type_node         global_trees[TI_COMPLEX_FLOAT_TYPE]
3615 #define complex_double_type_node        global_trees[TI_COMPLEX_DOUBLE_TYPE]
3616 #define complex_long_double_type_node   global_trees[TI_COMPLEX_LONG_DOUBLE_TYPE]
3617
3618 #define pointer_bounds_type_node        global_trees[TI_POINTER_BOUNDS_TYPE]
3619
3620 #define void_type_node                  global_trees[TI_VOID_TYPE]
3621 /* The C type `void *'.  */
3622 #define ptr_type_node                   global_trees[TI_PTR_TYPE]
3623 /* The C type `const void *'.  */
3624 #define const_ptr_type_node             global_trees[TI_CONST_PTR_TYPE]
3625 /* The C type `size_t'.  */
3626 #define size_type_node                  global_trees[TI_SIZE_TYPE]
3627 #define pid_type_node                   global_trees[TI_PID_TYPE]
3628 #define ptrdiff_type_node               global_trees[TI_PTRDIFF_TYPE]
3629 #define va_list_type_node               global_trees[TI_VA_LIST_TYPE]
3630 #define va_list_gpr_counter_field       global_trees[TI_VA_LIST_GPR_COUNTER_FIELD]
3631 #define va_list_fpr_counter_field       global_trees[TI_VA_LIST_FPR_COUNTER_FIELD]
3632 /* The C type `FILE *'.  */
3633 #define fileptr_type_node               global_trees[TI_FILEPTR_TYPE]
3634 #define pointer_sized_int_node          global_trees[TI_POINTER_SIZED_TYPE]
3635
3636 #define boolean_type_node               global_trees[TI_BOOLEAN_TYPE]
3637 #define boolean_false_node              global_trees[TI_BOOLEAN_FALSE]
3638 #define boolean_true_node               global_trees[TI_BOOLEAN_TRUE]
3639
3640 /* The decimal floating point types. */
3641 #define dfloat32_type_node              global_trees[TI_DFLOAT32_TYPE]
3642 #define dfloat64_type_node              global_trees[TI_DFLOAT64_TYPE]
3643 #define dfloat128_type_node             global_trees[TI_DFLOAT128_TYPE]
3644 #define dfloat32_ptr_type_node          global_trees[TI_DFLOAT32_PTR_TYPE]
3645 #define dfloat64_ptr_type_node          global_trees[TI_DFLOAT64_PTR_TYPE]
3646 #define dfloat128_ptr_type_node         global_trees[TI_DFLOAT128_PTR_TYPE]
3647
3648 /* The fixed-point types.  */
3649 #define sat_short_fract_type_node       global_trees[TI_SAT_SFRACT_TYPE]
3650 #define sat_fract_type_node             global_trees[TI_SAT_FRACT_TYPE]
3651 #define sat_long_fract_type_node        global_trees[TI_SAT_LFRACT_TYPE]
3652 #define sat_long_long_fract_type_node   global_trees[TI_SAT_LLFRACT_TYPE]
3653 #define sat_unsigned_short_fract_type_node \
3654                                         global_trees[TI_SAT_USFRACT_TYPE]
3655 #define sat_unsigned_fract_type_node    global_trees[TI_SAT_UFRACT_TYPE]
3656 #define sat_unsigned_long_fract_type_node \
3657                                         global_trees[TI_SAT_ULFRACT_TYPE]
3658 #define sat_unsigned_long_long_fract_type_node \
3659                                         global_trees[TI_SAT_ULLFRACT_TYPE]
3660 #define short_fract_type_node           global_trees[TI_SFRACT_TYPE]
3661 #define fract_type_node                 global_trees[TI_FRACT_TYPE]
3662 #define long_fract_type_node            global_trees[TI_LFRACT_TYPE]
3663 #define long_long_fract_type_node       global_trees[TI_LLFRACT_TYPE]
3664 #define unsigned_short_fract_type_node  global_trees[TI_USFRACT_TYPE]
3665 #define unsigned_fract_type_node        global_trees[TI_UFRACT_TYPE]
3666 #define unsigned_long_fract_type_node   global_trees[TI_ULFRACT_TYPE]
3667 #define unsigned_long_long_fract_type_node \
3668                                         global_trees[TI_ULLFRACT_TYPE]
3669 #define sat_short_accum_type_node       global_trees[TI_SAT_SACCUM_TYPE]
3670 #define sat_accum_type_node             global_trees[TI_SAT_ACCUM_TYPE]
3671 #define sat_long_accum_type_node        global_trees[TI_SAT_LACCUM_TYPE]
3672 #define sat_long_long_accum_type_node   global_trees[TI_SAT_LLACCUM_TYPE]
3673 #define sat_unsigned_short_accum_type_node \
3674                                         global_trees[TI_SAT_USACCUM_TYPE]
3675 #define sat_unsigned_accum_type_node    global_trees[TI_SAT_UACCUM_TYPE]
3676 #define sat_unsigned_long_accum_type_node \
3677                                         global_trees[TI_SAT_ULACCUM_TYPE]
3678 #define sat_unsigned_long_long_accum_type_node \
3679                                         global_trees[TI_SAT_ULLACCUM_TYPE]
3680 #define short_accum_type_node           global_trees[TI_SACCUM_TYPE]
3681 #define accum_type_node                 global_trees[TI_ACCUM_TYPE]
3682 #define long_accum_type_node            global_trees[TI_LACCUM_TYPE]
3683 #define long_long_accum_type_node       global_trees[TI_LLACCUM_TYPE]
3684 #define unsigned_short_accum_type_node  global_trees[TI_USACCUM_TYPE]
3685 #define unsigned_accum_type_node        global_trees[TI_UACCUM_TYPE]
3686 #define unsigned_long_accum_type_node   global_trees[TI_ULACCUM_TYPE]
3687 #define unsigned_long_long_accum_type_node \
3688                                         global_trees[TI_ULLACCUM_TYPE]
3689 #define qq_type_node                    global_trees[TI_QQ_TYPE]
3690 #define hq_type_node                    global_trees[TI_HQ_TYPE]
3691 #define sq_type_node                    global_trees[TI_SQ_TYPE]
3692 #define dq_type_node                    global_trees[TI_DQ_TYPE]
3693 #define tq_type_node                    global_trees[TI_TQ_TYPE]
3694 #define uqq_type_node                   global_trees[TI_UQQ_TYPE]
3695 #define uhq_type_node                   global_trees[TI_UHQ_TYPE]
3696 #define usq_type_node                   global_trees[TI_USQ_TYPE]
3697 #define udq_type_node                   global_trees[TI_UDQ_TYPE]
3698 #define utq_type_node                   global_trees[TI_UTQ_TYPE]
3699 #define sat_qq_type_node                global_trees[TI_SAT_QQ_TYPE]
3700 #define sat_hq_type_node                global_trees[TI_SAT_HQ_TYPE]
3701 #define sat_sq_type_node                global_trees[TI_SAT_SQ_TYPE]
3702 #define sat_dq_type_node                global_trees[TI_SAT_DQ_TYPE]
3703 #define sat_tq_type_node                global_trees[TI_SAT_TQ_TYPE]
3704 #define sat_uqq_type_node               global_trees[TI_SAT_UQQ_TYPE]
3705 #define sat_uhq_type_node               global_trees[TI_SAT_UHQ_TYPE]
3706 #define sat_usq_type_node               global_trees[TI_SAT_USQ_TYPE]
3707 #define sat_udq_type_node               global_trees[TI_SAT_UDQ_TYPE]
3708 #define sat_utq_type_node               global_trees[TI_SAT_UTQ_TYPE]
3709 #define ha_type_node                    global_trees[TI_HA_TYPE]
3710 #define sa_type_node                    global_trees[TI_SA_TYPE]
3711 #define da_type_node                    global_trees[TI_DA_TYPE]
3712 #define ta_type_node                    global_trees[TI_TA_TYPE]
3713 #define uha_type_node                   global_trees[TI_UHA_TYPE]
3714 #define usa_type_node                   global_trees[TI_USA_TYPE]
3715 #define uda_type_node                   global_trees[TI_UDA_TYPE]
3716 #define uta_type_node                   global_trees[TI_UTA_TYPE]
3717 #define sat_ha_type_node                global_trees[TI_SAT_HA_TYPE]
3718 #define sat_sa_type_node                global_trees[TI_SAT_SA_TYPE]
3719 #define sat_da_type_node                global_trees[TI_SAT_DA_TYPE]
3720 #define sat_ta_type_node                global_trees[TI_SAT_TA_TYPE]
3721 #define sat_uha_type_node               global_trees[TI_SAT_UHA_TYPE]
3722 #define sat_usa_type_node               global_trees[TI_SAT_USA_TYPE]
3723 #define sat_uda_type_node               global_trees[TI_SAT_UDA_TYPE]
3724 #define sat_uta_type_node               global_trees[TI_SAT_UTA_TYPE]
3725
3726 /* The node that should be placed at the end of a parameter list to
3727    indicate that the function does not take a variable number of
3728    arguments.  The TREE_VALUE will be void_type_node and there will be
3729    no TREE_CHAIN.  Language-independent code should not assume
3730    anything else about this node.  */
3731 #define void_list_node                  global_trees[TI_VOID_LIST_NODE]
3732
3733 #define main_identifier_node            global_trees[TI_MAIN_IDENTIFIER]
3734 #define MAIN_NAME_P(NODE) \
3735   (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node)
3736
3737 /* Optimization options (OPTIMIZATION_NODE) to use for default and current
3738    functions.  */
3739 #define optimization_default_node       global_trees[TI_OPTIMIZATION_DEFAULT]
3740 #define optimization_current_node       global_trees[TI_OPTIMIZATION_CURRENT]
3741
3742 /* Default/current target options (TARGET_OPTION_NODE).  */
3743 #define target_option_default_node      global_trees[TI_TARGET_OPTION_DEFAULT]
3744 #define target_option_current_node      global_trees[TI_TARGET_OPTION_CURRENT]
3745
3746 /* Default tree list option(), optimize() pragmas to be linked into the
3747    attribute list.  */
3748 #define current_target_pragma           global_trees[TI_CURRENT_TARGET_PRAGMA]
3749 #define current_optimize_pragma         global_trees[TI_CURRENT_OPTIMIZE_PRAGMA]
3750
3751 #define char_type_node                  integer_types[itk_char]
3752 #define signed_char_type_node           integer_types[itk_signed_char]
3753 #define unsigned_char_type_node         integer_types[itk_unsigned_char]
3754 #define short_integer_type_node         integer_types[itk_short]
3755 #define short_unsigned_type_node        integer_types[itk_unsigned_short]
3756 #define integer_type_node               integer_types[itk_int]
3757 #define unsigned_type_node              integer_types[itk_unsigned_int]
3758 #define long_integer_type_node          integer_types[itk_long]
3759 #define long_unsigned_type_node         integer_types[itk_unsigned_long]
3760 #define long_long_integer_type_node     integer_types[itk_long_long]
3761 #define long_long_unsigned_type_node    integer_types[itk_unsigned_long_long]
3762
3763 /* True if NODE is an erroneous expression.  */
3764
3765 #define error_operand_p(NODE)                                   \
3766   ((NODE) == error_mark_node                                    \
3767    || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
3768
3769 extern tree decl_assembler_name (tree);
3770 extern tree decl_comdat_group (const_tree);
3771 extern tree decl_comdat_group_id (const_tree);
3772 extern const char *decl_section_name (const_tree);
3773 extern void set_decl_section_name (tree, const char *);
3774 extern enum tls_model decl_tls_model (const_tree);
3775 extern void set_decl_tls_model (tree, enum tls_model);
3776
3777 /* Compute the number of bytes occupied by 'node'.  This routine only
3778    looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH.  */
3779
3780 extern size_t tree_size (const_tree);
3781
3782 /* Compute the number of bytes occupied by a tree with code CODE.
3783    This function cannot be used for TREE_VEC or INTEGER_CST nodes,
3784    which are of variable length.  */
3785 extern size_t tree_code_size (enum tree_code);
3786
3787 /* Allocate and return a new UID from the DECL_UID namespace.  */
3788 extern int allocate_decl_uid (void);
3789
3790 /* Lowest level primitive for allocating a node.
3791    The TREE_CODE is the only argument.  Contents are initialized
3792    to zero except for a few of the common fields.  */
3793
3794 extern tree make_node_stat (enum tree_code MEM_STAT_DECL);
3795 #define make_node(t) make_node_stat (t MEM_STAT_INFO)
3796
3797 /* Free tree node.  */
3798
3799 extern void free_node (tree);
3800
3801 /* Make a copy of a node, with all the same contents.  */
3802
3803 extern tree copy_node_stat (tree MEM_STAT_DECL);
3804 #define copy_node(t) copy_node_stat (t MEM_STAT_INFO)
3805
3806 /* Make a copy of a chain of TREE_LIST nodes.  */
3807
3808 extern tree copy_list (tree);
3809
3810 /* Make a CASE_LABEL_EXPR.  */
3811
3812 extern tree build_case_label (tree, tree, tree);
3813
3814 /* Make a BINFO.  */
3815 extern tree make_tree_binfo_stat (unsigned MEM_STAT_DECL);
3816 #define make_tree_binfo(t) make_tree_binfo_stat (t MEM_STAT_INFO)
3817
3818 /* Make an INTEGER_CST.  */
3819
3820 extern tree make_int_cst_stat (int, int MEM_STAT_DECL);
3821 #define make_int_cst(LEN, EXT_LEN) \
3822   make_int_cst_stat (LEN, EXT_LEN MEM_STAT_INFO)
3823
3824 /* Make a TREE_VEC.  */
3825
3826 extern tree make_tree_vec_stat (int MEM_STAT_DECL);
3827 #define make_tree_vec(t) make_tree_vec_stat (t MEM_STAT_INFO)
3828
3829 /* Grow a TREE_VEC.  */
3830
3831 extern tree grow_tree_vec_stat (tree v, int MEM_STAT_DECL);
3832 #define grow_tree_vec(v, t) grow_tree_vec_stat (v, t MEM_STAT_INFO)
3833
3834 /* Construct various types of nodes.  */
3835
3836 extern tree build_nt (enum tree_code, ...);
3837 extern tree build_nt_call_vec (tree, vec<tree, va_gc> *);
3838
3839 extern tree build0_stat (enum tree_code, tree MEM_STAT_DECL);
3840 #define build0(c,t) build0_stat (c,t MEM_STAT_INFO)
3841 extern tree build1_stat (enum tree_code, tree, tree MEM_STAT_DECL);
3842 #define build1(c,t1,t2) build1_stat (c,t1,t2 MEM_STAT_INFO)
3843 extern tree build2_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL);
3844 #define build2(c,t1,t2,t3) build2_stat (c,t1,t2,t3 MEM_STAT_INFO)
3845 extern tree build3_stat (enum tree_code, tree, tree, tree, tree MEM_STAT_DECL);
3846 #define build3(c,t1,t2,t3,t4) build3_stat (c,t1,t2,t3,t4 MEM_STAT_INFO)
3847 extern tree build4_stat (enum tree_code, tree, tree, tree, tree,
3848                          tree MEM_STAT_DECL);
3849 #define build4(c,t1,t2,t3,t4,t5) build4_stat (c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
3850 extern tree build5_stat (enum tree_code, tree, tree, tree, tree, tree,
3851                          tree MEM_STAT_DECL);
3852 #define build5(c,t1,t2,t3,t4,t5,t6) build5_stat (c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
3853
3854 /* _loc versions of build[1-5].  */
3855
3856 static inline tree
3857 build1_stat_loc (location_t loc, enum tree_code code, tree type,
3858                  tree arg1 MEM_STAT_DECL)
3859 {
3860   tree t = build1_stat (code, type, arg1 PASS_MEM_STAT);
3861   if (CAN_HAVE_LOCATION_P (t))
3862     SET_EXPR_LOCATION (t, loc);
3863   return t;
3864 }
3865 #define build1_loc(l,c,t1,t2) build1_stat_loc (l,c,t1,t2 MEM_STAT_INFO)
3866
3867 static inline tree
3868 build2_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
3869                  tree arg1 MEM_STAT_DECL)
3870 {
3871   tree t = build2_stat (code, type, arg0, arg1 PASS_MEM_STAT);
3872   if (CAN_HAVE_LOCATION_P (t))
3873     SET_EXPR_LOCATION (t, loc);
3874   return t;
3875 }
3876 #define build2_loc(l,c,t1,t2,t3) build2_stat_loc (l,c,t1,t2,t3 MEM_STAT_INFO)
3877
3878 static inline tree
3879 build3_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
3880                  tree arg1, tree arg2 MEM_STAT_DECL)
3881 {
3882   tree t = build3_stat (code, type, arg0, arg1, arg2 PASS_MEM_STAT);
3883   if (CAN_HAVE_LOCATION_P (t))
3884     SET_EXPR_LOCATION (t, loc);
3885   return t;
3886 }
3887 #define build3_loc(l,c,t1,t2,t3,t4) \
3888   build3_stat_loc (l,c,t1,t2,t3,t4 MEM_STAT_INFO)
3889
3890 static inline tree
3891 build4_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
3892                  tree arg1, tree arg2, tree arg3 MEM_STAT_DECL)
3893 {
3894   tree t = build4_stat (code, type, arg0, arg1, arg2, arg3 PASS_MEM_STAT);
3895   if (CAN_HAVE_LOCATION_P (t))
3896     SET_EXPR_LOCATION (t, loc);
3897   return t;
3898 }
3899 #define build4_loc(l,c,t1,t2,t3,t4,t5) \
3900   build4_stat_loc (l,c,t1,t2,t3,t4,t5 MEM_STAT_INFO)
3901
3902 static inline tree
3903 build5_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0,
3904                  tree arg1, tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
3905 {
3906   tree t = build5_stat (code, type, arg0, arg1, arg2, arg3,
3907                         arg4 PASS_MEM_STAT);
3908   if (CAN_HAVE_LOCATION_P (t))
3909     SET_EXPR_LOCATION (t, loc);
3910   return t;
3911 }
3912 #define build5_loc(l,c,t1,t2,t3,t4,t5,t6) \
3913   build5_stat_loc (l,c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO)
3914
3915 extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
3916 #define build_var_debug_value(t1,t2) \
3917   build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)
3918
3919 /* Constructs double_int from tree CST.  */
3920
3921 extern tree double_int_to_tree (tree, double_int);
3922
3923 extern tree wide_int_to_tree (tree type, const wide_int_ref &cst);
3924 extern tree force_fit_type (tree, const wide_int_ref &, int, bool);
3925
3926 /* Create an INT_CST node with a CST value zero extended.  */
3927
3928 /* static inline */
3929 extern tree build_int_cst (tree, HOST_WIDE_INT);
3930 extern tree build_int_cstu (tree type, unsigned HOST_WIDE_INT cst);
3931 extern tree build_int_cst_type (tree, HOST_WIDE_INT);
3932 extern tree make_vector_stat (unsigned MEM_STAT_DECL);
3933 #define make_vector(n) make_vector_stat (n MEM_STAT_INFO)
3934 extern tree build_vector_stat (tree, tree * MEM_STAT_DECL);
3935 #define build_vector(t,v) build_vector_stat (t, v MEM_STAT_INFO)
3936 extern tree build_vector_from_ctor (tree, vec<constructor_elt, va_gc> *);
3937 extern tree build_vector_from_val (tree, tree);
3938 extern void recompute_constructor_flags (tree);
3939 extern void verify_constructor_flags (tree);
3940 extern tree build_constructor (tree, vec<constructor_elt, va_gc> *);
3941 extern tree build_constructor_single (tree, tree, tree);
3942 extern tree build_constructor_from_list (tree, tree);
3943 extern tree build_constructor_va (tree, int, ...);
3944 extern tree build_real_from_int_cst (tree, const_tree);
3945 extern tree build_complex (tree, tree, tree);
3946 extern tree build_complex_inf (tree, bool);
3947 extern tree build_each_one_cst (tree);
3948 extern tree build_one_cst (tree);
3949 extern tree build_minus_one_cst (tree);
3950 extern tree build_all_ones_cst (tree);
3951 extern tree build_zero_cst (tree);
3952 extern tree build_string (int, const char *);
3953 extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
3954 #define build_tree_list(t, q) build_tree_list_stat (t, q MEM_STAT_INFO)
3955 extern tree build_tree_list_vec_stat (const vec<tree, va_gc> *MEM_STAT_DECL);
3956 #define build_tree_list_vec(v) build_tree_list_vec_stat (v MEM_STAT_INFO)
3957 extern tree build_decl_stat (location_t, enum tree_code,
3958                              tree, tree MEM_STAT_DECL);
3959 extern tree build_fn_decl (const char *, tree);
3960 #define build_decl(l,c,t,q) build_decl_stat (l, c, t, q MEM_STAT_INFO)
3961 extern tree build_translation_unit_decl (tree);
3962 extern tree build_block (tree, tree, tree, tree);
3963 extern tree build_empty_stmt (location_t);
3964 extern tree build_omp_clause (location_t, enum omp_clause_code);
3965
3966 extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL);
3967 #define build_vl_exp(c, n) build_vl_exp_stat (c, n MEM_STAT_INFO)
3968
3969 extern tree build_call_nary (tree, tree, int, ...);
3970 extern tree build_call_valist (tree, tree, int, va_list);
3971 #define build_call_array(T1,T2,N,T3)\
3972    build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3)
3973 extern tree build_call_array_loc (location_t, tree, tree, int, const tree *);
3974 extern tree build_call_vec (tree, tree, vec<tree, va_gc> *);
3975 extern tree build_call_expr_loc_array (location_t, tree, int, tree *);
3976 extern tree build_call_expr_loc_vec (location_t, tree, vec<tree, va_gc> *);
3977 extern tree build_call_expr_loc (location_t, tree, int, ...);
3978 extern tree build_call_expr (tree, int, ...);
3979 extern tree build_call_expr_internal_loc (location_t, enum internal_fn,
3980                                           tree, int, ...);
3981 extern tree build_call_expr_internal_loc_array (location_t, enum internal_fn,
3982                                                 tree, int, const tree *);
3983 extern tree maybe_build_call_expr_loc (location_t, combined_fn, tree,
3984                                        int, ...);
3985 extern tree build_string_literal (int, const char *);
3986
3987 /* Construct various nodes representing data types.  */
3988
3989 extern tree signed_or_unsigned_type_for (int, tree);
3990 extern tree signed_type_for (tree);
3991 extern tree unsigned_type_for (tree);
3992 extern tree truth_type_for (tree);
3993 extern tree build_pointer_type_for_mode (tree, machine_mode, bool);
3994 extern tree build_pointer_type (tree);
3995 extern tree build_reference_type_for_mode (tree, machine_mode, bool);
3996 extern tree build_reference_type (tree);
3997 extern tree build_vector_type_for_mode (tree, machine_mode);
3998 extern tree build_vector_type (tree innertype, int nunits);
3999 extern tree build_truth_vector_type (unsigned, unsigned);
4000 extern tree build_same_sized_truth_vector_type (tree vectype);
4001 extern tree build_opaque_vector_type (tree innertype, int nunits);
4002 extern tree build_index_type (tree);
4003 extern tree build_array_type (tree, tree);
4004 extern tree build_nonshared_array_type (tree, tree);
4005 extern tree build_array_type_nelts (tree, unsigned HOST_WIDE_INT);
4006 extern tree build_function_type (tree, tree);
4007 extern tree build_function_type_list (tree, ...);
4008 extern tree build_varargs_function_type_list (tree, ...);
4009 extern tree build_function_type_array (tree, int, tree *);
4010 extern tree build_varargs_function_type_array (tree, int, tree *);
4011 #define build_function_type_vec(RET, V) \
4012   build_function_type_array (RET, vec_safe_length (V), vec_safe_address (V))
4013 #define build_varargs_function_type_vec(RET, V) \
4014   build_varargs_function_type_array (RET, vec_safe_length (V), \
4015                                      vec_safe_address (V))
4016 extern tree build_method_type_directly (tree, tree, tree);
4017 extern tree build_method_type (tree, tree);
4018 extern tree build_offset_type (tree, tree);
4019 extern tree build_complex_type (tree);
4020 extern tree array_type_nelts (const_tree);
4021
4022 extern tree value_member (tree, tree);
4023 extern tree purpose_member (const_tree, tree);
4024 extern bool vec_member (const_tree, vec<tree, va_gc> *);
4025 extern tree chain_index (int, tree);
4026
4027 extern int attribute_list_equal (const_tree, const_tree);
4028 extern int attribute_list_contained (const_tree, const_tree);
4029 extern int tree_int_cst_equal (const_tree, const_tree);
4030
4031 extern bool tree_fits_shwi_p (const_tree)
4032 #ifndef ENABLE_TREE_CHECKING
4033   ATTRIBUTE_PURE /* tree_fits_shwi_p is pure only when checking is disabled.  */
4034 #endif
4035   ;
4036 extern bool tree_fits_uhwi_p (const_tree)
4037 #ifndef ENABLE_TREE_CHECKING
4038   ATTRIBUTE_PURE /* tree_fits_uhwi_p is pure only when checking is disabled.  */
4039 #endif
4040   ;
4041 extern HOST_WIDE_INT tree_to_shwi (const_tree);
4042 extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree);
4043 #if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003)
4044 extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT
4045 tree_to_shwi (const_tree t)
4046 {
4047   gcc_assert (tree_fits_shwi_p (t));
4048   return TREE_INT_CST_LOW (t);
4049 }
4050
4051 extern inline __attribute__ ((__gnu_inline__)) unsigned HOST_WIDE_INT
4052 tree_to_uhwi (const_tree t)
4053 {
4054   gcc_assert (tree_fits_uhwi_p (t));
4055   return TREE_INT_CST_LOW (t);
4056 }
4057 #endif
4058 extern int tree_int_cst_sgn (const_tree);
4059 extern int tree_int_cst_sign_bit (const_tree);
4060 extern unsigned int tree_int_cst_min_precision (tree, signop);
4061 extern tree strip_array_types (tree);
4062 extern tree excess_precision_type (tree);
4063 extern bool valid_constant_size_p (const_tree);
4064
4065
4066 /* From expmed.c.  Since rtl.h is included after tree.h, we can't
4067    put the prototype here.  Rtl.h does declare the prototype if
4068    tree.h had been included.  */
4069
4070 extern tree make_tree (tree, rtx);
4071
4072 /* Return a type like TTYPE except that its TYPE_ATTRIBUTES
4073    is ATTRIBUTE.
4074
4075    Such modified types already made are recorded so that duplicates
4076    are not made.  */
4077
4078 extern tree build_type_attribute_variant (tree, tree);
4079 extern tree build_decl_attribute_variant (tree, tree);
4080 extern tree build_type_attribute_qual_variant (tree, tree, int);
4081
4082 extern bool attribute_value_equal (const_tree, const_tree);
4083
4084 /* Return 0 if the attributes for two types are incompatible, 1 if they
4085    are compatible, and 2 if they are nearly compatible (which causes a
4086    warning to be generated).  */
4087 extern int comp_type_attributes (const_tree, const_tree);
4088
4089 /* Default versions of target-overridable functions.  */
4090 extern tree merge_decl_attributes (tree, tree);
4091 extern tree merge_type_attributes (tree, tree);
4092
4093 /* This function is a private implementation detail of lookup_attribute()
4094    and you should never call it directly.  */
4095 extern tree private_lookup_attribute (const char *, size_t, tree);
4096
4097 /* This function is a private implementation detail
4098    of lookup_attribute_by_prefix() and you should never call it directly.  */
4099 extern tree private_lookup_attribute_by_prefix (const char *, size_t, tree);
4100
4101 /* Given an attribute name ATTR_NAME and a list of attributes LIST,
4102    return a pointer to the attribute's list element if the attribute
4103    is part of the list, or NULL_TREE if not found.  If the attribute
4104    appears more than once, this only returns the first occurrence; the
4105    TREE_CHAIN of the return value should be passed back in if further
4106    occurrences are wanted.  ATTR_NAME must be in the form 'text' (not
4107    '__text__').  */
4108
4109 static inline tree
4110 lookup_attribute (const char *attr_name, tree list)
4111 {
4112   gcc_checking_assert (attr_name[0] != '_');  
4113   /* In most cases, list is NULL_TREE.  */
4114   if (list == NULL_TREE)
4115     return NULL_TREE;
4116   else
4117     /* Do the strlen() before calling the out-of-line implementation.
4118        In most cases attr_name is a string constant, and the compiler
4119        will optimize the strlen() away.  */
4120     return private_lookup_attribute (attr_name, strlen (attr_name), list);
4121 }
4122
4123 /* Given an attribute name ATTR_NAME and a list of attributes LIST,
4124    return a pointer to the attribute's list first element if the attribute
4125    starts with ATTR_NAME. ATTR_NAME must be in the form 'text' (not
4126    '__text__').  */
4127
4128 static inline tree
4129 lookup_attribute_by_prefix (const char *attr_name, tree list)
4130 {
4131   gcc_checking_assert (attr_name[0] != '_');
4132   /* In most cases, list is NULL_TREE.  */
4133   if (list == NULL_TREE)
4134     return NULL_TREE;
4135   else
4136     return private_lookup_attribute_by_prefix (attr_name, strlen (attr_name),
4137                                                list);
4138 }
4139
4140
4141 /* This function is a private implementation detail of
4142    is_attribute_p() and you should never call it directly.  */
4143 extern bool private_is_attribute_p (const char *, size_t, const_tree);
4144
4145 /* Given an identifier node IDENT and a string ATTR_NAME, return true
4146    if the identifier node is a valid attribute name for the string.
4147    ATTR_NAME must be in the form 'text' (not '__text__').  IDENT could
4148    be the identifier for 'text' or for '__text__'.  */
4149
4150 static inline bool
4151 is_attribute_p (const char *attr_name, const_tree ident)
4152 {
4153   gcc_checking_assert (attr_name[0] != '_');
4154   /* Do the strlen() before calling the out-of-line implementation.
4155      In most cases attr_name is a string constant, and the compiler
4156      will optimize the strlen() away.  */
4157   return private_is_attribute_p (attr_name, strlen (attr_name), ident);
4158 }
4159
4160 /* Remove any instances of attribute ATTR_NAME in LIST and return the
4161    modified list.  ATTR_NAME must be in the form 'text' (not
4162    '__text__').  */
4163
4164 extern tree remove_attribute (const char *, tree);
4165
4166 /* Given two attributes lists, return a list of their union.  */
4167
4168 extern tree merge_attributes (tree, tree);
4169
4170 /* Given two Windows decl attributes lists, possibly including
4171    dllimport, return a list of their union .  */
4172 extern tree merge_dllimport_decl_attributes (tree, tree);
4173
4174 /* Handle a "dllimport" or "dllexport" attribute.  */
4175 extern tree handle_dll_attribute (tree *, tree, tree, int, bool *);
4176
4177 /* Returns true iff unqualified CAND and BASE are equivalent.  */
4178
4179 extern bool check_base_type (const_tree cand, const_tree base);
4180
4181 /* Check whether CAND is suitable to be returned from get_qualified_type
4182    (BASE, TYPE_QUALS).  */
4183
4184 extern bool check_qualified_type (const_tree, const_tree, int);
4185
4186 /* Return a version of the TYPE, qualified as indicated by the
4187    TYPE_QUALS, if one exists.  If no qualified version exists yet,
4188    return NULL_TREE.  */
4189
4190 extern tree get_qualified_type (tree, int);
4191
4192 /* Like get_qualified_type, but creates the type if it does not
4193    exist.  This function never returns NULL_TREE.  */
4194
4195 extern tree build_qualified_type (tree, int);
4196
4197 /* Create a variant of type T with alignment ALIGN.  */
4198
4199 extern tree build_aligned_type (tree, unsigned int);
4200
4201 /* Like build_qualified_type, but only deals with the `const' and
4202    `volatile' qualifiers.  This interface is retained for backwards
4203    compatibility with the various front-ends; new code should use
4204    build_qualified_type instead.  */
4205
4206 #define build_type_variant(TYPE, CONST_P, VOLATILE_P)                   \
4207   build_qualified_type ((TYPE),                                         \
4208                         ((CONST_P) ? TYPE_QUAL_CONST : 0)               \
4209                         | ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
4210
4211 /* Make a copy of a type node.  */
4212
4213 extern tree build_distinct_type_copy (tree);
4214 extern tree build_variant_type_copy (tree);
4215
4216 /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
4217    return a canonicalized ..._TYPE node, so that duplicates are not made.
4218    How the hash code is computed is up to the caller, as long as any two
4219    callers that could hash identical-looking type nodes agree.  */
4220
4221 extern tree type_hash_canon (unsigned int, tree);
4222
4223 extern tree convert (tree, tree);
4224 extern unsigned int expr_align (const_tree);
4225 extern tree size_in_bytes_loc (location_t, const_tree);
4226 inline tree
4227 size_in_bytes (const_tree t)
4228 {
4229   return size_in_bytes_loc (input_location, t);
4230 }
4231
4232 extern HOST_WIDE_INT int_size_in_bytes (const_tree);
4233 extern HOST_WIDE_INT max_int_size_in_bytes (const_tree);
4234 extern tree bit_position (const_tree);
4235 extern tree byte_position (const_tree);
4236 extern HOST_WIDE_INT int_byte_position (const_tree);
4237
4238 /* Type for sizes of data-type.  */
4239
4240 #define sizetype sizetype_tab[(int) stk_sizetype]
4241 #define bitsizetype sizetype_tab[(int) stk_bitsizetype]
4242 #define ssizetype sizetype_tab[(int) stk_ssizetype]
4243 #define sbitsizetype sizetype_tab[(int) stk_sbitsizetype]
4244 #define size_int(L) size_int_kind (L, stk_sizetype)
4245 #define ssize_int(L) size_int_kind (L, stk_ssizetype)
4246 #define bitsize_int(L) size_int_kind (L, stk_bitsizetype)
4247 #define sbitsize_int(L) size_int_kind (L, stk_sbitsizetype)
4248
4249 /* Log2 of BITS_PER_UNIT.  */
4250
4251 #if BITS_PER_UNIT == 8
4252 #define LOG2_BITS_PER_UNIT 3
4253 #elif BITS_PER_UNIT == 16
4254 #define LOG2_BITS_PER_UNIT 4
4255 #else
4256 #error Unknown BITS_PER_UNIT
4257 #endif
4258
4259 /* Concatenate two lists (chains of TREE_LIST nodes) X and Y
4260    by making the last node in X point to Y.
4261    Returns X, except if X is 0 returns Y.  */
4262
4263 extern tree chainon (tree, tree);
4264
4265 /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN.  */
4266
4267 extern tree tree_cons_stat (tree, tree, tree MEM_STAT_DECL);
4268 #define tree_cons(t,q,w) tree_cons_stat (t,q,w MEM_STAT_INFO)
4269
4270 /* Return the last tree node in a chain.  */
4271
4272 extern tree tree_last (tree);
4273
4274 /* Reverse the order of elements in a chain, and return the new head.  */
4275
4276 extern tree nreverse (tree);
4277
4278 /* Returns the length of a chain of nodes
4279    (number of chain pointers to follow before reaching a null pointer).  */
4280
4281 extern int list_length (const_tree);
4282
4283 /* Returns the first FIELD_DECL in a type.  */
4284
4285 extern tree first_field (const_tree);
4286
4287 /* Given an initializer INIT, return TRUE if INIT is zero or some
4288    aggregate of zeros.  Otherwise return FALSE.  */
4289
4290 extern bool initializer_zerop (const_tree);
4291
4292 /* Given a vector VEC, return its first element if all elements are
4293    the same.  Otherwise return NULL_TREE.  */
4294
4295 extern tree uniform_vector_p (const_tree);
4296
4297 /* Given a CONSTRUCTOR CTOR, return the element values as a vector.  */
4298
4299 extern vec<tree, va_gc> *ctor_to_vec (tree);
4300
4301 /* zerop (tree x) is nonzero if X is a constant of value 0.  */
4302
4303 extern int zerop (const_tree);
4304
4305 /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0.  */
4306
4307 extern int integer_zerop (const_tree);
4308
4309 /* integer_onep (tree x) is nonzero if X is an integer constant of value 1.  */
4310
4311 extern int integer_onep (const_tree);
4312
4313 /* integer_onep (tree x) is nonzero if X is an integer constant of value 1, or
4314    a vector or complex where each part is 1.  */
4315
4316 extern int integer_each_onep (const_tree);
4317
4318 /* integer_all_onesp (tree x) is nonzero if X is an integer constant
4319    all of whose significant bits are 1.  */
4320
4321 extern int integer_all_onesp (const_tree);
4322
4323 /* integer_minus_onep (tree x) is nonzero if X is an integer constant of
4324    value -1.  */
4325
4326 extern int integer_minus_onep (const_tree);
4327
4328 /* integer_pow2p (tree x) is nonzero is X is an integer constant with
4329    exactly one bit 1.  */
4330
4331 extern int integer_pow2p (const_tree);
4332
4333 /* integer_nonzerop (tree x) is nonzero if X is an integer constant
4334    with a nonzero value.  */
4335
4336 extern int integer_nonzerop (const_tree);
4337
4338 /* integer_truep (tree x) is nonzero if X is an integer constant of value 1 or
4339    a vector where each element is an integer constant of value -1.  */
4340
4341 extern int integer_truep (const_tree);
4342
4343 extern bool cst_and_fits_in_hwi (const_tree);
4344 extern tree num_ending_zeros (const_tree);
4345
4346 /* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of
4347    value 0.  */
4348
4349 extern int fixed_zerop (const_tree);
4350
4351 /* staticp (tree x) is nonzero if X is a reference to data allocated
4352    at a fixed address in memory.  Returns the outermost data.  */
4353
4354 extern tree staticp (tree);
4355
4356 /* save_expr (EXP) returns an expression equivalent to EXP
4357    but it can be used multiple times within context CTX
4358    and only evaluate EXP once.  */
4359
4360 extern tree save_expr (tree);
4361
4362 /* Return true if T is function-invariant.  */
4363
4364 extern bool tree_invariant_p (tree);
4365
4366 /* Look inside EXPR into any simple arithmetic operations.  Return the
4367    outermost non-arithmetic or non-invariant node.  */
4368
4369 extern tree skip_simple_arithmetic (tree);
4370
4371 /* Look inside EXPR into simple arithmetic operations involving constants.
4372    Return the outermost non-arithmetic or non-constant node.  */
4373
4374 extern tree skip_simple_constant_arithmetic (tree);
4375
4376 /* Return which tree structure is used by T.  */
4377
4378 enum tree_node_structure_enum tree_node_structure (const_tree);
4379
4380 /* Return true if EXP contains a PLACEHOLDER_EXPR, i.e. if it represents a
4381    size or offset that depends on a field within a record.  */
4382
4383 extern bool contains_placeholder_p (const_tree);
4384
4385 /* This macro calls the above function but short-circuits the common
4386    case of a constant to save time.  Also check for null.  */
4387
4388 #define CONTAINS_PLACEHOLDER_P(EXP) \
4389   ((EXP) != 0 && ! TREE_CONSTANT (EXP) && contains_placeholder_p (EXP))
4390
4391 /* Return true if any part of the structure of TYPE involves a PLACEHOLDER_EXPR
4392    directly.  This includes size, bounds, qualifiers (for QUAL_UNION_TYPE) and
4393    field positions.  */
4394
4395 extern bool type_contains_placeholder_p (tree);
4396
4397 /* Given a tree EXP, find all occurrences of references to fields
4398    in a PLACEHOLDER_EXPR and place them in vector REFS without
4399    duplicates.  Also record VAR_DECLs and CONST_DECLs.  Note that
4400    we assume here that EXP contains only arithmetic expressions
4401    or CALL_EXPRs with PLACEHOLDER_EXPRs occurring only in their
4402    argument list.  */
4403
4404 extern void find_placeholder_in_expr (tree, vec<tree> *);
4405
4406 /* This macro calls the above function but short-circuits the common
4407    case of a constant to save time and also checks for NULL.  */
4408
4409 #define FIND_PLACEHOLDER_IN_EXPR(EXP, V) \
4410 do {                                     \
4411   if((EXP) && !TREE_CONSTANT (EXP))      \
4412     find_placeholder_in_expr (EXP, V);   \
4413 } while (0)
4414
4415 /* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
4416    return a tree with all occurrences of references to F in a
4417    PLACEHOLDER_EXPR replaced by R.  Also handle VAR_DECLs and
4418    CONST_DECLs.  Note that we assume here that EXP contains only
4419    arithmetic expressions or CALL_EXPRs with PLACEHOLDER_EXPRs
4420    occurring only in their argument list.  */
4421
4422 extern tree substitute_in_expr (tree, tree, tree);
4423
4424 /* This macro calls the above function but short-circuits the common
4425    case of a constant to save time and also checks for NULL.  */
4426
4427 #define SUBSTITUTE_IN_EXPR(EXP, F, R) \
4428   ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP) : substitute_in_expr (EXP, F, R))
4429
4430 /* Similar, but look for a PLACEHOLDER_EXPR in EXP and find a replacement
4431    for it within OBJ, a tree that is an object or a chain of references.  */
4432
4433 extern tree substitute_placeholder_in_expr (tree, tree);
4434
4435 /* This macro calls the above function but short-circuits the common
4436    case of a constant to save time and also checks for NULL.  */
4437
4438 #define SUBSTITUTE_PLACEHOLDER_IN_EXPR(EXP, OBJ) \
4439   ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP)    \
4440    : substitute_placeholder_in_expr (EXP, OBJ))
4441
4442
4443 /* stabilize_reference (EXP) returns a reference equivalent to EXP
4444    but it can be used multiple times
4445    and only evaluate the subexpressions once.  */
4446
4447 extern tree stabilize_reference (tree);
4448
4449 /* Return EXP, stripped of any conversions to wider types
4450    in such a way that the result of converting to type FOR_TYPE
4451    is the same as if EXP were converted to FOR_TYPE.
4452    If FOR_TYPE is 0, it signifies EXP's type.  */
4453
4454 extern tree get_unwidened (tree, tree);
4455
4456 /* Return OP or a simpler expression for a narrower value
4457    which can be sign-extended or zero-extended to give back OP.
4458    Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
4459    or 0 if the value should be sign-extended.  */
4460
4461 extern tree get_narrower (tree, int *);
4462
4463 /* Return true if T is an expression that get_inner_reference handles.  */
4464
4465 static inline bool
4466 handled_component_p (const_tree t)
4467 {
4468   switch (TREE_CODE (t))
4469     {
4470     case COMPONENT_REF:
4471     case BIT_FIELD_REF:
4472     case ARRAY_REF:
4473     case ARRAY_RANGE_REF:
4474     case REALPART_EXPR:
4475     case IMAGPART_EXPR:
4476     case VIEW_CONVERT_EXPR:
4477       return true;
4478
4479     default:
4480       return false;
4481     }
4482 }
4483
4484 /* Return true T is a component with reverse storage order.  */
4485
4486 static inline bool
4487 reverse_storage_order_for_component_p (tree t)
4488 {
4489   /* The storage order only applies to scalar components.  */
4490   if (AGGREGATE_TYPE_P (TREE_TYPE (t)) || VECTOR_TYPE_P (TREE_TYPE (t)))
4491     return false;
4492
4493   if (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR)
4494     t = TREE_OPERAND (t, 0);
4495
4496   switch (TREE_CODE (t))
4497     {
4498     case ARRAY_REF:
4499     case COMPONENT_REF:
4500       /* ??? Fortran can take COMPONENT_REF of a VOID_TYPE.  */
4501       /* ??? UBSan can take COMPONENT_REF of a REFERENCE_TYPE.  */
4502       return AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0)))
4503              && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (TREE_OPERAND (t, 0)));
4504
4505     case BIT_FIELD_REF:
4506     case MEM_REF:
4507       return REF_REVERSE_STORAGE_ORDER (t);
4508
4509     case ARRAY_RANGE_REF:
4510     case VIEW_CONVERT_EXPR:
4511     default:
4512       return false;
4513     }
4514
4515   gcc_unreachable ();
4516 }
4517
4518 /* Return true if T is a storage order barrier, i.e. a VIEW_CONVERT_EXPR
4519    that can modify the storage order of objects.  Note that, even if the
4520    TYPE_REVERSE_STORAGE_ORDER flag is set on both the inner type and the
4521    outer type, a VIEW_CONVERT_EXPR can modify the storage order because
4522    it can change the partition of the aggregate object into scalars.  */
4523
4524 static inline bool
4525 storage_order_barrier_p (const_tree t)
4526 {
4527   if (TREE_CODE (t) != VIEW_CONVERT_EXPR)
4528     return false;
4529
4530   if (AGGREGATE_TYPE_P (TREE_TYPE (t))
4531       && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (t)))
4532     return true;
4533
4534   tree op = TREE_OPERAND (t, 0);
4535
4536   if (AGGREGATE_TYPE_P (TREE_TYPE (op))
4537       && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (op)))
4538     return true;
4539
4540   return false;
4541 }
4542
4543 /* Given a DECL or TYPE, return the scope in which it was declared, or
4544    NUL_TREE if there is no containing scope.  */
4545
4546 extern tree get_containing_scope (const_tree);
4547
4548 /* Return the FUNCTION_DECL which provides this _DECL with its context,
4549    or zero if none.  */
4550 extern tree decl_function_context (const_tree);
4551
4552 /* Return the RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE which provides
4553    this _DECL with its context, or zero if none.  */
4554 extern tree decl_type_context (const_tree);
4555
4556 /* Return 1 if EXPR is the real constant zero.  */
4557 extern int real_zerop (const_tree);
4558
4559 /* Initialize the iterator I with arguments from function FNDECL  */
4560
4561 static inline void
4562 function_args_iter_init (function_args_iterator *i, const_tree fntype)
4563 {
4564   i->next = TYPE_ARG_TYPES (fntype);
4565 }
4566
4567 /* Return a pointer that holds the next argument if there are more arguments to
4568    handle, otherwise return NULL.  */
4569
4570 static inline tree *
4571 function_args_iter_cond_ptr (function_args_iterator *i)
4572 {
4573   return (i->next) ? &TREE_VALUE (i->next) : NULL;
4574 }
4575
4576 /* Return the next argument if there are more arguments to handle, otherwise
4577    return NULL.  */
4578
4579 static inline tree
4580 function_args_iter_cond (function_args_iterator *i)
4581 {
4582   return (i->next) ? TREE_VALUE (i->next) : NULL_TREE;
4583 }
4584
4585 /* Advance to the next argument.  */
4586 static inline void
4587 function_args_iter_next (function_args_iterator *i)
4588 {
4589   gcc_assert (i->next != NULL_TREE);
4590   i->next = TREE_CHAIN (i->next);
4591 }
4592
4593 /* We set BLOCK_SOURCE_LOCATION only to inlined function entry points.  */
4594
4595 static inline bool
4596 inlined_function_outer_scope_p (const_tree block)
4597 {
4598  return LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) != UNKNOWN_LOCATION;
4599 }
4600
4601 /* Loop over all function arguments of FNTYPE.  In each iteration, PTR is set
4602    to point to the next tree element.  ITER is an instance of
4603    function_args_iterator used to iterate the arguments.  */
4604 #define FOREACH_FUNCTION_ARGS_PTR(FNTYPE, PTR, ITER)                    \
4605   for (function_args_iter_init (&(ITER), (FNTYPE));                     \
4606        (PTR = function_args_iter_cond_ptr (&(ITER))) != NULL;           \
4607        function_args_iter_next (&(ITER)))
4608
4609 /* Loop over all function arguments of FNTYPE.  In each iteration, TREE is set
4610    to the next tree element.  ITER is an instance of function_args_iterator
4611    used to iterate the arguments.  */
4612 #define FOREACH_FUNCTION_ARGS(FNTYPE, TREE, ITER)                       \
4613   for (function_args_iter_init (&(ITER), (FNTYPE));                     \
4614        (TREE = function_args_iter_cond (&(ITER))) != NULL_TREE;         \
4615        function_args_iter_next (&(ITER)))
4616
4617 /* In tree.c */
4618 extern unsigned crc32_string (unsigned, const char *);
4619 extern unsigned crc32_byte (unsigned, char);
4620 extern unsigned crc32_unsigned (unsigned, unsigned);
4621 extern void clean_symbol_name (char *);
4622 extern tree get_file_function_name (const char *);
4623 extern tree get_callee_fndecl (const_tree);
4624 extern combined_fn get_call_combined_fn (const_tree);
4625 extern int type_num_arguments (const_tree);
4626 extern bool associative_tree_code (enum tree_code);
4627 extern bool commutative_tree_code (enum tree_code);
4628 extern bool commutative_ternary_tree_code (enum tree_code);
4629 extern bool operation_can_overflow (enum tree_code);
4630 extern bool operation_no_trapping_overflow (tree, enum tree_code);
4631 extern tree upper_bound_in_type (tree, tree);
4632 extern tree lower_bound_in_type (tree, tree);
4633 extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
4634 extern tree create_artificial_label (location_t);
4635 extern const char *get_name (tree);
4636 extern bool stdarg_p (const_tree);
4637 extern bool prototype_p (const_tree);
4638 extern bool is_typedef_decl (const_tree x);
4639 extern bool typedef_variant_p (const_tree);
4640 extern bool auto_var_in_fn_p (const_tree, const_tree);
4641 extern tree build_low_bits_mask (tree, unsigned);
4642 extern bool tree_nop_conversion_p (const_tree, const_tree);
4643 extern tree tree_strip_nop_conversions (tree);
4644 extern tree tree_strip_sign_nop_conversions (tree);
4645 extern const_tree strip_invariant_refs (const_tree);
4646 extern tree lhd_gcc_personality (void);
4647 extern void assign_assembler_name_if_neeeded (tree);
4648 extern void warn_deprecated_use (tree, tree);
4649 extern void cache_integer_cst (tree);
4650 extern const char *combined_fn_name (combined_fn);
4651
4652 /* Return the memory model from a host integer.  */
4653 static inline enum memmodel
4654 memmodel_from_int (unsigned HOST_WIDE_INT val)
4655 {
4656   return (enum memmodel) (val & MEMMODEL_MASK);
4657 }
4658
4659 /* Return the base memory model from a host integer.  */
4660 static inline enum memmodel
4661 memmodel_base (unsigned HOST_WIDE_INT val)
4662 {
4663   return (enum memmodel) (val & MEMMODEL_BASE_MASK);
4664 }
4665
4666 /* Return TRUE if the memory model is RELAXED.  */
4667 static inline bool
4668 is_mm_relaxed (enum memmodel model)
4669 {
4670   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED;
4671 }
4672
4673 /* Return TRUE if the memory model is CONSUME.  */
4674 static inline bool
4675 is_mm_consume (enum memmodel model)
4676 {
4677   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME;
4678 }
4679
4680 /* Return TRUE if the memory model is ACQUIRE.  */
4681 static inline bool
4682 is_mm_acquire (enum memmodel model)
4683 {
4684   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE;
4685 }
4686
4687 /* Return TRUE if the memory model is RELEASE.  */
4688 static inline bool
4689 is_mm_release (enum memmodel model)
4690 {
4691   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE;
4692 }
4693
4694 /* Return TRUE if the memory model is ACQ_REL.  */
4695 static inline bool
4696 is_mm_acq_rel (enum memmodel model)
4697 {
4698   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL;
4699 }
4700
4701 /* Return TRUE if the memory model is SEQ_CST.  */
4702 static inline bool
4703 is_mm_seq_cst (enum memmodel model)
4704 {
4705   return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST;
4706 }
4707
4708 /* Return TRUE if the memory model is a SYNC variant.  */
4709 static inline bool
4710 is_mm_sync (enum memmodel model)
4711 {
4712   return (model & MEMMODEL_SYNC);
4713 }
4714
4715 /* Compare and hash for any structure which begins with a canonical
4716    pointer.  Assumes all pointers are interchangeable, which is sort
4717    of already assumed by gcc elsewhere IIRC.  */
4718
4719 static inline int
4720 struct_ptr_eq (const void *a, const void *b)
4721 {
4722   const void * const * x = (const void * const *) a;
4723   const void * const * y = (const void * const *) b;
4724   return *x == *y;
4725 }
4726
4727 static inline hashval_t
4728 struct_ptr_hash (const void *a)
4729 {
4730   const void * const * x = (const void * const *) a;
4731   return (intptr_t)*x >> 4;
4732 }
4733
4734 /* Return nonzero if CODE is a tree code that represents a truth value.  */
4735 static inline bool
4736 truth_value_p (enum tree_code code)
4737 {
4738   return (TREE_CODE_CLASS (code) == tcc_comparison
4739           || code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
4740           || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
4741           || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR);
4742 }
4743
4744 /* Return whether TYPE is a type suitable for an offset for
4745    a POINTER_PLUS_EXPR.  */
4746 static inline bool
4747 ptrofftype_p (tree type)
4748 {
4749   return (INTEGRAL_TYPE_P (type)
4750           && TYPE_PRECISION (type) == TYPE_PRECISION (sizetype)
4751           && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
4752 }
4753
4754 /* Return true if the argument is a complete type or an array
4755    of unknown bound (whose type is incomplete but) whose elements
4756    have complete type.  */
4757 static inline bool
4758 complete_or_array_type_p (const_tree type)
4759 {
4760   return COMPLETE_TYPE_P (type)
4761          || (TREE_CODE (type) == ARRAY_TYPE
4762              && COMPLETE_TYPE_P (TREE_TYPE (type)));
4763 }
4764
4765 extern tree strip_float_extensions (tree);
4766 extern int really_constant_p (const_tree);
4767 extern bool decl_address_invariant_p (const_tree);
4768 extern bool decl_address_ip_invariant_p (const_tree);
4769 extern bool int_fits_type_p (const_tree, const_tree);
4770 #ifndef GENERATOR_FILE
4771 extern void get_type_static_bounds (const_tree, mpz_t, mpz_t);
4772 #endif
4773 extern bool variably_modified_type_p (tree, tree);
4774 extern int tree_log2 (const_tree);
4775 extern int tree_floor_log2 (const_tree);
4776 extern unsigned int tree_ctz (const_tree);
4777 extern int simple_cst_equal (const_tree, const_tree);
4778
4779 namespace inchash
4780 {
4781
4782 extern void add_expr (const_tree, hash &, unsigned int = 0);
4783
4784 }
4785
4786 /* Compat version until all callers are converted. Return hash for
4787    TREE with SEED.  */
4788 static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed)
4789 {
4790   inchash::hash hstate (seed);
4791   inchash::add_expr (tree, hstate);
4792   return hstate.end ();
4793 }
4794
4795 extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
4796 extern int type_list_equal (const_tree, const_tree);
4797 extern int chain_member (const_tree, const_tree);
4798 extern void dump_tree_statistics (void);
4799 extern void recompute_tree_invariant_for_addr_expr (tree);
4800 extern bool needs_to_live_in_memory (const_tree);
4801 extern tree reconstruct_complex_type (tree, tree);
4802 extern int real_onep (const_tree);
4803 extern int real_minus_onep (const_tree);
4804 extern void init_ttree (void);
4805 extern void build_common_tree_nodes (bool);
4806 extern void build_common_builtin_nodes (void);
4807 extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
4808 extern tree build_nonstandard_boolean_type (unsigned HOST_WIDE_INT);
4809 extern tree build_range_type (tree, tree, tree);
4810 extern tree build_nonshared_range_type (tree, tree, tree);
4811 extern bool subrange_type_for_debug_p (const_tree, tree *, tree *);
4812 extern HOST_WIDE_INT int_cst_value (const_tree);
4813 extern tree tree_block (tree);
4814 extern void tree_set_block (tree, tree);
4815 extern location_t *block_nonartificial_location (tree);
4816 extern location_t tree_nonartificial_location (tree);
4817 extern tree block_ultimate_origin (const_tree);
4818 extern tree get_binfo_at_offset (tree, HOST_WIDE_INT, tree);
4819 extern bool virtual_method_call_p (const_tree);
4820 extern tree obj_type_ref_class (const_tree ref);
4821 extern bool types_same_for_odr (const_tree type1, const_tree type2,
4822                                 bool strict=false);
4823 extern bool contains_bitfld_component_ref_p (const_tree);
4824 extern bool block_may_fallthru (const_tree);
4825 extern void using_eh_for_cleanups (void);
4826 extern bool using_eh_for_cleanups_p (void);
4827 extern const char *get_tree_code_name (enum tree_code);
4828 extern void set_call_expr_flags (tree, int);
4829 extern tree walk_tree_1 (tree*, walk_tree_fn, void*, hash_set<tree>*,
4830                          walk_tree_lh);
4831 extern tree walk_tree_without_duplicates_1 (tree*, walk_tree_fn, void*,
4832                                             walk_tree_lh);
4833 #define walk_tree(a,b,c,d) \
4834         walk_tree_1 (a, b, c, d, NULL)
4835 #define walk_tree_without_duplicates(a,b,c) \
4836         walk_tree_without_duplicates_1 (a, b, c, NULL)
4837
4838 extern tree drop_tree_overflow (tree);
4839
4840 /* Given a memory reference expression T, return its base address.
4841    The base address of a memory reference expression is the main
4842    object being referenced.  */
4843 extern tree get_base_address (tree t);
4844
4845 /* Return a tree of sizetype representing the size, in bytes, of the element
4846    of EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
4847 extern tree array_ref_element_size (tree);
4848
4849 /* Return a tree representing the upper bound of the array mentioned in
4850    EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
4851 extern tree array_ref_up_bound (tree);
4852
4853 /* Return a tree representing the lower bound of the array mentioned in
4854    EXP, an ARRAY_REF or an ARRAY_RANGE_REF.  */
4855 extern tree array_ref_low_bound (tree);
4856
4857 /* Returns true if REF is an array reference to an array at the end of
4858    a structure.  If this is the case, the array may be allocated larger
4859    than its upper bound implies.  */
4860 extern bool array_at_struct_end_p (tree);
4861
4862 /* Return a tree representing the offset, in bytes, of the field referenced
4863    by EXP.  This does not include any offset in DECL_FIELD_BIT_OFFSET.  */
4864 extern tree component_ref_field_offset (tree);
4865
4866 extern int tree_map_base_eq (const void *, const void *);
4867 extern unsigned int tree_map_base_hash (const void *);
4868 extern int tree_map_base_marked_p (const void *);
4869 extern void DEBUG_FUNCTION verify_type (const_tree t);
4870 extern bool gimple_canonical_types_compatible_p (const_tree, const_tree,
4871                                                  bool trust_type_canonical = true);
4872 extern bool type_with_interoperable_signedness (const_tree);
4873
4874 /* Return simplified tree code of type that is used for canonical type
4875    merging.  */
4876 inline enum tree_code
4877 tree_code_for_canonical_type_merging (enum tree_code code)
4878 {
4879   /* By C standard, each enumerated type shall be compatible with char,
4880      a signed integer, or an unsigned integer.  The choice of type is
4881      implementation defined (in our case it depends on -fshort-enum).
4882
4883      For this reason we make no distinction between ENUMERAL_TYPE and INTEGER
4884      type and compare only by their signedness and precision.  */
4885   if (code == ENUMERAL_TYPE)
4886     return INTEGER_TYPE;
4887   /* To allow inter-operability between languages having references and
4888      C, we consider reference types and pointers alike.  Note that this is
4889      not strictly necessary for C-Fortran 2008 interoperability because
4890      Fortran define C_PTR type that needs to be compatible with C pointers
4891      and we handle this one as ptr_type_node.  */
4892   if (code == REFERENCE_TYPE)
4893     return POINTER_TYPE;
4894   return code;
4895 }
4896
4897 /* Return ture if get_alias_set care about TYPE_CANONICAL of given type.
4898    We don't define the types for pointers, arrays and vectors.  The reason is
4899    that pointers are handled specially: ptr_type_node accesses conflict with
4900    accesses to all other pointers.  This is done by alias.c.
4901    Because alias sets of arrays and vectors are the same as types of their
4902    elements, we can't compute canonical type either.  Otherwise we could go
4903    form void *[10] to int *[10] (because they are equivalent for canonical type
4904    machinery) and get wrong TBAA.  */
4905
4906 inline bool
4907 canonical_type_used_p (const_tree t)
4908 {
4909   return !(POINTER_TYPE_P (t)
4910            || TREE_CODE (t) == ARRAY_TYPE
4911            || TREE_CODE (t) == VECTOR_TYPE);
4912 }
4913
4914 #define tree_map_eq tree_map_base_eq
4915 extern unsigned int tree_map_hash (const void *);
4916 #define tree_map_marked_p tree_map_base_marked_p
4917
4918 #define tree_decl_map_eq tree_map_base_eq
4919 extern unsigned int tree_decl_map_hash (const void *);
4920 #define tree_decl_map_marked_p tree_map_base_marked_p
4921
4922 struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash<tree_decl_map>
4923 {
4924   static hashval_t hash (tree_decl_map *m) { return tree_decl_map_hash (m); }
4925   static bool
4926   equal (tree_decl_map *a, tree_decl_map *b)
4927   {
4928     return tree_decl_map_eq (a, b);
4929   }
4930
4931   static int
4932   keep_cache_entry (tree_decl_map *&m)
4933   {
4934     return ggc_marked_p (m->base.from);
4935   }
4936 };
4937
4938 #define tree_int_map_eq tree_map_base_eq
4939 #define tree_int_map_hash tree_map_base_hash
4940 #define tree_int_map_marked_p tree_map_base_marked_p
4941
4942 #define tree_vec_map_eq tree_map_base_eq
4943 #define tree_vec_map_hash tree_decl_map_hash
4944 #define tree_vec_map_marked_p tree_map_base_marked_p
4945
4946 /* Initialize the abstract argument list iterator object ITER with the
4947    arguments from CALL_EXPR node EXP.  */
4948 static inline void
4949 init_call_expr_arg_iterator (tree exp, call_expr_arg_iterator *iter)
4950 {
4951   iter->t = exp;
4952   iter->n = call_expr_nargs (exp);
4953   iter->i = 0;
4954 }
4955
4956 static inline void
4957 init_const_call_expr_arg_iterator (const_tree exp, const_call_expr_arg_iterator *iter)
4958 {
4959   iter->t = exp;
4960   iter->n = call_expr_nargs (exp);
4961   iter->i = 0;
4962 }
4963
4964 /* Return the next argument from abstract argument list iterator object ITER,
4965    and advance its state.  Return NULL_TREE if there are no more arguments.  */
4966 static inline tree
4967 next_call_expr_arg (call_expr_arg_iterator *iter)
4968 {
4969   tree result;
4970   if (iter->i >= iter->n)
4971     return NULL_TREE;
4972   result = CALL_EXPR_ARG (iter->t, iter->i);
4973   iter->i++;
4974   return result;
4975 }
4976
4977 static inline const_tree
4978 next_const_call_expr_arg (const_call_expr_arg_iterator *iter)
4979 {
4980   const_tree result;
4981   if (iter->i >= iter->n)
4982     return NULL_TREE;
4983   result = CALL_EXPR_ARG (iter->t, iter->i);
4984   iter->i++;
4985   return result;
4986 }
4987
4988 /* Initialize the abstract argument list iterator object ITER, then advance
4989    past and return the first argument.  Useful in for expressions, e.g.
4990      for (arg = first_call_expr_arg (exp, &iter); arg;
4991           arg = next_call_expr_arg (&iter))   */
4992 static inline tree
4993 first_call_expr_arg (tree exp, call_expr_arg_iterator *iter)
4994 {
4995   init_call_expr_arg_iterator (exp, iter);
4996   return next_call_expr_arg (iter);
4997 }
4998
4999 static inline const_tree
5000 first_const_call_expr_arg (const_tree exp, const_call_expr_arg_iterator *iter)
5001 {
5002   init_const_call_expr_arg_iterator (exp, iter);
5003   return next_const_call_expr_arg (iter);
5004 }
5005
5006 /* Test whether there are more arguments in abstract argument list iterator
5007    ITER, without changing its state.  */
5008 static inline bool
5009 more_call_expr_args_p (const call_expr_arg_iterator *iter)
5010 {
5011   return (iter->i < iter->n);
5012 }
5013
5014 /* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER
5015    (of type call_expr_arg_iterator) to hold the iteration state.  */
5016 #define FOR_EACH_CALL_EXPR_ARG(arg, iter, call)                 \
5017   for ((arg) = first_call_expr_arg ((call), &(iter)); (arg);    \
5018        (arg) = next_call_expr_arg (&(iter)))
5019
5020 #define FOR_EACH_CONST_CALL_EXPR_ARG(arg, iter, call)                   \
5021   for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg);      \
5022        (arg) = next_const_call_expr_arg (&(iter)))
5023
5024 /* Return true if tree node T is a language-specific node.  */
5025 static inline bool
5026 is_lang_specific (const_tree t)
5027 {
5028   return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES;
5029 }
5030
5031 /* Valid builtin number.  */
5032 #define BUILTIN_VALID_P(FNCODE) \
5033   (IN_RANGE ((int)FNCODE, ((int)BUILT_IN_NONE) + 1, ((int) END_BUILTINS) - 1))
5034
5035 /* Return the tree node for an explicit standard builtin function or NULL.  */
5036 static inline tree
5037 builtin_decl_explicit (enum built_in_function fncode)
5038 {
5039   gcc_checking_assert (BUILTIN_VALID_P (fncode));
5040
5041   return builtin_info[(size_t)fncode].decl;
5042 }
5043
5044 /* Return the tree node for an implicit builtin function or NULL.  */
5045 static inline tree
5046 builtin_decl_implicit (enum built_in_function fncode)
5047 {
5048   size_t uns_fncode = (size_t)fncode;
5049   gcc_checking_assert (BUILTIN_VALID_P (fncode));
5050
5051   if (!builtin_info[uns_fncode].implicit_p)
5052     return NULL_TREE;
5053
5054   return builtin_info[uns_fncode].decl;
5055 }
5056
5057 /* Set explicit builtin function nodes and whether it is an implicit
5058    function.  */
5059
5060 static inline void
5061 set_builtin_decl (enum built_in_function fncode, tree decl, bool implicit_p)
5062 {
5063   size_t ufncode = (size_t)fncode;
5064
5065   gcc_checking_assert (BUILTIN_VALID_P (fncode)
5066                        && (decl != NULL_TREE || !implicit_p));
5067
5068   builtin_info[ufncode].decl = decl;
5069   builtin_info[ufncode].implicit_p = implicit_p;
5070   builtin_info[ufncode].declared_p = false;
5071 }
5072
5073 /* Set the implicit flag for a builtin function.  */
5074
5075 static inline void
5076 set_builtin_decl_implicit_p (enum built_in_function fncode, bool implicit_p)
5077 {
5078   size_t uns_fncode = (size_t)fncode;
5079
5080   gcc_checking_assert (BUILTIN_VALID_P (fncode)
5081                        && builtin_info[uns_fncode].decl != NULL_TREE);
5082
5083   builtin_info[uns_fncode].implicit_p = implicit_p;
5084 }
5085
5086 /* Set the declared flag for a builtin function.  */
5087
5088 static inline void
5089 set_builtin_decl_declared_p (enum built_in_function fncode, bool declared_p)
5090 {
5091   size_t uns_fncode = (size_t)fncode;
5092
5093   gcc_checking_assert (BUILTIN_VALID_P (fncode)
5094                        && builtin_info[uns_fncode].decl != NULL_TREE);
5095
5096   builtin_info[uns_fncode].declared_p = declared_p;
5097 }
5098
5099 /* Return whether the standard builtin function can be used as an explicit
5100    function.  */
5101
5102 static inline bool
5103 builtin_decl_explicit_p (enum built_in_function fncode)
5104 {
5105   gcc_checking_assert (BUILTIN_VALID_P (fncode));
5106   return (builtin_info[(size_t)fncode].decl != NULL_TREE);
5107 }
5108
5109 /* Return whether the standard builtin function can be used implicitly.  */
5110
5111 static inline bool
5112 builtin_decl_implicit_p (enum built_in_function fncode)
5113 {
5114   size_t uns_fncode = (size_t)fncode;
5115
5116   gcc_checking_assert (BUILTIN_VALID_P (fncode));
5117   return (builtin_info[uns_fncode].decl != NULL_TREE
5118           && builtin_info[uns_fncode].implicit_p);
5119 }
5120
5121 /* Return whether the standard builtin function was declared.  */
5122
5123 static inline bool
5124 builtin_decl_declared_p (enum built_in_function fncode)
5125 {
5126   size_t uns_fncode = (size_t)fncode;
5127
5128   gcc_checking_assert (BUILTIN_VALID_P (fncode));
5129   return (builtin_info[uns_fncode].decl != NULL_TREE
5130           && builtin_info[uns_fncode].declared_p);
5131 }
5132
5133 /* Return true if T (assumed to be a DECL) is a global variable.
5134    A variable is considered global if its storage is not automatic.  */
5135
5136 static inline bool
5137 is_global_var (const_tree t)
5138 {
5139   return (TREE_STATIC (t) || DECL_EXTERNAL (t));
5140 }
5141
5142 /* Return true if VAR may be aliased.  A variable is considered as
5143    maybe aliased if it has its address taken by the local TU
5144    or possibly by another TU and might be modified through a pointer.  */
5145
5146 static inline bool
5147 may_be_aliased (const_tree var)
5148 {
5149   return (TREE_CODE (var) != CONST_DECL
5150           && (TREE_PUBLIC (var)
5151               || DECL_EXTERNAL (var)
5152               || TREE_ADDRESSABLE (var))
5153           && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var))
5154                && ((TREE_READONLY (var)
5155                     && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var)))
5156                    || (TREE_CODE (var) == VAR_DECL
5157                        && DECL_NONALIASED (var)))));
5158 }
5159
5160 /* Return pointer to optimization flags of FNDECL.  */
5161 static inline struct cl_optimization *
5162 opts_for_fn (const_tree fndecl)
5163 {
5164   tree fn_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
5165   if (fn_opts == NULL_TREE)
5166     fn_opts = optimization_default_node;
5167   return TREE_OPTIMIZATION (fn_opts);
5168 }
5169
5170 /* Return pointer to target flags of FNDECL.  */
5171 static inline cl_target_option *
5172 target_opts_for_fn (const_tree fndecl)
5173 {
5174   tree fn_opts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
5175   if (fn_opts == NULL_TREE)
5176     fn_opts = target_option_default_node;
5177   return fn_opts == NULL_TREE ? NULL : TREE_TARGET_OPTION (fn_opts);
5178 }
5179
5180 /* opt flag for function FNDECL, e.g. opts_for_fn (fndecl, optimize) is
5181    the optimization level of function fndecl.  */
5182 #define opt_for_fn(fndecl, opt) (opts_for_fn (fndecl)->x_##opt)
5183
5184 /* For anonymous aggregate types, we need some sort of name to
5185    hold on to.  In practice, this should not appear, but it should
5186    not be harmful if it does.  */
5187 extern const char *anon_aggrname_format();
5188 extern bool anon_aggrname_p (const_tree);
5189
5190 /* The tree and const_tree overload templates.   */
5191 namespace wi
5192 {
5193   template <>
5194   struct int_traits <const_tree>
5195   {
5196     static const enum precision_type precision_type = VAR_PRECISION;
5197     static const bool host_dependent_precision = false;
5198     static const bool is_sign_extended = false;
5199     static unsigned int get_precision (const_tree);
5200     static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int,
5201                                       const_tree);
5202   };
5203
5204   template <>
5205   struct int_traits <tree> : public int_traits <const_tree> {};
5206
5207   template <int N>
5208   class extended_tree
5209   {
5210   private:
5211     const_tree m_t;
5212
5213   public:
5214     extended_tree (const_tree);
5215
5216     unsigned int get_precision () const;
5217     const HOST_WIDE_INT *get_val () const;
5218     unsigned int get_len () const;
5219   };
5220
5221   template <int N>
5222   struct int_traits <extended_tree <N> >
5223   {
5224     static const enum precision_type precision_type = CONST_PRECISION;
5225     static const bool host_dependent_precision = false;
5226     static const bool is_sign_extended = true;
5227     static const unsigned int precision = N;
5228   };
5229
5230   generic_wide_int <extended_tree <WIDE_INT_MAX_PRECISION> >
5231   to_widest (const_tree);
5232
5233   generic_wide_int <extended_tree <ADDR_MAX_PRECISION> > to_offset (const_tree);
5234
5235   wide_int to_wide (const_tree, unsigned int);
5236 }
5237
5238 inline unsigned int
5239 wi::int_traits <const_tree>::get_precision (const_tree tcst)
5240 {
5241   return TYPE_PRECISION (TREE_TYPE (tcst));
5242 }
5243
5244 /* Convert the tree_cst X into a wide_int of PRECISION.  */
5245 inline wi::storage_ref
5246 wi::int_traits <const_tree>::decompose (HOST_WIDE_INT *,
5247                                         unsigned int precision, const_tree x)
5248 {
5249   return wi::storage_ref (&TREE_INT_CST_ELT (x, 0), TREE_INT_CST_NUNITS (x),
5250                           precision);
5251 }
5252
5253 inline generic_wide_int <wi::extended_tree <WIDE_INT_MAX_PRECISION> >
5254 wi::to_widest (const_tree t)
5255 {
5256   return t;
5257 }
5258
5259 inline generic_wide_int <wi::extended_tree <ADDR_MAX_PRECISION> >
5260 wi::to_offset (const_tree t)
5261 {
5262   return t;
5263 }
5264
5265 /* Convert INTEGER_CST T to a wide_int of precision PREC, extending or
5266    truncating as necessary.  When extending, use sign extension if T's
5267    type is signed and zero extension if T's type is unsigned.  */
5268
5269 inline wide_int
5270 wi::to_wide (const_tree t, unsigned int prec)
5271 {
5272   return wide_int::from (t, prec, TYPE_SIGN (TREE_TYPE (t)));
5273 }
5274
5275 template <int N>
5276 inline wi::extended_tree <N>::extended_tree (const_tree t)
5277   : m_t (t)
5278 {
5279   gcc_checking_assert (TYPE_PRECISION (TREE_TYPE (t)) <= N);
5280 }
5281
5282 template <int N>
5283 inline unsigned int
5284 wi::extended_tree <N>::get_precision () const
5285 {
5286   return N;
5287 }
5288
5289 template <int N>
5290 inline const HOST_WIDE_INT *
5291 wi::extended_tree <N>::get_val () const
5292 {
5293   return &TREE_INT_CST_ELT (m_t, 0);
5294 }
5295
5296 template <int N>
5297 inline unsigned int
5298 wi::extended_tree <N>::get_len () const
5299 {
5300   if (N == ADDR_MAX_PRECISION)
5301     return TREE_INT_CST_OFFSET_NUNITS (m_t);
5302   else if (N >= WIDE_INT_MAX_PRECISION)
5303     return TREE_INT_CST_EXT_NUNITS (m_t);
5304   else
5305     /* This class is designed to be used for specific output precisions
5306        and needs to be as fast as possible, so there is no fallback for
5307        other casees.  */
5308     gcc_unreachable ();
5309 }
5310
5311 namespace wi
5312 {
5313   template <typename T>
5314   bool fits_to_tree_p (const T &x, const_tree);
5315
5316   wide_int min_value (const_tree);
5317   wide_int max_value (const_tree);
5318   wide_int from_mpz (const_tree, mpz_t, bool);
5319 }
5320
5321 template <typename T>
5322 bool
5323 wi::fits_to_tree_p (const T &x, const_tree type)
5324 {
5325   if (TYPE_SIGN (type) == UNSIGNED)
5326     return eq_p (x, zext (x, TYPE_PRECISION (type)));
5327   else
5328     return eq_p (x, sext (x, TYPE_PRECISION (type)));
5329 }
5330
5331 /* Produce the smallest number that is represented in TYPE.  The precision
5332    and sign are taken from TYPE.  */
5333 inline wide_int
5334 wi::min_value (const_tree type)
5335 {
5336   return min_value (TYPE_PRECISION (type), TYPE_SIGN (type));
5337 }
5338
5339 /* Produce the largest number that is represented in TYPE.  The precision
5340    and sign are taken from TYPE.  */
5341 inline wide_int
5342 wi::max_value (const_tree type)
5343 {
5344   return max_value (TYPE_PRECISION (type), TYPE_SIGN (type));
5345 }
5346
5347 /* Return true if INTEGER_CST T1 is less than INTEGER_CST T2,
5348    extending both according to their respective TYPE_SIGNs.  */
5349
5350 inline bool
5351 tree_int_cst_lt (const_tree t1, const_tree t2)
5352 {
5353   return wi::to_widest (t1) < wi::to_widest (t2);
5354 }
5355
5356 /* Return true if INTEGER_CST T1 is less than or equal to INTEGER_CST T2,
5357    extending both according to their respective TYPE_SIGNs.  */
5358
5359 inline bool
5360 tree_int_cst_le (const_tree t1, const_tree t2)
5361 {
5362   return wi::to_widest (t1) <= wi::to_widest (t2);
5363 }
5364
5365 /* Returns -1 if T1 < T2, 0 if T1 == T2, and 1 if T1 > T2.  T1 and T2
5366    are both INTEGER_CSTs and their values are extended according to their
5367    respective TYPE_SIGNs.  */
5368
5369 inline int
5370 tree_int_cst_compare (const_tree t1, const_tree t2)
5371 {
5372   return wi::cmps (wi::to_widest (t1), wi::to_widest (t2));
5373 }
5374
5375 /* FIXME - These declarations belong in builtins.h, expr.h and emit-rtl.h,
5376    but none of these files are allowed to be included from front ends.
5377    They should be split in two. One suitable for the FEs, the other suitable
5378    for the BE.  */
5379
5380 /* Assign the RTX to declaration.  */
5381 extern void set_decl_rtl (tree, rtx);
5382 extern bool complete_ctor_at_level_p (const_tree, HOST_WIDE_INT, const_tree);
5383
5384 /* Given an expression EXP that is a handled_component_p,
5385    look for the ultimate containing object, which is returned and specify
5386    the access position and size.  */
5387 extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
5388                                  tree *, machine_mode *, int *, int *, int *);
5389
5390 extern tree build_personality_function (const char *);
5391
5392 struct GTY(()) int_n_trees_t {
5393   /* These parts are initialized at runtime */
5394   tree signed_type;
5395   tree unsigned_type;
5396 };
5397
5398 /* This is also in machmode.h */
5399 extern bool int_n_enabled_p[NUM_INT_N_ENTS];
5400 extern GTY(()) struct int_n_trees_t int_n_trees[NUM_INT_N_ENTS];
5401
5402 /* Like bit_position, but return as an integer.  It must be representable in
5403    that way (since it could be a signed value, we don't have the
5404    option of returning -1 like int_size_in_byte can.  */
5405
5406 inline HOST_WIDE_INT
5407 int_bit_position (const_tree field)
5408 {
5409   return ((wi::to_offset (DECL_FIELD_OFFSET (field)) << LOG2_BITS_PER_UNIT)
5410           + wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi ();
5411 }
5412
5413 /* Return true if it makes sense to consider alias set for a type T.  */
5414
5415 inline bool
5416 type_with_alias_set_p (const_tree t)
5417 {
5418   /* Function and method types are never accessed as memory locations.  */
5419   if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE)
5420     return false;
5421
5422   if (COMPLETE_TYPE_P (t))
5423     return true;
5424
5425   /* Incomplete types can not be accessed in general except for arrays
5426      where we can fetch its element despite we have no array bounds.  */
5427   if (TREE_CODE (t) == ARRAY_TYPE && COMPLETE_TYPE_P (TREE_TYPE (t)))
5428     return true;
5429
5430   return false;
5431 }
5432
5433 extern location_t set_block (location_t loc, tree block);
5434
5435 extern void gt_ggc_mx (tree &);
5436 extern void gt_pch_nx (tree &);
5437 extern void gt_pch_nx (tree &, gt_pointer_operator, void *);
5438
5439 extern bool nonnull_arg_p (const_tree);
5440 extern bool is_redundant_typedef (const_tree);
5441
5442 extern location_t
5443 set_source_range (tree expr, location_t start, location_t finish);
5444
5445 extern location_t
5446 set_source_range (tree expr, source_range src_range);
5447
5448 static inline source_range
5449 get_decl_source_range (tree decl)
5450 {
5451   location_t loc = DECL_SOURCE_LOCATION (decl);
5452   return get_range_from_loc (line_table, loc);
5453 }
5454
5455 /* Return true if it makes sense to promote/demote from_type to to_type. */
5456 inline bool
5457 desired_pro_or_demotion_p (const_tree to_type, const_tree from_type)
5458 {
5459   unsigned int to_type_precision = TYPE_PRECISION (to_type);
5460
5461   /* OK to promote if to_type is no bigger than word_mode. */
5462   if (to_type_precision <= GET_MODE_PRECISION (word_mode))
5463     return true;
5464
5465   /* Otherwise, allow only if narrowing or same precision conversions. */
5466   return to_type_precision <= TYPE_PRECISION (from_type);
5467 }
5468
5469 #endif  /* GCC_TREE_H  */