1 /* Language-dependent node constructors for parse phase of GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000 Free Software Foundation, Inc.
4 Hacked by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
32 #include "insn-config.h"
33 #include "integrate.h"
35 static tree bot_manip
PARAMS ((tree
*, int *, void *));
36 static tree bot_replace
PARAMS ((tree
*, int *, void *));
37 static tree build_cplus_array_type_1
PARAMS ((tree
, tree
));
38 static void list_hash_add
PARAMS ((int, tree
));
39 static int list_hash
PARAMS ((tree
, tree
, tree
));
40 static tree list_hash_lookup
PARAMS ((int, tree
, tree
, tree
));
41 static cp_lvalue_kind lvalue_p_1
PARAMS ((tree
, int));
42 static tree no_linkage_helper
PARAMS ((tree
*, int *, void *));
43 static tree build_srcloc
PARAMS ((const char *, int));
44 static void mark_list_hash
PARAMS ((void *));
45 static int statement_code_p
PARAMS ((enum tree_code
));
46 static tree mark_local_for_remap_r
PARAMS ((tree
*, int *, void *));
47 static tree cp_unsave_r
PARAMS ((tree
*, int *, void *));
48 static void cp_unsave
PARAMS ((tree
*));
49 static tree build_target_expr
PARAMS ((tree
, tree
));
50 static tree count_trees_r
PARAMS ((tree
*, int *, void *));
51 static tree verify_stmt_tree_r
PARAMS ((tree
*, int *, void *));
52 static tree find_tree_r
PARAMS ((tree
*, int *, void *));
54 /* If REF is an lvalue, returns the kind of lvalue that REF is.
55 Otherwise, returns clk_none. If TREAT_CLASS_RVALUES_AS_LVALUES is
56 non-zero, rvalues of class type are considered lvalues. */
59 lvalue_p_1 (ref
, treat_class_rvalues_as_lvalues
)
61 int treat_class_rvalues_as_lvalues
;
63 cp_lvalue_kind op1_lvalue_kind
= clk_none
;
64 cp_lvalue_kind op2_lvalue_kind
= clk_none
;
66 if (TREE_CODE (TREE_TYPE (ref
)) == REFERENCE_TYPE
)
69 if (ref
== current_class_ptr
&& flag_this_is_variable
<= 0)
72 switch (TREE_CODE (ref
))
74 /* preincrements and predecrements are valid lvals, provided
75 what they refer to are valid lvals. */
76 case PREINCREMENT_EXPR
:
77 case PREDECREMENT_EXPR
:
81 case WITH_CLEANUP_EXPR
:
85 return lvalue_p_1 (TREE_OPERAND (ref
, 0),
86 treat_class_rvalues_as_lvalues
);
89 op1_lvalue_kind
= lvalue_p_1 (TREE_OPERAND (ref
, 0),
90 treat_class_rvalues_as_lvalues
);
92 /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
94 && TREE_CODE (TREE_OPERAND (ref
, 1)) == FIELD_DECL
95 && DECL_C_BIT_FIELD (TREE_OPERAND (ref
, 1)))
97 /* Clear the ordinary bit. If this object was a class
98 rvalue we want to preserve that information. */
99 op1_lvalue_kind
&= ~clk_ordinary
;
100 /* The lvalue is for a btifield. */
101 op1_lvalue_kind
|= clk_bitfield
;
103 return op1_lvalue_kind
;
109 if (TREE_READONLY (ref
) && ! TREE_STATIC (ref
)
110 && DECL_LANG_SPECIFIC (ref
)
111 && DECL_IN_AGGR_P (ref
))
117 if (TREE_CODE (TREE_TYPE (ref
)) != METHOD_TYPE
)
121 /* A currently unresolved scope ref. */
123 my_friendly_abort (103);
125 if (TREE_CODE (TREE_OPERAND (ref
, 1)) == FUNCTION_DECL
)
130 op1_lvalue_kind
= lvalue_p_1 (TREE_OPERAND (ref
, 0),
131 treat_class_rvalues_as_lvalues
);
132 op2_lvalue_kind
= lvalue_p_1 (TREE_OPERAND (ref
, 1),
133 treat_class_rvalues_as_lvalues
);
137 op1_lvalue_kind
= lvalue_p_1 (TREE_OPERAND (ref
, 1),
138 treat_class_rvalues_as_lvalues
);
139 op2_lvalue_kind
= lvalue_p_1 (TREE_OPERAND (ref
, 2),
140 treat_class_rvalues_as_lvalues
);
147 return lvalue_p_1 (TREE_OPERAND (ref
, 1),
148 treat_class_rvalues_as_lvalues
);
151 return treat_class_rvalues_as_lvalues
? clk_class
: clk_none
;
155 return ((treat_class_rvalues_as_lvalues
156 && IS_AGGR_TYPE (TREE_TYPE (ref
)))
157 ? clk_class
: clk_none
);
160 /* All functions (except non-static-member functions) are
162 return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref
)
163 ? clk_none
: clk_ordinary
);
169 /* If one operand is not an lvalue at all, then this expression is
171 if (!op1_lvalue_kind
|| !op2_lvalue_kind
)
174 /* Otherwise, it's an lvalue, and it has all the odd properties
175 contributed by either operand. */
176 op1_lvalue_kind
= op1_lvalue_kind
| op2_lvalue_kind
;
177 /* It's not an ordinary lvalue if it involves either a bit-field or
179 if ((op1_lvalue_kind
& ~clk_ordinary
) != clk_none
)
180 op1_lvalue_kind
&= ~clk_ordinary
;
181 return op1_lvalue_kind
;
184 /* If REF is an lvalue, returns the kind of lvalue that REF is.
185 Otherwise, returns clk_none. Lvalues can be assigned, unless they
186 have TREE_READONLY, or unless they are FUNCTION_DECLs. Lvalues can
187 have their address taken, unless they have DECL_REGISTER. */
193 return lvalue_p_1 (ref
, /*treat_class_rvalues_as_lvalues=*/0);
196 /* This differs from real_lvalue_p in that class rvalues are
197 considered lvalues. */
204 (lvalue_p_1 (ref
, /*treat_class_rvalues_as_lvalues=*/1) != clk_none
);
207 /* Return nonzero if REF is an lvalue valid for this language;
208 otherwise, print an error message and return zero. */
211 lvalue_or_else (ref
, string
)
215 int win
= lvalue_p (ref
);
217 error ("non-lvalue in %s", string
);
221 /* Build a TARGET_EXPR, initializing the DECL with the VALUE. */
224 build_target_expr (decl
, value
)
230 t
= build (TARGET_EXPR
, TREE_TYPE (decl
), decl
, value
,
231 maybe_build_cleanup (decl
), NULL_TREE
);
232 /* We always set TREE_SIDE_EFFECTS so that expand_expr does not
233 ignore the TARGET_EXPR. If there really turn out to be no
234 side-effects, then the optimizer should be able to get rid of
235 whatever code is generated anyhow. */
236 TREE_SIDE_EFFECTS (t
) = 1;
241 /* INIT is a CALL_EXPR which needs info about its target.
242 TYPE is the type that this initialization should appear to have.
244 Build an encapsulation of the initialization to perform
245 and return it so that it can be processed by language-independent
246 and language-specific expression expanders. */
249 build_cplus_new (type
, init
)
257 /* Make sure that we're not trying to create an instance of an
259 abstract_virtuals_error (NULL_TREE
, type
);
261 if (TREE_CODE (init
) != CALL_EXPR
&& TREE_CODE (init
) != AGGR_INIT_EXPR
)
262 return convert (type
, init
);
264 slot
= build (VAR_DECL
, type
);
265 DECL_ARTIFICIAL (slot
) = 1;
266 DECL_CONTEXT (slot
) = current_function_decl
;
267 layout_decl (slot
, 0);
269 /* We split the CALL_EXPR into its function and its arguments here.
270 Then, in expand_expr, we put them back together. The reason for
271 this is that this expression might be a default argument
272 expression. In that case, we need a new temporary every time the
273 expression is used. That's what break_out_target_exprs does; it
274 replaces every AGGR_INIT_EXPR with a copy that uses a fresh
275 temporary slot. Then, expand_expr builds up a call-expression
276 using the new slot. */
277 fn
= TREE_OPERAND (init
, 0);
278 rval
= build (AGGR_INIT_EXPR
, type
, fn
, TREE_OPERAND (init
, 1), slot
);
279 TREE_SIDE_EFFECTS (rval
) = 1;
280 AGGR_INIT_VIA_CTOR_P (rval
)
281 = (TREE_CODE (fn
) == ADDR_EXPR
282 && TREE_CODE (TREE_OPERAND (fn
, 0)) == FUNCTION_DECL
283 && DECL_CONSTRUCTOR_P (TREE_OPERAND (fn
, 0)));
284 rval
= build_target_expr (slot
, rval
);
289 /* Buidl a TARGET_EXPR using INIT to initialize a new temporary of the
293 build_target_expr_with_type (init
, type
)
300 if (TREE_CODE (init
) == TARGET_EXPR
)
303 slot
= build (VAR_DECL
, type
);
304 DECL_ARTIFICIAL (slot
) = 1;
305 DECL_CONTEXT (slot
) = current_function_decl
;
306 layout_decl (slot
, 0);
307 rval
= build_target_expr (slot
, init
);
312 /* Like build_target_expr_with_type, but use the type of INIT. */
315 get_target_expr (init
)
318 return build_target_expr_with_type (init
, TREE_TYPE (init
));
321 /* Recursively search EXP for CALL_EXPRs that need cleanups and replace
322 these CALL_EXPRs with tree nodes that will perform the cleanups. */
325 break_out_cleanups (exp
)
330 if (TREE_CODE (tmp
) == CALL_EXPR
331 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (tmp
)))
332 return build_cplus_new (TREE_TYPE (tmp
), tmp
);
334 while (TREE_CODE (tmp
) == NOP_EXPR
335 || TREE_CODE (tmp
) == CONVERT_EXPR
336 || TREE_CODE (tmp
) == NON_LVALUE_EXPR
)
338 if (TREE_CODE (TREE_OPERAND (tmp
, 0)) == CALL_EXPR
339 && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (TREE_OPERAND (tmp
, 0))))
341 TREE_OPERAND (tmp
, 0)
342 = build_cplus_new (TREE_TYPE (TREE_OPERAND (tmp
, 0)),
343 TREE_OPERAND (tmp
, 0));
347 tmp
= TREE_OPERAND (tmp
, 0);
352 /* Recursively perform a preorder search EXP for CALL_EXPRs, making
353 copies where they are found. Returns a deep copy all nodes transitively
354 containing CALL_EXPRs. */
357 break_out_calls (exp
)
360 register tree t1
, t2
= NULL_TREE
;
361 register enum tree_code code
;
362 register int changed
= 0;
365 if (exp
== NULL_TREE
)
368 code
= TREE_CODE (exp
);
370 if (code
== CALL_EXPR
)
371 return copy_node (exp
);
373 /* Don't try and defeat a save_expr, as it should only be done once. */
374 if (code
== SAVE_EXPR
)
377 switch (TREE_CODE_CLASS (code
))
382 case 'c': /* a constant */
383 case 't': /* a type node */
384 case 'x': /* something random, like an identifier or an ERROR_MARK. */
387 case 'd': /* A decl node */
388 #if 0 /* This is bogus. jason 9/21/94 */
390 t1
= break_out_calls (DECL_INITIAL (exp
));
391 if (t1
!= DECL_INITIAL (exp
))
393 exp
= copy_node (exp
);
394 DECL_INITIAL (exp
) = t1
;
399 case 'b': /* A block node */
401 /* Don't know how to handle these correctly yet. Must do a
402 break_out_calls on all DECL_INITIAL values for local variables,
403 and also break_out_calls on all sub-blocks and sub-statements. */
408 case 'e': /* an expression */
409 case 'r': /* a reference */
410 case 's': /* an expression with side effects */
411 for (i
= TREE_CODE_LENGTH (code
) - 1; i
>= 0; i
--)
413 t1
= break_out_calls (TREE_OPERAND (exp
, i
));
414 if (t1
!= TREE_OPERAND (exp
, i
))
416 exp
= copy_node (exp
);
417 TREE_OPERAND (exp
, i
) = t1
;
422 case '<': /* a comparison expression */
423 case '2': /* a binary arithmetic expression */
424 t2
= break_out_calls (TREE_OPERAND (exp
, 1));
425 if (t2
!= TREE_OPERAND (exp
, 1))
427 case '1': /* a unary arithmetic expression */
428 t1
= break_out_calls (TREE_OPERAND (exp
, 0));
429 if (t1
!= TREE_OPERAND (exp
, 0))
433 if (TREE_CODE_LENGTH (code
) == 1)
434 return build1 (code
, TREE_TYPE (exp
), t1
);
436 return build (code
, TREE_TYPE (exp
), t1
, t2
);
443 extern struct obstack permanent_obstack
;
445 /* Here is how primitive or already-canonicalized types' hash
446 codes are made. MUST BE CONSISTENT WITH tree.c !!! */
447 #define TYPE_HASH(TYPE) ((HOST_WIDE_INT) (TYPE) & 0777777)
449 /* Construct, lay out and return the type of methods belonging to class
450 BASETYPE and whose arguments are described by ARGTYPES and whose values
451 are described by RETTYPE. If each type exists already, reuse it. */
454 build_cplus_method_type (basetype
, rettype
, argtypes
)
455 tree basetype
, rettype
, argtypes
;
461 /* Make a node of the sort we want. */
462 t
= make_node (METHOD_TYPE
);
464 TYPE_METHOD_BASETYPE (t
) = TYPE_MAIN_VARIANT (basetype
);
465 TREE_TYPE (t
) = rettype
;
466 ptype
= build_pointer_type (basetype
);
468 /* The actual arglist for this function includes a "hidden" argument
469 which is "this". Put it into the list of argument types. */
470 argtypes
= tree_cons (NULL_TREE
, ptype
, argtypes
);
471 TYPE_ARG_TYPES (t
) = argtypes
;
472 TREE_SIDE_EFFECTS (argtypes
) = 1; /* Mark first argtype as "artificial". */
474 /* If we already have such a type, use the old one and free this one.
475 Note that it also frees up the above cons cell if found. */
476 hashcode
= TYPE_HASH (basetype
) + TYPE_HASH (rettype
) +
477 type_hash_list (argtypes
);
479 t
= type_hash_canon (hashcode
, t
);
481 if (!COMPLETE_TYPE_P (t
))
488 build_cplus_array_type_1 (elt_type
, index_type
)
494 if (elt_type
== error_mark_node
|| index_type
== error_mark_node
)
495 return error_mark_node
;
497 if (processing_template_decl
498 || uses_template_parms (elt_type
)
499 || uses_template_parms (index_type
))
501 t
= make_node (ARRAY_TYPE
);
502 TREE_TYPE (t
) = elt_type
;
503 TYPE_DOMAIN (t
) = index_type
;
506 t
= build_array_type (elt_type
, index_type
);
508 /* Push these needs up so that initialization takes place
510 TYPE_NEEDS_CONSTRUCTING (t
)
511 = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type
));
512 TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t
)
513 = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type
));
518 build_cplus_array_type (elt_type
, index_type
)
523 int type_quals
= CP_TYPE_QUALS (elt_type
);
525 elt_type
= TYPE_MAIN_VARIANT (elt_type
);
527 t
= build_cplus_array_type_1 (elt_type
, index_type
);
529 if (type_quals
!= TYPE_UNQUALIFIED
)
530 t
= cp_build_qualified_type (t
, type_quals
);
535 /* Make a variant of TYPE, qualified with the TYPE_QUALS. Handles
536 arrays correctly. In particular, if TYPE is an array of T's, and
537 TYPE_QUALS is non-empty, returns an array of qualified T's. If
538 at attempt is made to qualify a type illegally, and COMPLAIN is
539 non-zero, an error is issued. If COMPLAIN is zero, error_mark_node
543 cp_build_qualified_type_real (type
, type_quals
, complain
)
550 if (type
== error_mark_node
)
553 if (type_quals
== TYPE_QUALS (type
))
556 /* A restrict-qualified pointer type must be a pointer (or reference)
557 to object or incomplete type. */
558 if ((type_quals
& TYPE_QUAL_RESTRICT
)
559 && TREE_CODE (type
) != TEMPLATE_TYPE_PARM
560 && (!POINTER_TYPE_P (type
)
561 || TYPE_PTRMEM_P (type
)
562 || TREE_CODE (TREE_TYPE (type
)) == FUNCTION_TYPE
))
565 cp_error ("`%T' cannot be `restrict'-qualified", type
);
567 return error_mark_node
;
569 type_quals
&= ~TYPE_QUAL_RESTRICT
;
572 if (type_quals
!= TYPE_UNQUALIFIED
573 && TREE_CODE (type
) == FUNCTION_TYPE
)
576 cp_error ("`%T' cannot be `const'-, `volatile'-, or `restrict'-qualified", type
);
578 return error_mark_node
;
579 type_quals
= TYPE_UNQUALIFIED
;
581 else if (TREE_CODE (type
) == ARRAY_TYPE
)
583 /* In C++, the qualification really applies to the array element
584 type. Obtain the appropriately qualified element type. */
587 = cp_build_qualified_type_real (TREE_TYPE (type
),
591 if (element_type
== error_mark_node
)
592 return error_mark_node
;
594 /* See if we already have an identically qualified type. */
595 for (t
= TYPE_MAIN_VARIANT (type
); t
; t
= TYPE_NEXT_VARIANT (t
))
596 if (CP_TYPE_QUALS (t
) == type_quals
)
599 /* If we didn't already have it, create it now. */
602 /* Make a new array type, just like the old one, but with the
603 appropriately qualified element type. */
604 t
= build_type_copy (type
);
605 TREE_TYPE (t
) = element_type
;
608 /* Even if we already had this variant, we update
609 TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case
610 they changed since the variant was originally created.
612 This seems hokey; if there is some way to use a previous
613 variant *without* coming through here,
614 TYPE_NEEDS_CONSTRUCTING will never be updated. */
615 TYPE_NEEDS_CONSTRUCTING (t
)
616 = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (element_type
));
617 TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t
)
618 = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (element_type
));
621 else if (TYPE_PTRMEMFUNC_P (type
))
623 /* For a pointer-to-member type, we can't just return a
624 cv-qualified version of the RECORD_TYPE. If we do, we
625 haven't change the field that contains the actual pointer to
626 a method, and so TYPE_PTRMEMFUNC_FN_TYPE will be wrong. */
629 t
= TYPE_PTRMEMFUNC_FN_TYPE (type
);
630 t
= cp_build_qualified_type_real (t
, type_quals
, complain
);
631 return build_ptrmemfunc_type (t
);
634 /* Retrieve (or create) the appropriately qualified variant. */
635 result
= build_qualified_type (type
, type_quals
);
637 /* If this was a pointer-to-method type, and we just made a copy,
638 then we need to clear the cached associated
639 pointer-to-member-function type; it is not valid for the new
642 && TREE_CODE (type
) == POINTER_TYPE
643 && TREE_CODE (TREE_TYPE (type
)) == METHOD_TYPE
)
644 TYPE_SET_PTRMEMFUNC_TYPE (result
, NULL_TREE
);
649 /* Returns the canonical version of TYPE. In other words, if TYPE is
650 a typedef, returns the underlying type. The cv-qualification of
651 the type returned matches the type input; they will always be
655 canonical_type_variant (t
)
658 return cp_build_qualified_type (TYPE_MAIN_VARIANT (t
), CP_TYPE_QUALS (t
));
661 /* Makes new binfos for the indirect bases under BINFO, and updates
662 BINFO_OFFSET for them and their bases. */
665 unshare_base_binfos (binfo
)
668 tree binfos
= BINFO_BASETYPES (binfo
);
672 if (binfos
== NULL_TREE
)
675 /* Now unshare the structure beneath BINFO. */
676 for (j
= TREE_VEC_LENGTH (binfos
)-1;
679 tree base_binfo
= TREE_VEC_ELT (binfos
, j
);
680 new_binfo
= TREE_VEC_ELT (binfos
, j
)
681 = make_binfo (BINFO_OFFSET (base_binfo
),
683 BINFO_VTABLE (base_binfo
),
684 BINFO_VIRTUALS (base_binfo
));
685 TREE_VIA_PUBLIC (new_binfo
) = TREE_VIA_PUBLIC (base_binfo
);
686 TREE_VIA_PROTECTED (new_binfo
) = TREE_VIA_PROTECTED (base_binfo
);
687 TREE_VIA_VIRTUAL (new_binfo
) = TREE_VIA_VIRTUAL (base_binfo
);
688 BINFO_INHERITANCE_CHAIN (new_binfo
) = binfo
;
689 BINFO_PRIMARY_BASE_OF (new_binfo
) = NULL_TREE
;
690 unshare_base_binfos (new_binfo
);
695 /* Hashing of lists so that we don't make duplicates.
696 The entry point is `list_hash_canon'. */
698 /* Each hash table slot is a bucket containing a chain
699 of these structures. */
703 struct list_hash
*next
; /* Next structure in the bucket. */
704 int hashcode
; /* Hash code of this list. */
705 tree list
; /* The list recorded here. */
708 /* Now here is the hash table. When recording a list, it is added
709 to the slot whose index is the hash code mod the table size.
710 Note that the hash table is used for several kinds of lists.
711 While all these live in the same table, they are completely independent,
712 and the hash code is computed differently for each of these. */
714 #define TYPE_HASH_SIZE 59
715 static struct list_hash
*list_hash_table
[TYPE_HASH_SIZE
];
717 /* Compute a hash code for a list (chain of TREE_LIST nodes
718 with goodies in the TREE_PURPOSE, TREE_VALUE, and bits of the
719 TREE_COMMON slots), by adding the hash codes of the individual entries. */
722 list_hash (purpose
, value
, chain
)
723 tree purpose
, value
, chain
;
725 register int hashcode
= 0;
728 hashcode
+= TYPE_HASH (chain
);
731 hashcode
+= TYPE_HASH (value
);
735 hashcode
+= TYPE_HASH (purpose
);
741 /* Look in the type hash table for a type isomorphic to TYPE.
742 If one is found, return it. Otherwise return 0. */
745 list_hash_lookup (hashcode
, purpose
, value
, chain
)
747 tree purpose
, value
, chain
;
749 register struct list_hash
*h
;
751 for (h
= list_hash_table
[hashcode
% TYPE_HASH_SIZE
]; h
; h
= h
->next
)
752 if (h
->hashcode
== hashcode
753 && TREE_PURPOSE (h
->list
) == purpose
754 && TREE_VALUE (h
->list
) == value
755 && TREE_CHAIN (h
->list
) == chain
)
760 /* Add an entry to the list-hash-table
761 for a list TYPE whose hash code is HASHCODE. */
764 list_hash_add (hashcode
, list
)
768 register struct list_hash
*h
;
770 h
= (struct list_hash
*) obstack_alloc (&permanent_obstack
, sizeof (struct list_hash
));
771 h
->hashcode
= hashcode
;
773 h
->next
= list_hash_table
[hashcode
% TYPE_HASH_SIZE
];
774 list_hash_table
[hashcode
% TYPE_HASH_SIZE
] = h
;
777 /* Given list components PURPOSE, VALUE, AND CHAIN, return the canonical
778 object for an identical list if one already exists. Otherwise, build a
779 new one, and record it as the canonical object. */
781 /* Set to 1 to debug without canonicalization. Never set by program. */
783 static int debug_no_list_hash
= 0;
786 hash_tree_cons (purpose
, value
, chain
)
787 tree purpose
, value
, chain
;
792 if (! debug_no_list_hash
)
794 hashcode
= list_hash (purpose
, value
, chain
);
795 t
= list_hash_lookup (hashcode
, purpose
, value
, chain
);
800 t
= tree_cons (purpose
, value
, chain
);
802 /* If this is a new list, record it for later reuse. */
803 if (! debug_no_list_hash
)
804 list_hash_add (hashcode
, t
);
809 /* Constructor for hashed lists. */
812 hash_tree_chain (value
, chain
)
815 return hash_tree_cons (NULL_TREE
, value
, chain
);
818 /* Similar, but used for concatenating two lists. */
821 hash_chainon (list1
, list2
)
828 if (TREE_CHAIN (list1
) == NULL_TREE
)
829 return hash_tree_chain (TREE_VALUE (list1
), list2
);
830 return hash_tree_chain (TREE_VALUE (list1
),
831 hash_chainon (TREE_CHAIN (list1
), list2
));
834 /* Build an association between TYPE and some parameters:
836 OFFSET is the offset added to `this' to convert it to a pointer
839 BINFO is the base binfo to use, if we are deriving from one. This
840 is necessary, as we want specialized parent binfos from base
841 classes, so that the VTABLE_NAMEs of bases are for the most derived
842 type, instead of the simple type.
844 VTABLE is the virtual function table with which to initialize
845 sub-objects of type TYPE.
847 VIRTUALS are the virtual functions sitting in VTABLE. */
850 make_binfo (offset
, binfo
, vtable
, virtuals
)
852 tree vtable
, virtuals
;
854 tree new_binfo
= make_tree_vec (11);
857 if (TREE_CODE (binfo
) == TREE_VEC
)
858 type
= BINFO_TYPE (binfo
);
862 binfo
= CLASS_TYPE_P (type
) ? TYPE_BINFO (binfo
) : NULL_TREE
;
865 TREE_TYPE (new_binfo
) = TYPE_MAIN_VARIANT (type
);
866 BINFO_OFFSET (new_binfo
) = offset
;
867 BINFO_VTABLE (new_binfo
) = vtable
;
868 BINFO_VIRTUALS (new_binfo
) = virtuals
;
870 if (binfo
&& BINFO_BASETYPES (binfo
) != NULL_TREE
)
871 BINFO_BASETYPES (new_binfo
) = copy_node (BINFO_BASETYPES (binfo
));
875 /* Return the binfo value for ELEM in TYPE. */
878 binfo_value (elem
, type
)
882 if (get_base_distance (elem
, type
, 0, (tree
*)0) == -2)
883 compiler_error ("base class `%s' ambiguous in binfo_value",
884 TYPE_NAME_STRING (elem
));
886 return TYPE_BINFO (type
);
887 if (TREE_CODE (elem
) == RECORD_TYPE
&& TYPE_BINFO (elem
) == type
)
889 return get_binfo (elem
, type
, 0);
892 /* Return a TREE_LIST whose TREE_VALUE nodes along the
893 BINFO_INHERITANCE_CHAIN for BINFO, but in the opposite order. In
894 other words, while the BINFO_INHERITANCE_CHAIN goes from base
895 classes to derived classes, the reversed path goes from derived
896 classes to base classes. */
904 reversed_path
= NULL_TREE
;
907 reversed_path
= tree_cons (NULL_TREE
, binfo
, reversed_path
);
908 binfo
= BINFO_INHERITANCE_CHAIN (binfo
);
911 return reversed_path
;
921 fprintf (stderr
, "type \"%s\", offset = ",
922 TYPE_NAME_STRING (BINFO_TYPE (elem
)));
923 fprintf (stderr
, HOST_WIDE_INT_PRINT_DEC
,
924 TREE_INT_CST_LOW (BINFO_OFFSET (elem
)));
925 fprintf (stderr
, "\nvtable type:\n");
926 debug_tree (BINFO_TYPE (elem
));
927 if (BINFO_VTABLE (elem
))
928 fprintf (stderr
, "vtable decl \"%s\"\n",
929 IDENTIFIER_POINTER (DECL_NAME (get_vtbl_decl_for_binfo (elem
))));
931 fprintf (stderr
, "no vtable decl yet\n");
932 fprintf (stderr
, "virtuals:\n");
933 virtuals
= BINFO_VIRTUALS (elem
);
934 n
= first_vfun_index (BINFO_TYPE (elem
));
938 tree fndecl
= TREE_VALUE (virtuals
);
939 fprintf (stderr
, "%s [%ld =? %ld]\n",
940 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl
)),
941 (long) n
, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl
)));
943 virtuals
= TREE_CHAIN (virtuals
);
952 if (TREE_CODE (t
) == FUNCTION_DECL
)
954 else if (TREE_CODE (t
) == OVERLOAD
)
956 for (i
=0; t
; t
= OVL_CHAIN (t
))
961 my_friendly_abort (359);
969 /* A baselink is also considered an overloaded function. */
970 if (TREE_CODE (x
) == OFFSET_REF
)
971 x
= TREE_OPERAND (x
, 1);
974 return (TREE_CODE (x
) == FUNCTION_DECL
975 || TREE_CODE (x
) == TEMPLATE_ID_EXPR
976 || DECL_FUNCTION_TEMPLATE_P (x
)
977 || TREE_CODE (x
) == OVERLOAD
);
981 really_overloaded_fn (x
)
984 /* A baselink is also considered an overloaded function. */
985 if (TREE_CODE (x
) == OFFSET_REF
)
986 x
= TREE_OPERAND (x
, 1);
989 return (TREE_CODE (x
) == OVERLOAD
990 && (TREE_CHAIN (x
) != NULL_TREE
991 || DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (x
))));
998 my_friendly_assert (is_overloaded_fn (from
), 9);
999 /* A baselink is also considered an overloaded function. */
1000 if (BASELINK_P (from
))
1001 from
= TREE_VALUE (from
);
1002 return OVL_CURRENT (from
);
1005 /* Returns nonzero if T is a ->* or .* expression that refers to a
1012 return (TREE_CODE (t
) == OFFSET_REF
1013 && TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (t
, 1))));
1016 /* Return a new OVL node, concatenating it with the old one. */
1019 ovl_cons (decl
, chain
)
1023 tree result
= make_node (OVERLOAD
);
1024 TREE_TYPE (result
) = unknown_type_node
;
1025 OVL_FUNCTION (result
) = decl
;
1026 TREE_CHAIN (result
) = chain
;
1031 /* Build a new overloaded function. If this is the first one,
1032 just return it; otherwise, ovl_cons the _DECLs */
1035 build_overload (decl
, chain
)
1039 if (! chain
&& TREE_CODE (decl
) != TEMPLATE_DECL
)
1041 if (chain
&& TREE_CODE (chain
) != OVERLOAD
)
1042 chain
= ovl_cons (chain
, NULL_TREE
);
1043 return ovl_cons (decl
, chain
);
1046 /* True if fn is in ovl. */
1049 ovl_member (fn
, ovl
)
1053 if (ovl
== NULL_TREE
)
1055 if (TREE_CODE (ovl
) != OVERLOAD
)
1057 for (; ovl
; ovl
= OVL_CHAIN (ovl
))
1058 if (OVL_FUNCTION (ovl
) == fn
)
1064 is_aggr_type_2 (t1
, t2
)
1067 if (TREE_CODE (t1
) != TREE_CODE (t2
))
1069 return IS_AGGR_TYPE (t1
) && IS_AGGR_TYPE (t2
);
1072 /* Returns non-zero if CODE is the code for a statement. */
1075 statement_code_p (code
)
1076 enum tree_code code
;
1096 case START_CATCH_STMT
:
1099 case CTOR_INITIALIZER
:
1111 #define PRINT_RING_SIZE 4
1114 lang_printable_name (decl
, v
)
1118 static tree decl_ring
[PRINT_RING_SIZE
];
1119 static char *print_ring
[PRINT_RING_SIZE
];
1120 static int ring_counter
;
1123 /* Only cache functions. */
1125 || TREE_CODE (decl
) != FUNCTION_DECL
1126 || DECL_LANG_SPECIFIC (decl
) == 0)
1127 return lang_decl_name (decl
, v
);
1129 /* See if this print name is lying around. */
1130 for (i
= 0; i
< PRINT_RING_SIZE
; i
++)
1131 if (decl_ring
[i
] == decl
)
1132 /* yes, so return it. */
1133 return print_ring
[i
];
1135 if (++ring_counter
== PRINT_RING_SIZE
)
1138 if (current_function_decl
!= NULL_TREE
)
1140 if (decl_ring
[ring_counter
] == current_function_decl
)
1142 if (ring_counter
== PRINT_RING_SIZE
)
1144 if (decl_ring
[ring_counter
] == current_function_decl
)
1145 my_friendly_abort (106);
1148 if (print_ring
[ring_counter
])
1149 free (print_ring
[ring_counter
]);
1151 print_ring
[ring_counter
] = xstrdup (lang_decl_name (decl
, v
));
1152 decl_ring
[ring_counter
] = decl
;
1153 return print_ring
[ring_counter
];
1156 /* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions
1157 listed in RAISES. */
1160 build_exception_variant (type
, raises
)
1164 tree v
= TYPE_MAIN_VARIANT (type
);
1165 int type_quals
= TYPE_QUALS (type
);
1167 for (; v
; v
= TYPE_NEXT_VARIANT (v
))
1168 if (TYPE_QUALS (v
) == type_quals
1169 && comp_except_specs (raises
, TYPE_RAISES_EXCEPTIONS (v
), 1))
1172 /* Need to build a new variant. */
1173 v
= build_type_copy (type
);
1174 TYPE_RAISES_EXCEPTIONS (v
) = raises
;
1178 /* Given a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM
1179 node T, create a new one together with its
1180 lang_specific field and its corresponding *_DECL node.
1181 If NEWARGS is not NULL_TREE, this parameter is bound with new set of
1185 copy_template_template_parm (t
, newargs
)
1189 tree decl
= TYPE_NAME (t
);
1192 if (newargs
== NULL_TREE
)
1194 t2
= make_aggr_type (TREE_CODE (t
));
1195 decl
= copy_decl (decl
);
1197 /* No need to copy these. */
1198 TEMPLATE_TYPE_PARM_INDEX (t2
) = TEMPLATE_TYPE_PARM_INDEX (t
);
1199 TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2
)
1200 = TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t
);
1204 t2
= make_aggr_type (BOUND_TEMPLATE_TEMPLATE_PARM
);
1205 decl
= build_decl (TYPE_DECL
, DECL_NAME (decl
), NULL_TREE
);
1207 /* These nodes have to be created to reflect new TYPE_DECL and template
1209 TEMPLATE_TYPE_PARM_INDEX (t2
) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t
));
1210 TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2
)) = decl
;
1211 TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2
)
1212 = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t
),
1213 newargs
, NULL_TREE
);
1216 TREE_TYPE (decl
) = t2
;
1217 TYPE_NAME (t2
) = decl
;
1218 TYPE_STUB_DECL (t2
) = decl
;
1223 /* Apply FUNC to all the sub-trees of TP in a pre-order traversal.
1224 FUNC is called with the DATA and the address of each sub-tree. If
1225 FUNC returns a non-NULL value, the traversal is aborted, and the
1226 value returned by FUNC is returned. The FLAGS govern the way in
1227 which nodes are walked. If HTAB is non-NULL it is used to record
1228 the nodes visited, and to avoid visiting a node more than once. */
1231 walk_tree (tp
, func
, data
, htab
)
1237 enum tree_code code
;
1241 #define WALK_SUBTREE(NODE) \
1244 result = walk_tree (&(NODE), func, data, htab); \
1250 /* Skip empty subtrees. */
1256 /* Don't walk the same tree twice, if the user has requested that we
1258 if (htab_find (htab
, *tp
))
1260 /* If we haven't already seen this node, add it to the table. */
1261 slot
= htab_find_slot (htab
, *tp
, INSERT
);
1265 /* Call the function. */
1267 result
= (*func
) (tp
, &walk_subtrees
, data
);
1269 /* If we found something, return it. */
1273 /* Even if we didn't, FUNC may have decided that there was nothing
1274 interesting below this point in the tree. */
1278 code
= TREE_CODE (*tp
);
1280 /* Handle common cases up front. */
1281 if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code
))
1282 || TREE_CODE_CLASS (code
) == 'r'
1283 || TREE_CODE_CLASS (code
) == 's')
1287 /* Set lineno here so we get the right instantiation context
1288 if we call instantiate_decl from inlinable_function_p. */
1289 if (statement_code_p (code
) && !STMT_LINENO_FOR_FN_P (*tp
))
1290 lineno
= STMT_LINENO (*tp
);
1292 /* Walk over all the sub-trees of this operand. */
1293 len
= first_rtl_op (code
);
1294 /* TARGET_EXPRs are peculiar: operands 1 and 3 can be the same.
1295 But, we only want to walk once. */
1296 if (code
== TARGET_EXPR
1297 && TREE_OPERAND (*tp
, 3) == TREE_OPERAND (*tp
, 1))
1299 /* Go through the subtrees. We need to do this in forward order so
1300 that the scope of a FOR_EXPR is handled properly. */
1301 for (i
= 0; i
< len
; ++i
)
1302 WALK_SUBTREE (TREE_OPERAND (*tp
, i
));
1304 /* For statements, we also walk the chain so that we cover the
1305 entire statement tree. */
1306 if (statement_code_p (code
))
1308 if (code
== DECL_STMT
1309 && DECL_STMT_DECL (*tp
)
1310 && DECL_P (DECL_STMT_DECL (*tp
)))
1312 /* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
1313 into declarations that are just mentioned, rather than
1314 declared; they don't really belong to this part of the tree.
1315 And, we can see cycles: the initializer for a declaration can
1316 refer to the declaration itself. */
1317 WALK_SUBTREE (DECL_INITIAL (DECL_STMT_DECL (*tp
)));
1318 WALK_SUBTREE (DECL_SIZE (DECL_STMT_DECL (*tp
)));
1319 WALK_SUBTREE (DECL_SIZE_UNIT (DECL_STMT_DECL (*tp
)));
1322 WALK_SUBTREE (TREE_CHAIN (*tp
));
1325 /* We didn't find what we were looking for. */
1328 else if (TREE_CODE_CLASS (code
) == 'd')
1330 WALK_SUBTREE (TREE_TYPE (*tp
));
1332 /* We didn't find what we were looking for. */
1336 /* Not one of the easy cases. We must explicitly go through the
1341 case IDENTIFIER_NODE
:
1346 case TEMPLATE_TEMPLATE_PARM
:
1347 case BOUND_TEMPLATE_TEMPLATE_PARM
:
1348 case TEMPLATE_PARM_INDEX
:
1349 case TEMPLATE_TYPE_PARM
:
1359 /* None of thse have subtrees other than those already walked
1364 WALK_SUBTREE (TREE_TYPE (*tp
));
1368 case REFERENCE_TYPE
:
1369 WALK_SUBTREE (TREE_TYPE (*tp
));
1373 WALK_SUBTREE (TREE_PURPOSE (*tp
));
1374 WALK_SUBTREE (TREE_VALUE (*tp
));
1375 WALK_SUBTREE (TREE_CHAIN (*tp
));
1379 WALK_SUBTREE (OVL_FUNCTION (*tp
));
1380 WALK_SUBTREE (OVL_CHAIN (*tp
));
1385 int len
= TREE_VEC_LENGTH (*tp
);
1387 WALK_SUBTREE (TREE_VEC_ELT (*tp
, len
));
1392 WALK_SUBTREE (TREE_REALPART (*tp
));
1393 WALK_SUBTREE (TREE_IMAGPART (*tp
));
1397 WALK_SUBTREE (CONSTRUCTOR_ELTS (*tp
));
1401 WALK_SUBTREE (TYPE_METHOD_BASETYPE (*tp
));
1405 WALK_SUBTREE (TREE_TYPE (*tp
));
1406 WALK_SUBTREE (TYPE_ARG_TYPES (*tp
));
1410 WALK_SUBTREE (TREE_TYPE (*tp
));
1411 WALK_SUBTREE (TYPE_DOMAIN (*tp
));
1415 WALK_SUBTREE (TYPE_MIN_VALUE (*tp
));
1416 WALK_SUBTREE (TYPE_MAX_VALUE (*tp
));
1420 WALK_SUBTREE (TREE_TYPE (*tp
));
1421 WALK_SUBTREE (TYPE_OFFSET_BASETYPE (*tp
));
1425 if (TYPE_PTRMEMFUNC_P (*tp
))
1426 WALK_SUBTREE (TYPE_PTRMEMFUNC_FN_TYPE (*tp
));
1430 my_friendly_abort (19990803);
1433 /* We didn't find what we were looking for. */
1439 /* Like walk_tree, but does not walk duplicate nodes more than
1443 walk_tree_without_duplicates (tp
, func
, data
)
1451 htab
= htab_create (37, htab_hash_pointer
, htab_eq_pointer
, NULL
);
1452 result
= walk_tree (tp
, func
, data
, htab
);
1457 /* Called from count_trees via walk_tree. */
1460 count_trees_r (tp
, walk_subtrees
, data
)
1461 tree
*tp ATTRIBUTE_UNUSED
;
1462 int *walk_subtrees ATTRIBUTE_UNUSED
;
1469 /* Debugging function for measuring the rough complexity of a tree
1477 walk_tree_without_duplicates (&t
, count_trees_r
, &n_trees
);
1481 /* Called from verify_stmt_tree via walk_tree. */
1484 verify_stmt_tree_r (tp
, walk_subtrees
, data
)
1486 int *walk_subtrees ATTRIBUTE_UNUSED
;
1490 htab_t
*statements
= (htab_t
*) data
;
1493 if (!statement_code_p (TREE_CODE (t
)))
1496 /* If this statement is already present in the hash table, then
1497 there is a circularity in the statement tree. */
1498 if (htab_find (*statements
, t
))
1499 my_friendly_abort (20000727);
1501 slot
= htab_find_slot (*statements
, t
, INSERT
);
1507 /* Debugging function to check that the statement T has not been
1508 corrupted. For now, this function simply checks that T contains no
1512 verify_stmt_tree (t
)
1516 statements
= htab_create (37, htab_hash_pointer
, htab_eq_pointer
, NULL
);
1517 walk_tree (&t
, verify_stmt_tree_r
, &statements
, NULL
);
1518 htab_delete (statements
);
1521 /* Called from find_tree via walk_tree. */
1524 find_tree_r (tp
, walk_subtrees
, data
)
1526 int *walk_subtrees ATTRIBUTE_UNUSED
;
1529 if (*tp
== (tree
) data
)
1535 /* Returns X if X appears in the tree structure rooted at T. */
1542 return walk_tree_without_duplicates (&t
, find_tree_r
, x
);
1545 /* Passed to walk_tree. Checks for the use of types with no linkage. */
1548 no_linkage_helper (tp
, walk_subtrees
, data
)
1550 int *walk_subtrees ATTRIBUTE_UNUSED
;
1551 void *data ATTRIBUTE_UNUSED
;
1556 && (IS_AGGR_TYPE (t
) || TREE_CODE (t
) == ENUMERAL_TYPE
)
1557 && (decl_function_context (TYPE_MAIN_DECL (t
))
1558 || ANON_AGGRNAME_P (TYPE_IDENTIFIER (t
))))
1563 /* Check if the type T depends on a type with no linkage and if so, return
1567 no_linkage_check (t
)
1570 /* There's no point in checking linkage on template functions; we
1571 can't know their complete types. */
1572 if (processing_template_decl
)
1575 t
= walk_tree_without_duplicates (&t
, no_linkage_helper
, NULL
);
1576 if (t
!= error_mark_node
)
1581 /* Passed to walk_tree. Copies the node pointed to, if appropriate. */
1584 copy_tree_r (tp
, walk_subtrees
, data
)
1587 void *data ATTRIBUTE_UNUSED
;
1589 enum tree_code code
= TREE_CODE (*tp
);
1591 /* We make copies of most nodes. */
1592 if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code
))
1593 || TREE_CODE_CLASS (code
) == 'r'
1594 || TREE_CODE_CLASS (code
) == 'c'
1595 || TREE_CODE_CLASS (code
) == 's'
1596 || code
== TREE_LIST
1598 || code
== OVERLOAD
)
1600 /* Because the chain gets clobbered when we make a copy, we save it
1602 tree chain
= TREE_CHAIN (*tp
);
1604 /* Copy the node. */
1605 *tp
= copy_node (*tp
);
1607 /* Now, restore the chain, if appropriate. That will cause
1608 walk_tree to walk into the chain as well. */
1609 if (code
== PARM_DECL
|| code
== TREE_LIST
|| code
== OVERLOAD
1610 || statement_code_p (code
))
1611 TREE_CHAIN (*tp
) = chain
;
1613 /* For now, we don't update BLOCKs when we make copies. So, we
1614 have to nullify all scope-statements. */
1615 if (TREE_CODE (*tp
) == SCOPE_STMT
)
1616 SCOPE_STMT_BLOCK (*tp
) = NULL_TREE
;
1618 else if (code
== TEMPLATE_TEMPLATE_PARM
1619 || code
== BOUND_TEMPLATE_TEMPLATE_PARM
)
1620 /* These must be copied specially. */
1621 *tp
= copy_template_template_parm (*tp
, NULL_TREE
);
1622 else if (TREE_CODE_CLASS (code
) == 't')
1623 /* There's no need to copy types, or anything beneath them. */
1629 #ifdef GATHER_STATISTICS
1630 extern int depth_reached
;
1634 print_lang_statistics ()
1636 print_search_statistics ();
1637 print_class_statistics ();
1638 #ifdef GATHER_STATISTICS
1639 fprintf (stderr
, "maximum template instantiation depth reached: %d\n",
1644 /* Return, as an INTEGER_CST node, the number of elements for TYPE
1645 (which is an ARRAY_TYPE). This counts only elements of the top
1649 array_type_nelts_top (type
)
1652 return fold (build (PLUS_EXPR
, sizetype
,
1653 array_type_nelts (type
),
1657 /* Return, as an INTEGER_CST node, the number of elements for TYPE
1658 (which is an ARRAY_TYPE). This one is a recursive count of all
1659 ARRAY_TYPEs that are clumped together. */
1662 array_type_nelts_total (type
)
1665 tree sz
= array_type_nelts_top (type
);
1666 type
= TREE_TYPE (type
);
1667 while (TREE_CODE (type
) == ARRAY_TYPE
)
1669 tree n
= array_type_nelts_top (type
);
1670 sz
= fold (build (MULT_EXPR
, sizetype
, sz
, n
));
1671 type
= TREE_TYPE (type
);
1676 /* Called from break_out_target_exprs via mapcar. */
1679 bot_manip (tp
, walk_subtrees
, data
)
1684 splay_tree target_remap
= ((splay_tree
) data
);
1687 if (TREE_CONSTANT (t
))
1689 /* There can't be any TARGET_EXPRs or their slot variables below
1690 this point. We used to check !TREE_SIDE_EFFECTS, but then we
1691 failed to copy an ADDR_EXPR of the slot VAR_DECL. */
1695 if (TREE_CODE (t
) == TARGET_EXPR
)
1699 if (TREE_CODE (TREE_OPERAND (t
, 1)) == AGGR_INIT_EXPR
)
1701 mark_used (TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (t
, 1), 0), 0));
1703 (TREE_TYPE (t
), break_out_target_exprs (TREE_OPERAND (t
, 1)));
1707 u
= build_target_expr_with_type
1708 (break_out_target_exprs (TREE_OPERAND (t
, 1)), TREE_TYPE (t
));
1711 /* Map the old variable to the new one. */
1712 splay_tree_insert (target_remap
,
1713 (splay_tree_key
) TREE_OPERAND (t
, 0),
1714 (splay_tree_value
) TREE_OPERAND (u
, 0));
1716 /* Replace the old expression with the new version. */
1718 /* We don't have to go below this point; the recursive call to
1719 break_out_target_exprs will have handled anything below this
1724 else if (TREE_CODE (t
) == CALL_EXPR
)
1725 mark_used (TREE_OPERAND (TREE_OPERAND (t
, 0), 0));
1727 /* Make a copy of this node. */
1728 return copy_tree_r (tp
, walk_subtrees
, NULL
);
1731 /* Replace all remapped VAR_DECLs in T with their new equivalents.
1732 DATA is really a splay-tree mapping old variables to new
1736 bot_replace (t
, walk_subtrees
, data
)
1738 int *walk_subtrees ATTRIBUTE_UNUSED
;
1741 splay_tree target_remap
= ((splay_tree
) data
);
1743 if (TREE_CODE (*t
) == VAR_DECL
)
1745 splay_tree_node n
= splay_tree_lookup (target_remap
,
1746 (splay_tree_key
) *t
);
1748 *t
= (tree
) n
->value
;
1754 /* When we parse a default argument expression, we may create
1755 temporary variables via TARGET_EXPRs. When we actually use the
1756 default-argument expression, we make a copy of the expression, but
1757 we must replace the temporaries with appropriate local versions. */
1760 break_out_target_exprs (t
)
1763 static int target_remap_count
;
1764 static splay_tree target_remap
;
1766 if (!target_remap_count
++)
1767 target_remap
= splay_tree_new (splay_tree_compare_pointers
,
1768 /*splay_tree_delete_key_fn=*/NULL
,
1769 /*splay_tree_delete_value_fn=*/NULL
);
1770 walk_tree (&t
, bot_manip
, target_remap
, NULL
);
1771 walk_tree (&t
, bot_replace
, target_remap
, NULL
);
1773 if (!--target_remap_count
)
1775 splay_tree_delete (target_remap
);
1776 target_remap
= NULL
;
1782 /* Obstack used for allocating nodes in template function and variable
1785 /* Similar to `build_nt', except that we set TREE_COMPLEXITY to be the
1786 current line number. */
1789 build_min_nt
VPARAMS ((enum tree_code code
, ...))
1791 #ifndef ANSI_PROTOTYPES
1792 enum tree_code code
;
1796 register int length
;
1801 #ifndef ANSI_PROTOTYPES
1802 code
= va_arg (p
, enum tree_code
);
1805 t
= make_node (code
);
1806 length
= TREE_CODE_LENGTH (code
);
1807 TREE_COMPLEXITY (t
) = lineno
;
1809 for (i
= 0; i
< length
; i
++)
1811 tree x
= va_arg (p
, tree
);
1812 TREE_OPERAND (t
, i
) = x
;
1819 /* Similar to `build', except we set TREE_COMPLEXITY to the current
1823 build_min
VPARAMS ((enum tree_code code
, tree tt
, ...))
1825 #ifndef ANSI_PROTOTYPES
1826 enum tree_code code
;
1831 register int length
;
1836 #ifndef ANSI_PROTOTYPES
1837 code
= va_arg (p
, enum tree_code
);
1838 tt
= va_arg (p
, tree
);
1841 t
= make_node (code
);
1842 length
= TREE_CODE_LENGTH (code
);
1844 TREE_COMPLEXITY (t
) = lineno
;
1846 for (i
= 0; i
< length
; i
++)
1848 tree x
= va_arg (p
, tree
);
1849 TREE_OPERAND (t
, i
) = x
;
1856 /* Returns an INTEGER_CST (of type `int') corresponding to I.
1857 Multiple calls with the same value of I may or may not yield the
1858 same node; therefore, callers should never modify the node
1862 build_shared_int_cst (i
)
1865 static tree cache
[256];
1868 return build_int_2 (i
, 0);
1871 cache
[i
] = build_int_2 (i
, 0);
1880 if (TREE_CODE (t
) == TYPE_DECL
)
1883 return TYPE_STUB_DECL (t
);
1884 if (t
== error_mark_node
)
1887 my_friendly_abort (42);
1889 /* Stop compiler from complaining control reaches end of non-void function. */
1894 can_free (obstack
, t
)
1895 struct obstack
*obstack
;
1900 if (TREE_CODE (t
) == TREE_VEC
)
1901 size
= (TREE_VEC_LENGTH (t
)-1) * sizeof (tree
) + sizeof (struct tree_vec
);
1903 my_friendly_abort (42);
1905 #define ROUND(x) ((x + obstack_alignment_mask (obstack)) \
1906 & ~ obstack_alignment_mask (obstack))
1907 if ((char *)t
+ ROUND (size
) == obstack_next_free (obstack
))
1914 /* Return first vector element whose BINFO_TYPE is ELEM.
1915 Return 0 if ELEM is not in VEC. VEC may be NULL_TREE. */
1918 vec_binfo_member (elem
, vec
)
1924 for (i
= 0; i
< TREE_VEC_LENGTH (vec
); ++i
)
1925 if (same_type_p (elem
, BINFO_TYPE (TREE_VEC_ELT (vec
, i
))))
1926 return TREE_VEC_ELT (vec
, i
);
1931 /* Returns the namespace that contains DECL, whether directly or
1935 decl_namespace_context (decl
)
1940 if (TREE_CODE (decl
) == NAMESPACE_DECL
)
1942 else if (TYPE_P (decl
))
1943 decl
= CP_DECL_CONTEXT (TYPE_MAIN_DECL (decl
));
1945 decl
= CP_DECL_CONTEXT (decl
);
1949 /* Return truthvalue of whether T1 is the same tree structure as T2.
1950 Return 1 if they are the same.
1951 Return 0 if they are understandably different.
1952 Return -1 if either contains tree structure not understood by
1956 cp_tree_equal (t1
, t2
)
1959 register enum tree_code code1
, code2
;
1964 if (t1
== 0 || t2
== 0)
1967 code1
= TREE_CODE (t1
);
1968 code2
= TREE_CODE (t2
);
1970 if (code1
== NOP_EXPR
|| code1
== CONVERT_EXPR
|| code1
== NON_LVALUE_EXPR
)
1972 if (code2
== NOP_EXPR
|| code2
== CONVERT_EXPR
|| code2
== NON_LVALUE_EXPR
)
1973 return cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
1975 return cp_tree_equal (TREE_OPERAND (t1
, 0), t2
);
1977 else if (code2
== NOP_EXPR
|| code2
== CONVERT_EXPR
1978 || code2
== NON_LVALUE_EXPR
)
1979 return cp_tree_equal (t1
, TREE_OPERAND (t2
, 0));
1987 return TREE_INT_CST_LOW (t1
) == TREE_INT_CST_LOW (t2
)
1988 && TREE_INT_CST_HIGH (t1
) == TREE_INT_CST_HIGH (t2
);
1991 return REAL_VALUES_EQUAL (TREE_REAL_CST (t1
), TREE_REAL_CST (t2
));
1994 return TREE_STRING_LENGTH (t1
) == TREE_STRING_LENGTH (t2
)
1995 && !bcmp (TREE_STRING_POINTER (t1
), TREE_STRING_POINTER (t2
),
1996 TREE_STRING_LENGTH (t1
));
1999 /* We need to do this when determining whether or not two
2000 non-type pointer to member function template arguments
2002 if (!(same_type_p (TREE_TYPE (t1
), TREE_TYPE (t2
))
2003 /* The first operand is RTL. */
2004 && TREE_OPERAND (t1
, 0) == TREE_OPERAND (t2
, 0)))
2006 return cp_tree_equal (TREE_OPERAND (t1
, 1), TREE_OPERAND (t2
, 1));
2009 cmp
= cp_tree_equal (TREE_PURPOSE (t1
), TREE_PURPOSE (t2
));
2012 cmp
= cp_tree_equal (TREE_VALUE (t1
), TREE_VALUE (t2
));
2015 return cp_tree_equal (TREE_CHAIN (t1
), TREE_CHAIN (t2
));
2018 return cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2021 cmp
= cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2024 return simple_cst_list_equal (TREE_OPERAND (t1
, 1), TREE_OPERAND (t2
, 1));
2027 /* Special case: if either target is an unallocated VAR_DECL,
2028 it means that it's going to be unified with whatever the
2029 TARGET_EXPR is really supposed to initialize, so treat it
2030 as being equivalent to anything. */
2031 if ((TREE_CODE (TREE_OPERAND (t1
, 0)) == VAR_DECL
2032 && DECL_NAME (TREE_OPERAND (t1
, 0)) == NULL_TREE
2033 && DECL_RTL (TREE_OPERAND (t1
, 0)) == 0)
2034 || (TREE_CODE (TREE_OPERAND (t2
, 0)) == VAR_DECL
2035 && DECL_NAME (TREE_OPERAND (t2
, 0)) == NULL_TREE
2036 && DECL_RTL (TREE_OPERAND (t2
, 0)) == 0))
2039 cmp
= cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2042 return cp_tree_equal (TREE_OPERAND (t1
, 1), TREE_OPERAND (t2
, 1));
2044 case WITH_CLEANUP_EXPR
:
2045 cmp
= cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2048 return cp_tree_equal (TREE_OPERAND (t1
, 2), TREE_OPERAND (t1
, 2));
2051 if (TREE_OPERAND (t1
, 1) == TREE_OPERAND (t2
, 1))
2052 return cp_tree_equal (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2061 case TEMPLATE_PARM_INDEX
:
2062 return TEMPLATE_PARM_IDX (t1
) == TEMPLATE_PARM_IDX (t2
)
2063 && TEMPLATE_PARM_LEVEL (t1
) == TEMPLATE_PARM_LEVEL (t2
);
2067 if (TREE_CODE (TREE_OPERAND (t1
, 0)) != TREE_CODE (TREE_OPERAND (t2
, 0)))
2069 if (TYPE_P (TREE_OPERAND (t1
, 0)))
2070 return same_type_p (TREE_OPERAND (t1
, 0), TREE_OPERAND (t2
, 0));
2074 /* Two pointer-to-members are the same if they point to the same
2075 field or function in the same class. */
2076 return (PTRMEM_CST_MEMBER (t1
) == PTRMEM_CST_MEMBER (t2
)
2077 && same_type_p (PTRMEM_CST_CLASS (t1
), PTRMEM_CST_CLASS (t2
)));
2083 switch (TREE_CODE_CLASS (code1
))
2093 for (i
= 0; i
< TREE_CODE_LENGTH (code1
); ++i
)
2095 cmp
= cp_tree_equal (TREE_OPERAND (t1
, i
), TREE_OPERAND (t2
, i
));
2105 /* Build a wrapper around some pointer PTR so we can use it as a tree. */
2108 build_ptr_wrapper (ptr
)
2111 tree t
= make_node (WRAPPER
);
2112 WRAPPER_PTR (t
) = ptr
;
2116 /* Same, but on the expression_obstack. */
2119 build_expr_ptr_wrapper (ptr
)
2122 return build_ptr_wrapper (ptr
);
2125 /* Build a wrapper around some integer I so we can use it as a tree. */
2128 build_int_wrapper (i
)
2131 tree t
= make_node (WRAPPER
);
2132 WRAPPER_INT (t
) = i
;
2137 build_srcloc (file
, line
)
2143 t
= make_node (SRCLOC
);
2144 SRCLOC_FILE (t
) = file
;
2145 SRCLOC_LINE (t
) = line
;
2151 build_srcloc_here ()
2153 return build_srcloc (input_filename
, lineno
);
2156 /* The type of ARG when used as an lvalue. */
2162 tree type
= TREE_TYPE (arg
);
2163 if (TREE_CODE (arg
) == OVERLOAD
)
2164 type
= unknown_type_node
;
2168 /* The type of ARG for printing error messages; denote lvalues with
2175 tree type
= TREE_TYPE (arg
);
2176 if (TREE_CODE (type
) == ARRAY_TYPE
)
2178 else if (real_lvalue_p (arg
))
2179 type
= build_reference_type (lvalue_type (arg
));
2180 else if (IS_AGGR_TYPE (type
))
2181 type
= lvalue_type (arg
);
2186 /* Does FUNCTION use a variable-length argument list? */
2189 varargs_function_p (function
)
2192 tree parm
= TYPE_ARG_TYPES (TREE_TYPE (function
));
2193 for (; parm
; parm
= TREE_CHAIN (parm
))
2194 if (TREE_VALUE (parm
) == void_type_node
)
2199 /* Returns 1 if decl is a member of a class. */
2205 const tree ctx
= DECL_CONTEXT (decl
);
2206 return (ctx
&& TYPE_P (ctx
));
2209 /* Create a placeholder for member access where we don't actually have an
2210 object that the access is against. */
2213 build_dummy_object (type
)
2216 tree decl
= build1 (NOP_EXPR
, build_pointer_type (type
), void_zero_node
);
2217 return build_indirect_ref (decl
, NULL_PTR
);
2220 /* We've gotten a reference to a member of TYPE. Return *this if appropriate,
2221 or a dummy object otherwise. If BINFOP is non-0, it is filled with the
2222 binfo path from current_class_type to TYPE, or 0. */
2225 maybe_dummy_object (type
, binfop
)
2231 if (current_class_type
2232 && get_base_distance (type
, current_class_type
, 0, binfop
) != -1)
2233 context
= current_class_type
;
2236 /* Reference from a nested class member function. */
2239 *binfop
= TYPE_BINFO (type
);
2242 if (current_class_ref
&& context
== current_class_type
)
2243 decl
= current_class_ref
;
2245 decl
= build_dummy_object (context
);
2250 /* Returns 1 if OB is a placeholder object, or a pointer to one. */
2253 is_dummy_object (ob
)
2256 if (TREE_CODE (ob
) == INDIRECT_REF
)
2257 ob
= TREE_OPERAND (ob
, 0);
2258 return (TREE_CODE (ob
) == NOP_EXPR
2259 && TREE_OPERAND (ob
, 0) == void_zero_node
);
2262 /* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
2268 while (TREE_CODE (t
) == ARRAY_TYPE
)
2271 if (INTEGRAL_TYPE_P (t
))
2272 return 1; /* integral, character or enumeral type */
2273 if (FLOAT_TYPE_P (t
))
2276 return 1; /* pointer to non-member */
2277 if (TYPE_PTRMEM_P (t
))
2278 return 1; /* pointer to member object */
2279 if (TYPE_PTRMEMFUNC_P (t
))
2280 return 1; /* pointer to member function */
2282 if (! CLASS_TYPE_P (t
))
2283 return 0; /* other non-class type (reference or function) */
2284 if (CLASSTYPE_NON_POD_P (t
))
2289 /* Return a 1 if ATTR_NAME and ATTR_ARGS denote a valid C++-specific
2290 attribute for either declaration DECL or type TYPE and 0 otherwise.
2291 Plugged into valid_lang_attribute. */
2294 cp_valid_lang_attribute (attr_name
, attr_args
, decl
, type
)
2296 tree attr_args ATTRIBUTE_UNUSED
;
2297 tree decl ATTRIBUTE_UNUSED
;
2298 tree type ATTRIBUTE_UNUSED
;
2300 if (is_attribute_p ("com_interface", attr_name
))
2302 if (! flag_vtable_thunks
)
2304 error ("`com_interface' only supported with -fvtable-thunks");
2308 if (attr_args
!= NULL_TREE
2309 || decl
!= NULL_TREE
2310 || ! CLASS_TYPE_P (type
)
2311 || type
!= TYPE_MAIN_VARIANT (type
))
2313 warning ("`com_interface' attribute can only be applied to class definitions");
2317 CLASSTYPE_COM_INTERFACE (type
) = 1;
2320 else if (is_attribute_p ("init_priority", attr_name
))
2322 tree initp_expr
= (attr_args
? TREE_VALUE (attr_args
): NULL_TREE
);
2326 STRIP_NOPS (initp_expr
);
2328 if (!initp_expr
|| TREE_CODE (initp_expr
) != INTEGER_CST
)
2330 error ("requested init_priority is not an integer constant");
2334 pri
= TREE_INT_CST_LOW (initp_expr
);
2336 while (TREE_CODE (type
) == ARRAY_TYPE
)
2337 type
= TREE_TYPE (type
);
2339 if (decl
== NULL_TREE
2340 || TREE_CODE (decl
) != VAR_DECL
2341 || ! TREE_STATIC (decl
)
2342 || DECL_EXTERNAL (decl
)
2343 || (TREE_CODE (type
) != RECORD_TYPE
2344 && TREE_CODE (type
) != UNION_TYPE
)
2345 /* Static objects in functions are initialized the
2346 first time control passes through that
2347 function. This is not precise enough to pin down an
2348 init_priority value, so don't allow it. */
2349 || current_function_decl
)
2351 error ("can only use init_priority attribute on file-scope definitions of objects of class type");
2355 if (pri
> MAX_INIT_PRIORITY
|| pri
<= 0)
2357 error ("requested init_priority is out of range");
2361 /* Check for init_priorities that are reserved for
2362 language and runtime support implementations.*/
2363 if (pri
<= MAX_RESERVED_INIT_PRIORITY
)
2366 ("requested init_priority is reserved for internal use");
2369 DECL_INIT_PRIORITY (decl
) = pri
;
2376 /* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the
2377 thing pointed to by the constant. */
2380 make_ptrmem_cst (type
, member
)
2384 tree ptrmem_cst
= make_node (PTRMEM_CST
);
2385 /* If would seem a great convenience if make_node would set
2386 TREE_CONSTANT for things of class `c', but it does not. */
2387 TREE_CONSTANT (ptrmem_cst
) = 1;
2388 TREE_TYPE (ptrmem_cst
) = type
;
2389 PTRMEM_CST_MEMBER (ptrmem_cst
) = member
;
2393 /* Mark ARG (which is really a list_hash_table **) for GC. */
2396 mark_list_hash (arg
)
2399 struct list_hash
*lh
;
2401 for (lh
= * ((struct list_hash
**) arg
); lh
; lh
= lh
->next
)
2402 ggc_mark_tree (lh
->list
);
2405 /* Initialize tree.c. */
2410 make_lang_type_fn
= cp_make_lang_type
;
2411 lang_unsave
= cp_unsave
;
2412 ggc_add_root (list_hash_table
,
2413 ARRAY_SIZE (list_hash_table
),
2414 sizeof (struct list_hash
*),
2418 /* The SAVE_EXPR pointed to by TP is being copied. If ST contains
2419 information indicating to what new SAVE_EXPR this one should be
2420 mapped, use that one. Otherwise, create a new node and enter it in
2421 ST. FN is the function into which the copy will be placed. */
2424 remap_save_expr (tp
, st
, fn
, walk_subtrees
)
2432 /* See if we already encountered this SAVE_EXPR. */
2433 n
= splay_tree_lookup (st
, (splay_tree_key
) *tp
);
2435 /* If we didn't already remap this SAVE_EXPR, do so now. */
2438 tree t
= copy_node (*tp
);
2440 /* The SAVE_EXPR is now part of the function into which we
2441 are inlining this body. */
2442 SAVE_EXPR_CONTEXT (t
) = fn
;
2443 /* And we haven't evaluated it yet. */
2444 SAVE_EXPR_RTL (t
) = NULL_RTX
;
2445 /* Remember this SAVE_EXPR. */
2446 n
= splay_tree_insert (st
,
2447 (splay_tree_key
) *tp
,
2448 (splay_tree_value
) t
);
2451 /* We've already walked into this SAVE_EXPR, so we needn't do it
2455 /* Replace this SAVE_EXPR with the copy. */
2456 *tp
= (tree
) n
->value
;
2459 /* Called via walk_tree. If *TP points to a DECL_STMT for a local
2460 declaration, copies the declaration and enters it in the splay_tree
2461 pointed to by DATA (which is really a `splay_tree *'). */
2464 mark_local_for_remap_r (tp
, walk_subtrees
, data
)
2466 int *walk_subtrees ATTRIBUTE_UNUSED
;
2470 splay_tree st
= (splay_tree
) data
;
2474 if (TREE_CODE (t
) == DECL_STMT
2475 && nonstatic_local_decl_p (DECL_STMT_DECL (t
)))
2476 decl
= DECL_STMT_DECL (t
);
2477 else if (TREE_CODE (t
) == LABEL_STMT
)
2478 decl
= LABEL_STMT_LABEL (t
);
2479 else if (TREE_CODE (t
) == TARGET_EXPR
2480 && nonstatic_local_decl_p (TREE_OPERAND (t
, 0)))
2481 decl
= TREE_OPERAND (t
, 0);
2490 copy
= copy_decl_for_inlining (decl
,
2491 DECL_CONTEXT (decl
),
2492 DECL_CONTEXT (decl
));
2494 /* Remember the copy. */
2495 splay_tree_insert (st
,
2496 (splay_tree_key
) decl
,
2497 (splay_tree_value
) copy
);
2503 /* Called via walk_tree when an expression is unsaved. Using the
2504 splay_tree pointed to by ST (which is really a `splay_tree'),
2505 remaps all local declarations to appropriate replacements. */
2508 cp_unsave_r (tp
, walk_subtrees
, data
)
2513 splay_tree st
= (splay_tree
) data
;
2516 /* Only a local declaration (variable or label). */
2517 if (nonstatic_local_decl_p (*tp
))
2519 /* Lookup the declaration. */
2520 n
= splay_tree_lookup (st
, (splay_tree_key
) *tp
);
2522 /* If it's there, remap it. */
2524 *tp
= (tree
) n
->value
;
2526 else if (TREE_CODE (*tp
) == SAVE_EXPR
)
2527 remap_save_expr (tp
, st
, current_function_decl
, walk_subtrees
);
2530 copy_tree_r (tp
, walk_subtrees
, NULL
);
2532 /* Do whatever unsaving is required. */
2533 unsave_expr_1 (*tp
);
2536 /* Keep iterating. */
2540 /* Called by unsave_expr_now whenever an expression (*TP) needs to be
2549 /* Create a splay-tree to map old local variable declarations to new
2551 st
= splay_tree_new (splay_tree_compare_pointers
, NULL
, NULL
);
2553 /* Walk the tree once figuring out what needs to be remapped. */
2554 walk_tree (tp
, mark_local_for_remap_r
, st
, NULL
);
2556 /* Walk the tree again, copying, remapping, and unsaving. */
2557 walk_tree (tp
, cp_unsave_r
, st
, NULL
);
2560 splay_tree_delete (st
);
2563 /* Returns the kind of special function that DECL (a FUNCTION_DECL)
2564 is. Note that this sfk_none is zero, so this function can be used
2565 as a predicate to test whether or not DECL is a special function. */
2567 special_function_kind
2568 special_function_p (decl
)
2571 /* Rather than doing all this stuff with magic names, we should
2572 probably have a field of type `special_function_kind' in
2573 DECL_LANG_SPECIFIC. */
2574 if (DECL_COPY_CONSTRUCTOR_P (decl
))
2575 return sfk_copy_constructor
;
2576 if (DECL_CONSTRUCTOR_P (decl
))
2577 return sfk_constructor
;
2578 if (DECL_OVERLOADED_OPERATOR_P (decl
) == NOP_EXPR
)
2579 return sfk_assignment_operator
;
2580 if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl
))
2581 return sfk_destructor
;
2582 if (DECL_COMPLETE_DESTRUCTOR_P (decl
))
2583 return sfk_complete_destructor
;
2584 if (DECL_BASE_DESTRUCTOR_P (decl
))
2585 return sfk_base_destructor
;
2586 if (DECL_DELETING_DESTRUCTOR_P (decl
))
2587 return sfk_deleting_destructor
;
2588 if (DECL_CONV_FN_P (decl
))
2589 return sfk_conversion
;
2594 /* Returns non-zero if TYPE is a character type, including wchar_t. */
2600 return (same_type_p (type
, char_type_node
)
2601 || same_type_p (type
, unsigned_char_type_node
)
2602 || same_type_p (type
, signed_char_type_node
)
2603 || same_type_p (type
, wchar_type_node
));