Makefile.in (TREE_H): Add treestruct.def.
2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Makefile.in (TREE_H): Add treestruct.def. (c-decl.o): Add pointer-set.h * c-decl.c (diagnose_mismatched_decls): Don't attempt to look at visibility on regular DECL's. (merge_decls): Fix the copying of decl nodes of various types for the new structures. Don't update RTL, section name, weak status, etc, on DECL's without RTL. (grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone. Don't check volatile on non-variable types. (store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK to check whether we have seen arguments. * c-objc-common.c (c_tree_printer): Reverse order of tests so that flag is checked before field (flag is common, field is not). * dwarf2out.c (decl_ultimate_origin): Only DECL's with TS_DECL_COMMON could have an origin. (add_location_or_const_value_attribute): Don't check section name on non-var/function decls. (dwarf2out_var_location): Reverse order of tests. * emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace with DECL_WRTL_CHECK. * expmed.c (make_tree): rtl is now in decl_with_rtl. * fold-const.c (fold_binary): Don't check weakness on non-var/function decls. (tree_expr_nonzero_p): Ditto. (fold_checksum_tree): Use tree_decl_extra as sizeof buffer. * ggc-page.c (extra_order_size_table): Add sizes for tree_decl_non_common, tree_parm_decl, tree_var_decl, and tree_field_decl. * gimplify.c (gimplify_bind_expr): Only set DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL. * integrate.c (copy_decl_for_inlining): Don't set RTL on decl's without RTL. * langhooks-def.h (LANG_HOOK_INIT_TS): New. * langhooks.h (init_ts). New langhook. * passes.c (rest_of_decl_compilation): Reverse order of tests. * print-tree.c (print_node): Update to only print fields that exist in the structures the passed decl has. * toplev.c (wrapup_global_declarations): Don't reset DECL_DEFER_OUTPUT on DECL's that don't contain it. * tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed. * tree-inline.c (remap_decl): Ditto. * tree-outof-ssa.c (create_temp): Reverse order of tests. * tree-pretty-print.c (print_declaration): Don't print DECL_REGISTER on things that don't contain it. * tree-vrp.c (expr_computes_nonzero): Don't check weakness on non-var/function decls. * tree.c (tree_contains_struct): New structure. (init_priority_for_decl): New hashtable. (tree_int_map): New structure. (tree_int_map_eq): New function. (tree_int_map_marked_p): Ditto. (tree_int_map_hash): Ditto. (tree_map): Move to tree.h. (tree_map_eq): Externalize. (tree_map_hash): Ditto. (tree_map_marked_p): Ditto. (init_ttree): Set up tree_contains_struct and call langhook. (decl_assembler_name): Use DECL_NON_COMMON_CHECK.. (tree_code_size): Update for new structures. (tree_node_structure): Update for new structures. (make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls without the field. (copy_node_stat): Copy init priority. (build_decl_stat): Ditto for visibility. (ts_enum_names): New. (tree_contains_struct_check_failed): New function. (decl_init_priority_lookup): Ditto. (decl_init_priority_insert): Ditto. * treestruct.def: New file. * tree.h (CODE_CONTAINS_STRUCT): New macro. (CONTAINS_STRUCT_CHECK): Ditto. (tree_contains_struct_check_failed): New prototype. (DECL_CHECK): Removed. (DECL_MINIMAL_CHECK): New. (DECL_COMMON_CHECK): Ditto. (DECL_WRTL_CHECK): Ditto. (DECL_NON_COMMON_CHECK): Ditto. (DECL_WITH_VIS_CHECK): Ditto. (VAR_OR_FUNCTION_DECL_P): Ditto (struct tree_decl_minimal): New structure. (struct tree_decl_common): Ditto. (struct tree_decl_with_rtl): Ditto. (struct tree_decl_with_vis): Ditto. (struct tree_decl_non_common): Ditto. (struct tree_field_decl): Ditto. (struct tree_parm_decl): Ditto. (struct tree_var_decl): Ditto. (struct tree_function_decl): Ditto. (struct tree_const_decl): Ditto. (struct tree_result_decl): Ditto. (union tree_node): Add new structures. * var-tracking.c (track_expr_p): Reverse order of tests. * doc/c-tree.texi: Add documentation on DECL node internal structure. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is removed. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * Make-lang.in: Add gt-cp-lang.h. (cp-lang.o): Ditto. * class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on the field. * config-lang.in: Add cp-lang.c to gtfiles. * cp-lang.c: Include hashtab.h. (cp_init_ts): New function. (LANG_HOOK_INIT_TS): Use macro. (decl_shadowed_for_var_lookup): New function. (decl_shadowed_for_var_insert): Ditto. * cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common. (NON_THUNK_FUNCTION_CHECK): Ditto. (DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common. (DECL_INIT_PRIORITY): Ditto. (DECL_HAS_SHADOWED_FOR_VAR_P): Ditto. (DECL_SHADOWED_FOR_VAR): Use hashtable. (SET_DECL_SHADOWED_FOR_VAR): Ditto. * decl.c (duplicate_decls): Update for new/updated structures. (poplevel): Use SET_DECL_SHADOWED_FOR_VAR. * decl2.c (start_static_initialization_or_destruction): Deal with priority. * pt.c (tsubst_decl): Check TS_DECL_WRTL before doing SET_DECL_RTL. * tree.c (handle_init_priority_attribute): Handle priority. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is removed. * objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common. (KEYWORD_KEY_NAME): Use decl_minimal. (METHOD_SEL_NAME): Ditto.. (METHOD_SEL_ARGS): Use decl_non_common. (METHOD_ADD_ARGS): Ditto. (METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common. (METHOD_DEFINITION): Ditto. (METHOD_ENCODING): Ditto. * objc-lang.c: (objc_init_ts): New function. 2005-07-08 Daniel Berlin <dberlin@dberlin.org> * trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN is removed. From-SVN: r101799
This commit is contained in:
parent
c249f60870
commit
820cc88fbd
44 changed files with 1768 additions and 818 deletions
|
@ -1,3 +1,101 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Makefile.in (TREE_H): Add treestruct.def.
|
||||
(c-decl.o): Add pointer-set.h
|
||||
* c-decl.c (diagnose_mismatched_decls): Don't attempt to look at
|
||||
visibility on regular DECL's.
|
||||
(merge_decls): Fix the copying of decl nodes of various types for
|
||||
the new structures. Don't update RTL, section name, weak status,
|
||||
etc, on DECL's without RTL.
|
||||
(grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone.
|
||||
Don't check volatile on non-variable types.
|
||||
(store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK
|
||||
to check whether we have seen arguments.
|
||||
* c-objc-common.c (c_tree_printer): Reverse order of tests so that
|
||||
flag is checked before field (flag is common, field is not).
|
||||
* dwarf2out.c (decl_ultimate_origin): Only DECL's with
|
||||
TS_DECL_COMMON could have an origin.
|
||||
(add_location_or_const_value_attribute): Don't check section name
|
||||
on non-var/function decls.
|
||||
(dwarf2out_var_location): Reverse order of tests.
|
||||
* emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace
|
||||
with DECL_WRTL_CHECK.
|
||||
* expmed.c (make_tree): rtl is now in decl_with_rtl.
|
||||
* fold-const.c (fold_binary): Don't check weakness on
|
||||
non-var/function decls.
|
||||
(tree_expr_nonzero_p): Ditto.
|
||||
(fold_checksum_tree): Use tree_decl_extra as sizeof
|
||||
buffer.
|
||||
* ggc-page.c (extra_order_size_table): Add sizes for
|
||||
tree_decl_non_common, tree_parm_decl, tree_var_decl, and
|
||||
tree_field_decl.
|
||||
* gimplify.c (gimplify_bind_expr): Only set
|
||||
DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL.
|
||||
* integrate.c (copy_decl_for_inlining): Don't set RTL on decl's
|
||||
without RTL.
|
||||
* langhooks-def.h (LANG_HOOK_INIT_TS): New.
|
||||
* langhooks.h (init_ts). New langhook.
|
||||
* passes.c (rest_of_decl_compilation): Reverse order of tests.
|
||||
* print-tree.c (print_node): Update to only print fields that
|
||||
exist in the structures the passed decl has.
|
||||
* toplev.c (wrapup_global_declarations): Don't reset
|
||||
DECL_DEFER_OUTPUT on DECL's that don't contain it.
|
||||
* tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed.
|
||||
* tree-inline.c (remap_decl): Ditto.
|
||||
* tree-outof-ssa.c (create_temp): Reverse order of tests.
|
||||
* tree-pretty-print.c (print_declaration): Don't print
|
||||
DECL_REGISTER on things that don't contain it.
|
||||
* tree-vrp.c (expr_computes_nonzero): Don't check weakness on
|
||||
non-var/function decls.
|
||||
* tree.c (tree_contains_struct): New structure.
|
||||
(init_priority_for_decl): New hashtable.
|
||||
(tree_int_map): New structure.
|
||||
(tree_int_map_eq): New function.
|
||||
(tree_int_map_marked_p): Ditto.
|
||||
(tree_int_map_hash): Ditto.
|
||||
(tree_map): Move to tree.h.
|
||||
(tree_map_eq): Externalize.
|
||||
(tree_map_hash): Ditto.
|
||||
(tree_map_marked_p): Ditto.
|
||||
(init_ttree): Set up tree_contains_struct and call langhook.
|
||||
(decl_assembler_name): Use DECL_NON_COMMON_CHECK..
|
||||
(tree_code_size): Update for new structures.
|
||||
(tree_node_structure): Update for new structures.
|
||||
(make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls
|
||||
without the field.
|
||||
(copy_node_stat): Copy init priority.
|
||||
(build_decl_stat): Ditto for visibility.
|
||||
(ts_enum_names): New.
|
||||
(tree_contains_struct_check_failed): New function.
|
||||
(decl_init_priority_lookup): Ditto.
|
||||
(decl_init_priority_insert): Ditto.
|
||||
* treestruct.def: New file.
|
||||
* tree.h (CODE_CONTAINS_STRUCT): New macro.
|
||||
(CONTAINS_STRUCT_CHECK): Ditto.
|
||||
(tree_contains_struct_check_failed): New prototype.
|
||||
(DECL_CHECK): Removed.
|
||||
(DECL_MINIMAL_CHECK): New.
|
||||
(DECL_COMMON_CHECK): Ditto.
|
||||
(DECL_WRTL_CHECK): Ditto.
|
||||
(DECL_NON_COMMON_CHECK): Ditto.
|
||||
(DECL_WITH_VIS_CHECK): Ditto.
|
||||
(VAR_OR_FUNCTION_DECL_P): Ditto
|
||||
(struct tree_decl_minimal): New structure.
|
||||
(struct tree_decl_common): Ditto.
|
||||
(struct tree_decl_with_rtl): Ditto.
|
||||
(struct tree_decl_with_vis): Ditto.
|
||||
(struct tree_decl_non_common): Ditto.
|
||||
(struct tree_field_decl): Ditto.
|
||||
(struct tree_parm_decl): Ditto.
|
||||
(struct tree_var_decl): Ditto.
|
||||
(struct tree_function_decl): Ditto.
|
||||
(struct tree_const_decl): Ditto.
|
||||
(struct tree_result_decl): Ditto.
|
||||
(union tree_node): Add new structures.
|
||||
* var-tracking.c (track_expr_p): Reverse order of tests.
|
||||
|
||||
* doc/c-tree.texi: Add documentation on DECL node internal structure.
|
||||
|
||||
2005-07-08 Kazu Hirata <kazu@codesourcery.com>
|
||||
|
||||
* cfgexpand.c (tree_expand_cfg): Don't use FINALIZE_PIC.
|
||||
|
|
|
@ -711,7 +711,7 @@ RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
|
|||
RTL_H = $(RTL_BASE_H) genrtl.h
|
||||
PARAMS_H = params.h params.def
|
||||
TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \
|
||||
input.h statistics.h vec.h
|
||||
input.h statistics.h vec.h treestruct.def
|
||||
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
|
||||
hard-reg-set.h cfghooks.h $(OBSTACK_H)
|
||||
GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
|
||||
|
@ -1457,7 +1457,8 @@ c-decl.o : c-decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
|
|||
$(EXPR_H) debug.h toplev.h intl.h $(TM_P_H) tree-inline.h $(TIMEVAR_H) \
|
||||
opts.h $(C_PRAGMA_H) gt-c-decl.h $(CGRAPH_H) $(HASHTAB_H) libfuncs.h \
|
||||
except.h $(LANGHOOKS_DEF_H) $(TREE_DUMP_H) $(C_COMMON_H) $(CPPLIB_H) \
|
||||
$(DIAGNOSTIC_H) input.h langhooks.h $(TREE_GIMPLE_H) tree-mudflap.h
|
||||
$(DIAGNOSTIC_H) input.h langhooks.h $(TREE_GIMPLE_H) tree-mudflap.h \
|
||||
pointer-set.h
|
||||
c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
$(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h output.h $(EXPR_H) \
|
||||
$(RTL_H) toplev.h $(TM_P_H) langhooks.h $(GGC_H) $(TREE_FLOW_H) \
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is
|
||||
removed.
|
||||
|
||||
2005-07-07 Pascal Obry <obry@adacore.com>
|
||||
|
||||
* g-socthi-mingw.adb (C_Inet_Addr): New body used to convert the
|
||||
|
|
|
@ -1494,7 +1494,6 @@ create_param_decl (tree param_name, tree param_type, bool readonly)
|
|||
}
|
||||
|
||||
DECL_ARG_TYPE (param_decl) = param_type;
|
||||
DECL_ARG_TYPE_AS_WRITTEN (param_decl) = param_type;
|
||||
TREE_READONLY (param_decl) = readonly;
|
||||
return param_decl;
|
||||
}
|
||||
|
|
323
gcc/c-decl.c
323
gcc/c-decl.c
|
@ -60,6 +60,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|||
#include "libfuncs.h"
|
||||
#include "except.h"
|
||||
#include "langhooks-def.h"
|
||||
#include "pointer-set.h"
|
||||
|
||||
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
|
||||
enum decl_context
|
||||
|
@ -1471,7 +1472,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
|
|||
|
||||
/* warnings */
|
||||
/* All decls must agree on a visibility. */
|
||||
if (DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (newdecl), TS_DECL_WITH_VIS)
|
||||
&& DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
|
||||
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
|
||||
{
|
||||
warning (0, "redeclaration of %q+D with different visibility "
|
||||
|
@ -1638,8 +1640,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|
|||
}
|
||||
}
|
||||
|
||||
/* Keep the old rtl since we can safely use it. */
|
||||
COPY_DECL_RTL (olddecl, newdecl);
|
||||
|
||||
/* Merge the type qualifiers. */
|
||||
if (TREE_READONLY (newdecl))
|
||||
|
@ -1674,153 +1674,178 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|
|||
if (DECL_INITIAL (newdecl) == 0)
|
||||
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
|
||||
|
||||
/* Merge the section attribute.
|
||||
We want to issue an error if the sections conflict but that must be
|
||||
done later in decl_attributes since we are called before attributes
|
||||
are assigned. */
|
||||
if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
|
||||
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS))
|
||||
{
|
||||
/* Merge the section attribute.
|
||||
We want to issue an error if the sections conflict but that must be
|
||||
done later in decl_attributes since we are called before attributes
|
||||
are assigned. */
|
||||
if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
|
||||
DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
|
||||
|
||||
/* Copy the assembler name.
|
||||
Currently, it can only be defined in the prototype. */
|
||||
COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
|
||||
|
||||
/* Copy the assembler name.
|
||||
Currently, it can only be defined in the prototype. */
|
||||
COPY_DECL_ASSEMBLER_NAME (olddecl, newdecl);
|
||||
/* Use visibility of whichever declaration had it specified */
|
||||
if (DECL_VISIBILITY_SPECIFIED (olddecl))
|
||||
{
|
||||
DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
|
||||
DECL_VISIBILITY_SPECIFIED (newdecl) = 1;
|
||||
}
|
||||
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
|
||||
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
|
||||
DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl);
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|
||||
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
|
||||
TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
|
||||
TREE_READONLY (newdecl) |= TREE_READONLY (olddecl);
|
||||
DECL_IS_MALLOC (newdecl) |= DECL_IS_MALLOC (olddecl);
|
||||
DECL_IS_PURE (newdecl) |= DECL_IS_PURE (olddecl);
|
||||
DECL_IS_NOVOPS (newdecl) |= DECL_IS_NOVOPS (olddecl);
|
||||
}
|
||||
|
||||
/* Merge the storage class information. */
|
||||
merge_weak (newdecl, olddecl);
|
||||
|
||||
/* Use visibility of whichever declaration had it specified */
|
||||
if (DECL_VISIBILITY_SPECIFIED (olddecl))
|
||||
{
|
||||
DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
|
||||
DECL_VISIBILITY_SPECIFIED (newdecl) = 1;
|
||||
}
|
||||
/* For functions, static overrides non-static. */
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl);
|
||||
/* This is since we don't automatically
|
||||
copy the attributes of NEWDECL into OLDDECL. */
|
||||
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
||||
/* If this clears `static', clear it in the identifier too. */
|
||||
if (!TREE_PUBLIC (olddecl))
|
||||
TREE_PUBLIC (DECL_NAME (olddecl)) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (DECL_EXTERNAL (newdecl))
|
||||
{
|
||||
TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
|
||||
DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
|
||||
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
DECL_STATIC_CONSTRUCTOR(newdecl) |= DECL_STATIC_CONSTRUCTOR(olddecl);
|
||||
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
|
||||
DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl);
|
||||
DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
|
||||
|= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
|
||||
TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl);
|
||||
TREE_READONLY (newdecl) |= TREE_READONLY (olddecl);
|
||||
DECL_IS_MALLOC (newdecl) |= DECL_IS_MALLOC (olddecl);
|
||||
DECL_IS_PURE (newdecl) |= DECL_IS_PURE (olddecl);
|
||||
DECL_IS_NOVOPS (newdecl) |= DECL_IS_NOVOPS (olddecl);
|
||||
}
|
||||
/* An extern decl does not override previous storage class. */
|
||||
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
|
||||
if (!DECL_EXTERNAL (newdecl))
|
||||
{
|
||||
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
|
||||
DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TREE_STATIC (olddecl) = TREE_STATIC (newdecl);
|
||||
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
||||
}
|
||||
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
/* If we're redefining a function previously defined as extern
|
||||
inline, make sure we emit debug info for the inline before we
|
||||
throw it away, in case it was inlined into a function that hasn't
|
||||
been written out yet. */
|
||||
if (new_is_definition && DECL_INITIAL (olddecl))
|
||||
{
|
||||
if (TREE_USED (olddecl)
|
||||
/* In unit-at-a-time mode we never inline re-defined extern
|
||||
inline functions. */
|
||||
&& !flag_unit_at_a_time
|
||||
&& cgraph_function_possibly_inlined_p (olddecl))
|
||||
(*debug_hooks->outlining_inline_function) (olddecl);
|
||||
|
||||
/* Merge the storage class information. */
|
||||
merge_weak (newdecl, olddecl);
|
||||
/* The new defn must not be inline. */
|
||||
DECL_INLINE (newdecl) = 0;
|
||||
DECL_UNINLINABLE (newdecl) = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If either decl says `inline', this fn is inline,
|
||||
unless its definition was passed already. */
|
||||
if (DECL_DECLARED_INLINE_P (newdecl)
|
||||
|| DECL_DECLARED_INLINE_P (olddecl))
|
||||
DECL_DECLARED_INLINE_P (newdecl) = 1;
|
||||
|
||||
/* For functions, static overrides non-static. */
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
TREE_PUBLIC (newdecl) &= TREE_PUBLIC (olddecl);
|
||||
/* This is since we don't automatically
|
||||
copy the attributes of NEWDECL into OLDDECL. */
|
||||
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
||||
/* If this clears `static', clear it in the identifier too. */
|
||||
if (!TREE_PUBLIC (olddecl))
|
||||
TREE_PUBLIC (DECL_NAME (olddecl)) = 0;
|
||||
}
|
||||
if (DECL_EXTERNAL (newdecl))
|
||||
{
|
||||
TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
|
||||
DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
|
||||
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
|
||||
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
|
||||
}
|
||||
|
||||
/* An extern decl does not override previous storage class. */
|
||||
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
|
||||
if (!DECL_EXTERNAL (newdecl))
|
||||
{
|
||||
DECL_CONTEXT (newdecl) = DECL_CONTEXT (olddecl);
|
||||
DECL_COMMON (newdecl) = DECL_COMMON (olddecl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TREE_STATIC (olddecl) = TREE_STATIC (newdecl);
|
||||
TREE_PUBLIC (olddecl) = TREE_PUBLIC (newdecl);
|
||||
}
|
||||
if (DECL_BUILT_IN (olddecl))
|
||||
{
|
||||
/* If redeclaring a builtin function, it stays built in.
|
||||
But it gets tagged as having been declared. */
|
||||
DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
|
||||
DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
|
||||
C_DECL_DECLARED_BUILTIN (newdecl) = 1;
|
||||
if (new_is_prototype)
|
||||
C_DECL_BUILTIN_PROTOTYPE (newdecl) = 0;
|
||||
else
|
||||
C_DECL_BUILTIN_PROTOTYPE (newdecl)
|
||||
= C_DECL_BUILTIN_PROTOTYPE (olddecl);
|
||||
}
|
||||
|
||||
if (TREE_CODE (newdecl) == FUNCTION_DECL)
|
||||
{
|
||||
/* If we're redefining a function previously defined as extern
|
||||
inline, make sure we emit debug info for the inline before we
|
||||
throw it away, in case it was inlined into a function that hasn't
|
||||
been written out yet. */
|
||||
if (new_is_definition && DECL_INITIAL (olddecl))
|
||||
{
|
||||
if (TREE_USED (olddecl)
|
||||
/* In unit-at-a-time mode we never inline re-defined extern
|
||||
inline functions. */
|
||||
&& !flag_unit_at_a_time
|
||||
&& cgraph_function_possibly_inlined_p (olddecl))
|
||||
(*debug_hooks->outlining_inline_function) (olddecl);
|
||||
/* Also preserve various other info from the definition. */
|
||||
if (!new_is_definition)
|
||||
{
|
||||
DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
|
||||
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
|
||||
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
|
||||
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
|
||||
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
|
||||
|
||||
/* The new defn must not be inline. */
|
||||
DECL_INLINE (newdecl) = 0;
|
||||
DECL_UNINLINABLE (newdecl) = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If either decl says `inline', this fn is inline,
|
||||
unless its definition was passed already. */
|
||||
if (DECL_DECLARED_INLINE_P (newdecl)
|
||||
|| DECL_DECLARED_INLINE_P (olddecl))
|
||||
DECL_DECLARED_INLINE_P (newdecl) = 1;
|
||||
|
||||
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
|
||||
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
|
||||
}
|
||||
|
||||
if (DECL_BUILT_IN (olddecl))
|
||||
{
|
||||
/* If redeclaring a builtin function, it stays built in.
|
||||
But it gets tagged as having been declared. */
|
||||
DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
|
||||
DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
|
||||
C_DECL_DECLARED_BUILTIN (newdecl) = 1;
|
||||
if (new_is_prototype)
|
||||
C_DECL_BUILTIN_PROTOTYPE (newdecl) = 0;
|
||||
else
|
||||
C_DECL_BUILTIN_PROTOTYPE (newdecl)
|
||||
= C_DECL_BUILTIN_PROTOTYPE (olddecl);
|
||||
}
|
||||
|
||||
/* Also preserve various other info from the definition. */
|
||||
if (!new_is_definition)
|
||||
{
|
||||
DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
|
||||
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
|
||||
DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl);
|
||||
DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl);
|
||||
DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl);
|
||||
|
||||
/* Set DECL_INLINE on the declaration if we've got a body
|
||||
from which to instantiate. */
|
||||
if (DECL_INLINE (olddecl) && !DECL_UNINLINABLE (newdecl))
|
||||
{
|
||||
DECL_INLINE (newdecl) = 1;
|
||||
DECL_ABSTRACT_ORIGIN (newdecl)
|
||||
= DECL_ABSTRACT_ORIGIN (olddecl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If a previous declaration said inline, mark the
|
||||
definition as inlinable. */
|
||||
if (DECL_DECLARED_INLINE_P (newdecl)
|
||||
&& !DECL_UNINLINABLE (newdecl))
|
||||
DECL_INLINE (newdecl) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
|
||||
/* Set DECL_INLINE on the declaration if we've got a body
|
||||
from which to instantiate. */
|
||||
if (DECL_INLINE (olddecl) && !DECL_UNINLINABLE (newdecl))
|
||||
{
|
||||
DECL_INLINE (newdecl) = 1;
|
||||
DECL_ABSTRACT_ORIGIN (newdecl)
|
||||
= DECL_ABSTRACT_ORIGIN (olddecl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If a previous declaration said inline, mark the
|
||||
definition as inlinable. */
|
||||
if (DECL_DECLARED_INLINE_P (newdecl)
|
||||
&& !DECL_UNINLINABLE (newdecl))
|
||||
DECL_INLINE (newdecl) = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
|
||||
But preserve OLDDECL's DECL_UID and DECL_CONTEXT. */
|
||||
{
|
||||
unsigned olddecl_uid = DECL_UID (olddecl);
|
||||
tree olddecl_context = DECL_CONTEXT (olddecl);
|
||||
|
||||
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_common),
|
||||
(char *) newdecl + sizeof (struct tree_common),
|
||||
sizeof (struct tree_decl) - sizeof (struct tree_common));
|
||||
sizeof (struct tree_decl_common) - sizeof (struct tree_common));
|
||||
switch (TREE_CODE (olddecl))
|
||||
{
|
||||
case FIELD_DECL:
|
||||
case VAR_DECL:
|
||||
case PARM_DECL:
|
||||
case LABEL_DECL:
|
||||
case RESULT_DECL:
|
||||
case CONST_DECL:
|
||||
case TYPE_DECL:
|
||||
case FUNCTION_DECL:
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
|
||||
(char *) newdecl + sizeof (struct tree_decl_common),
|
||||
tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
|
||||
(char *) newdecl + sizeof (struct tree_decl_common),
|
||||
sizeof (struct tree_decl_non_common) - sizeof (struct tree_decl_common));
|
||||
}
|
||||
DECL_UID (olddecl) = olddecl_uid;
|
||||
DECL_CONTEXT (olddecl) = olddecl_context;
|
||||
}
|
||||
|
@ -4475,7 +4500,6 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
promoted_type = c_type_promotes_to (type);
|
||||
|
||||
DECL_ARG_TYPE (decl) = promoted_type;
|
||||
DECL_ARG_TYPE_AS_WRITTEN (decl) = type_as_written;
|
||||
if (declspecs->inline_p)
|
||||
pedwarn ("parameter %q+D declared %<inline%>", decl);
|
||||
}
|
||||
|
@ -4680,8 +4704,11 @@ grokdeclarator (const struct c_declarator *declarator,
|
|||
|
||||
/* If a type has volatile components, it should be stored in memory.
|
||||
Otherwise, the fact that those components are volatile
|
||||
will be ignored, and would even crash the compiler. */
|
||||
if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl)))
|
||||
will be ignored, and would even crash the compiler.
|
||||
Of course, this only makes sense on VAR,PARM, and RESULT decl's. */
|
||||
if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (decl))
|
||||
&& (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL
|
||||
|| TREE_CODE (decl) == RESULT_DECL))
|
||||
{
|
||||
/* It is not an error for a structure with volatile fields to
|
||||
be declared register, but reset DECL_REGISTER since it
|
||||
|
@ -6088,13 +6115,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
struct c_binding *b;
|
||||
tree parm, decl, last;
|
||||
tree parmids = arg_info->parms;
|
||||
|
||||
/* We use DECL_WEAK as a flag to show which parameters have been
|
||||
seen already, since it is not used on PARM_DECL. */
|
||||
#ifdef ENABLE_CHECKING
|
||||
for (b = current_scope->bindings; b; b = b->prev)
|
||||
gcc_assert (TREE_CODE (b->decl) != PARM_DECL || !DECL_WEAK (b->decl));
|
||||
#endif
|
||||
struct pointer_set_t *seen_args = pointer_set_create ();
|
||||
|
||||
if (!in_system_header)
|
||||
warning (OPT_Wold_style_definition, "%Jold-style function definition",
|
||||
|
@ -6120,7 +6141,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
error ("%q+D declared as a non-parameter", decl);
|
||||
/* If the declaration is already marked, we have a duplicate
|
||||
name. Complain and ignore the duplicate. */
|
||||
else if (DECL_WEAK (decl))
|
||||
else if (pointer_set_contains (seen_args, decl))
|
||||
{
|
||||
error ("multiple parameters named %q+D", decl);
|
||||
TREE_PURPOSE (parm) = 0;
|
||||
|
@ -6151,7 +6172,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
}
|
||||
|
||||
TREE_PURPOSE (parm) = decl;
|
||||
DECL_WEAK (decl) = 1;
|
||||
pointer_set_insert (seen_args, decl);
|
||||
}
|
||||
|
||||
/* Now examine the parms chain for incomplete declarations
|
||||
|
@ -6170,7 +6191,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
TREE_TYPE (parm) = error_mark_node;
|
||||
}
|
||||
|
||||
if (!DECL_WEAK (parm))
|
||||
if (!pointer_set_contains (seen_args, parm))
|
||||
{
|
||||
error ("declaration for parameter %q+D but no such parameter", parm);
|
||||
|
||||
|
@ -6193,18 +6214,18 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
{
|
||||
last = TREE_PURPOSE (parm);
|
||||
DECL_ARGUMENTS (fndecl) = last;
|
||||
DECL_WEAK (last) = 0;
|
||||
|
||||
for (parm = TREE_CHAIN (parm); parm; parm = TREE_CHAIN (parm))
|
||||
if (TREE_PURPOSE (parm))
|
||||
{
|
||||
TREE_CHAIN (last) = TREE_PURPOSE (parm);
|
||||
last = TREE_PURPOSE (parm);
|
||||
DECL_WEAK (last) = 0;
|
||||
}
|
||||
TREE_CHAIN (last) = 0;
|
||||
}
|
||||
|
||||
pointer_set_destroy (seen_args);
|
||||
|
||||
/* If there was a previous prototype,
|
||||
set the DECL_ARG_TYPE of each argument according to
|
||||
the type previously specified, and report any mismatches. */
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* Make-lang.in: Add gt-cp-lang.h.
|
||||
(cp-lang.o): Ditto.
|
||||
* class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on
|
||||
the field.
|
||||
* config-lang.in: Add cp-lang.c to gtfiles.
|
||||
* cp-lang.c: Include hashtab.h.
|
||||
(cp_init_ts): New function.
|
||||
(LANG_HOOK_INIT_TS): Use macro.
|
||||
(decl_shadowed_for_var_lookup): New function.
|
||||
(decl_shadowed_for_var_insert): Ditto.
|
||||
* cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common.
|
||||
(NON_THUNK_FUNCTION_CHECK): Ditto.
|
||||
(DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common.
|
||||
(DECL_INIT_PRIORITY): Ditto.
|
||||
(DECL_HAS_SHADOWED_FOR_VAR_P): Ditto.
|
||||
(DECL_SHADOWED_FOR_VAR): Use hashtable.
|
||||
(SET_DECL_SHADOWED_FOR_VAR): Ditto.
|
||||
* decl.c (duplicate_decls): Update for new/updated structures.
|
||||
(poplevel): Use SET_DECL_SHADOWED_FOR_VAR.
|
||||
* decl2.c (start_static_initialization_or_destruction): Deal with
|
||||
priority.
|
||||
* pt.c (tsubst_decl): Check TS_DECL_WRTL before doing
|
||||
SET_DECL_RTL.
|
||||
* tree.c (handle_init_priority_attribute): Handle priority.
|
||||
|
||||
2005-07-08 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
PR c++/21799
|
||||
|
|
|
@ -110,7 +110,7 @@ $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
|
|||
$(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h
|
||||
|
||||
gtype-cp.h gt-cp-call.h gt-cp-decl.h gt-cp-decl2.h : s-gtype; @true
|
||||
gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h : s-gtype; @true
|
||||
gt-cp-pt.h gt-cp-repo.h gt-cp-parser.h gt-cp-method.h gt-cp-lang.h : s-gtype; @true
|
||||
gt-cp-tree.h gt-cp-mangle.h gt-cp-name-lookup.h gt-cp-typeck2.h: s-gtype; @true
|
||||
gt-cp-rtti.h: s-gtype ; @true
|
||||
|
||||
|
@ -237,7 +237,7 @@ cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) flags.h \
|
|||
c-pragma.h toplev.h output.h input.h cp/operators.def $(TM_P_H)
|
||||
cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h \
|
||||
$(LANGHOOKS_DEF_H) c-common.h gtype-cp.h \
|
||||
$(DIAGNOSTIC_H) cp/cp-objcp-common.h
|
||||
$(DIAGNOSTIC_H) cp/cp-objcp-common.h gt-cp-lang.h
|
||||
cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/decl.h \
|
||||
output.h $(EXPR_H) except.h toplev.h $(HASHTAB_H) $(RTL_H) \
|
||||
cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \
|
||||
|
|
|
@ -4130,7 +4130,6 @@ create_vtable_ptr (tree t, tree* virtuals_p)
|
|||
tree field;
|
||||
|
||||
field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
|
||||
SET_DECL_ASSEMBLER_NAME (field, get_identifier (VFIELD_BASE));
|
||||
DECL_VIRTUAL_P (field) = 1;
|
||||
DECL_ARTIFICIAL (field) = 1;
|
||||
DECL_FIELD_CONTEXT (field) = t;
|
||||
|
|
|
@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
|
|||
|
||||
target_libs="target-libstdc++-v3"
|
||||
|
||||
gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c \$(srcdir)/cp/class.c"
|
||||
gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-lang.c"
|
||||
|
|
|
@ -32,8 +32,10 @@ Boston, MA 02110-1301, USA. */
|
|||
#include "diagnostic.h"
|
||||
#include "debug.h"
|
||||
#include "cp-objcp-common.h"
|
||||
#include "hashtab.h"
|
||||
|
||||
enum c_language_kind c_language = clk_cxx;
|
||||
static void cp_init_ts (void);
|
||||
|
||||
/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
|
||||
consequently, there should be very few hooks below. */
|
||||
|
@ -46,6 +48,8 @@ enum c_language_kind c_language = clk_cxx;
|
|||
#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
|
||||
#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF
|
||||
#define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref
|
||||
#undef LANG_HOOKS_INIT_TS
|
||||
#define LANG_HOOKS_INIT_TS cp_init_ts
|
||||
|
||||
/* Each front end provides its own lang hook initializer. */
|
||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||
|
@ -106,10 +110,79 @@ objcp_tsubst_copy_and_build (tree t ATTRIBUTE_UNUSED,
|
|||
return NULL_TREE;
|
||||
}
|
||||
|
||||
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
|
||||
htab_t shadowed_var_for_decl;
|
||||
|
||||
|
||||
static void
|
||||
cp_init_ts (void)
|
||||
{
|
||||
tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[ALIAS_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
|
||||
tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[ALIAS_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
|
||||
tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[ALIAS_DECL][TS_DECL_WRTL] = 1;
|
||||
|
||||
tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[ALIAS_DECL][TS_DECL_COMMON] = 1;
|
||||
|
||||
tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[ALIAS_DECL][TS_DECL_MINIMAL] = 1;
|
||||
|
||||
shadowed_var_for_decl = htab_create_ggc (512, tree_map_hash,
|
||||
tree_map_eq, 0);
|
||||
|
||||
}
|
||||
|
||||
/* Lookup a shadowed var for FROM, and return it if we find one. */
|
||||
|
||||
tree
|
||||
decl_shadowed_for_var_lookup (tree from)
|
||||
{
|
||||
struct tree_map *h, in;
|
||||
in.from = from;
|
||||
|
||||
h = htab_find_with_hash (shadowed_var_for_decl, &in,
|
||||
htab_hash_pointer (from));
|
||||
if (h)
|
||||
return h->to;
|
||||
return NULL_TREE;
|
||||
}
|
||||
|
||||
/* Insert a mapping FROM->TO in the shadowed var hashtable. */
|
||||
|
||||
void
|
||||
decl_shadowed_for_var_insert (tree from, tree to)
|
||||
{
|
||||
struct tree_map *h;
|
||||
void **loc;
|
||||
|
||||
h = ggc_alloc (sizeof (struct tree_map));
|
||||
h->hash = htab_hash_pointer (from);
|
||||
h->from = from;
|
||||
h->to = to;
|
||||
loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, h->hash, INSERT);
|
||||
*(struct tree_map **) loc = h;
|
||||
}
|
||||
|
||||
void
|
||||
finish_file (void)
|
||||
{
|
||||
cp_finish_file ();
|
||||
}
|
||||
|
||||
#include "gt-cp-cp-lang.h"
|
||||
#include "gtype-cp.h"
|
||||
|
|
|
@ -174,15 +174,15 @@ struct diagnostic_context;
|
|||
#define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \
|
||||
({ const tree __t = (NODE); \
|
||||
if (TREE_CODE (__t) != FUNCTION_DECL && \
|
||||
TREE_CODE (__t) != TEMPLATE_DECL && __t->decl.lang_specific \
|
||||
&& __t->decl.lang_specific->decl_flags.thunk_p) \
|
||||
TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
|
||||
&& __t->decl_common.lang_specific->decl_flags.thunk_p) \
|
||||
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
|
||||
__t; })
|
||||
#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
|
||||
({ const tree __t = (NODE); \
|
||||
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl.lang_specific \
|
||||
|| !__t->decl.lang_specific->decl_flags.thunk_p) \
|
||||
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
|
||||
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|
||||
|| !__t->decl_common.lang_specific->decl_flags.thunk_p) \
|
||||
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
|
||||
__t; })
|
||||
#else
|
||||
#define NON_THUNK_FUNCTION_CHECK(NODE) (NODE)
|
||||
|
@ -1992,7 +1992,7 @@ struct lang_decl GTY(())
|
|||
/* In a NAMESPACE_DECL, the list of namespaces which have associated
|
||||
themselves with this one. */
|
||||
#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
|
||||
(NAMESPACE_DECL_CHECK (NODE)->decl.saved_tree)
|
||||
(NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree)
|
||||
|
||||
/* In a NAMESPACE_DECL, points to the original namespace if this is
|
||||
a namespace alias. */
|
||||
|
@ -2007,15 +2007,13 @@ struct lang_decl GTY(())
|
|||
&& CP_DECL_CONTEXT (NODE) == global_namespace \
|
||||
&& DECL_NAME (NODE) == std_identifier)
|
||||
|
||||
/* In a non-local VAR_DECL with static storage duration, this is the
|
||||
initialization priority. If this value is zero, the NODE will be
|
||||
initialized at the DEFAULT_INIT_PRIORITY. */
|
||||
#define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i)
|
||||
|
||||
/* In a TREE_LIST concatenating using directives, indicate indirect
|
||||
directives */
|
||||
#define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
|
||||
|
||||
extern tree decl_shadowed_for_var_lookup (tree);
|
||||
extern void decl_shadowed_for_var_insert (tree, tree);
|
||||
|
||||
/* Non zero if this is a using decl for a dependent scope. */
|
||||
#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
|
||||
|
||||
|
@ -2025,9 +2023,18 @@ struct lang_decl GTY(())
|
|||
/* The decls named by a using decl. */
|
||||
#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
|
||||
|
||||
/* In a VAR_DECL, true if we have a shadowed local variable
|
||||
in the shadowed var table for this VAR_DECL. */
|
||||
#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
|
||||
(VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
|
||||
|
||||
/* In a VAR_DECL for a variable declared in a for statement,
|
||||
this is the shadowed (local) variable. */
|
||||
#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT_FLD(VAR_DECL_CHECK (NODE))
|
||||
#define DECL_SHADOWED_FOR_VAR(NODE) \
|
||||
(DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
|
||||
|
||||
#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
|
||||
(decl_shadowed_for_var_insert (NODE, VAL))
|
||||
|
||||
/* In a FUNCTION_DECL, this is nonzero if this function was defined in
|
||||
the class definition. We have saved away the text of the function,
|
||||
|
@ -2300,7 +2307,7 @@ struct lang_decl GTY(())
|
|||
/* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have
|
||||
not yet seen a prototype for that function. */
|
||||
#define DECL_ANTICIPATED(NODE) \
|
||||
(DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p)
|
||||
(DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p)
|
||||
|
||||
/* Record whether a typedef for type `int' was actually `signed int'. */
|
||||
#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
|
||||
|
@ -2622,7 +2629,7 @@ struct lang_decl GTY(())
|
|||
TEMPLATE_PARM_INDEX for the parameter is available as the
|
||||
DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
|
||||
TYPE_DECL). */
|
||||
#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS (NODE)
|
||||
#define DECL_TEMPLATE_PARMS(NODE) DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments
|
||||
#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
|
||||
INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
|
||||
#define DECL_NTPARMS(NODE) \
|
||||
|
|
|
@ -608,7 +608,10 @@ poplevel (int keep, int reverse, int functionbody)
|
|||
/* Keep track of what should have happened when we
|
||||
popped the binding. */
|
||||
if (ob && ob->value)
|
||||
DECL_SHADOWED_FOR_VAR (link) = ob->value;
|
||||
{
|
||||
SET_DECL_SHADOWED_FOR_VAR (link, ob->value);
|
||||
DECL_HAS_SHADOWED_FOR_VAR_P (link) = 1;
|
||||
}
|
||||
|
||||
/* Add it to the list of dead variables in the next
|
||||
outermost binding to that we can remove these when we
|
||||
|
@ -1805,6 +1808,13 @@ duplicate_decls (tree newdecl, tree olddecl)
|
|||
DECL_VISIBILITY (newdecl) = DECL_VISIBILITY (olddecl);
|
||||
DECL_VISIBILITY_SPECIFIED (newdecl) = 1;
|
||||
}
|
||||
/* Init priority used to be merged from newdecl to olddecl by the memcpy,
|
||||
so keep this behavior. */
|
||||
if (TREE_CODE (newdecl) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (newdecl))
|
||||
{
|
||||
SET_DECL_INIT_PRIORITY (olddecl, DECL_INIT_PRIORITY (newdecl));
|
||||
DECL_HAS_INIT_PRIORITY_P (olddecl) = 1;
|
||||
}
|
||||
|
||||
/* The DECL_LANG_SPECIFIC information in OLDDECL will be replaced
|
||||
with that from NEWDECL below. */
|
||||
|
@ -1819,12 +1829,15 @@ duplicate_decls (tree newdecl, tree olddecl)
|
|||
{
|
||||
int function_size;
|
||||
|
||||
function_size = sizeof (struct tree_decl);
|
||||
function_size = sizeof (struct tree_decl_common);
|
||||
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_common),
|
||||
(char *) newdecl + sizeof (struct tree_common),
|
||||
function_size - sizeof (struct tree_common));
|
||||
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
|
||||
(char *) newdecl + sizeof (struct tree_decl_common),
|
||||
sizeof (struct tree_function_decl) - sizeof (struct tree_decl_common));
|
||||
if (DECL_TEMPLATE_INSTANTIATION (newdecl))
|
||||
/* If newdecl is a template instantiation, it is possible that
|
||||
the following sequence of events has occurred:
|
||||
|
@ -1853,12 +1866,34 @@ duplicate_decls (tree newdecl, tree olddecl)
|
|||
}
|
||||
else
|
||||
{
|
||||
size_t size = tree_code_size (TREE_CODE (olddecl));
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_common),
|
||||
(char *) newdecl + sizeof (struct tree_common),
|
||||
sizeof (struct tree_decl) - sizeof (struct tree_common)
|
||||
+ TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *));
|
||||
sizeof (struct tree_decl_common) - sizeof (struct tree_common));
|
||||
switch (TREE_CODE (olddecl))
|
||||
{
|
||||
case LABEL_DECL:
|
||||
case VAR_DECL:
|
||||
case RESULT_DECL:
|
||||
case PARM_DECL:
|
||||
case FIELD_DECL:
|
||||
case TYPE_DECL:
|
||||
case CONST_DECL:
|
||||
{
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
|
||||
(char *) newdecl + sizeof (struct tree_decl_common),
|
||||
size - sizeof (struct tree_decl_common)
|
||||
+ TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
|
||||
(char *) newdecl + sizeof (struct tree_decl_common),
|
||||
sizeof (struct tree_decl_non_common) - sizeof (struct tree_decl_common)
|
||||
+ TREE_CODE_LENGTH (TREE_CODE (newdecl)) * sizeof (char *));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DECL_UID (olddecl) = olddecl_uid;
|
||||
if (olddecl_friend)
|
||||
DECL_FRIEND_P (olddecl) = 1;
|
||||
|
|
|
@ -2321,14 +2321,15 @@ static tree
|
|||
start_static_initialization_or_destruction (tree decl, int initp)
|
||||
{
|
||||
tree guard_if_stmt = NULL_TREE;
|
||||
int priority;
|
||||
int priority = 0;
|
||||
tree cond;
|
||||
tree guard;
|
||||
tree init_cond;
|
||||
priority_info pi;
|
||||
|
||||
/* Figure out the priority for this declaration. */
|
||||
priority = DECL_INIT_PRIORITY (decl);
|
||||
/* Figure out the priority for this declaration. */
|
||||
if (DECL_HAS_INIT_PRIORITY_P (decl))
|
||||
priority = DECL_INIT_PRIORITY (decl);
|
||||
if (!priority)
|
||||
priority = DEFAULT_INIT_PRIORITY;
|
||||
|
||||
|
|
|
@ -1081,10 +1081,12 @@ check_for_out_of_scope_variable (tree decl)
|
|||
if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl)))
|
||||
return decl;
|
||||
|
||||
shadowed = DECL_SHADOWED_FOR_VAR (decl);
|
||||
shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl)
|
||||
? DECL_SHADOWED_FOR_VAR (decl) : NULL_TREE ;
|
||||
while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
|
||||
&& DECL_DEAD_FOR_LOCAL (shadowed))
|
||||
shadowed = DECL_SHADOWED_FOR_VAR (shadowed);
|
||||
shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
|
||||
? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE;
|
||||
if (!shadowed)
|
||||
shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (decl));
|
||||
if (shadowed)
|
||||
|
|
13
gcc/cp/pt.c
13
gcc/cp/pt.c
|
@ -2251,9 +2251,10 @@ reduce_template_parm_level (tree index, tree type, int levels)
|
|||
decl, type);
|
||||
TEMPLATE_PARM_DESCENDANTS (index) = t;
|
||||
|
||||
/* Template template parameters need this. */
|
||||
DECL_TEMPLATE_PARMS (decl)
|
||||
= DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index));
|
||||
/* Template template parameters need this. */
|
||||
if (TREE_CODE (decl) != CONST_DECL)
|
||||
DECL_TEMPLATE_PARMS (decl)
|
||||
= DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index));
|
||||
}
|
||||
|
||||
return TEMPLATE_PARM_DESCENDANTS (index);
|
||||
|
@ -6646,12 +6647,14 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
|
|||
DECL_CONTEXT (r) = ctx;
|
||||
/* Clear out the mangled name and RTL for the instantiation. */
|
||||
SET_DECL_ASSEMBLER_NAME (r, NULL_TREE);
|
||||
SET_DECL_RTL (r, NULL_RTX);
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL))
|
||||
SET_DECL_RTL (r, NULL_RTX);
|
||||
|
||||
/* Don't try to expand the initializer until someone tries to use
|
||||
this variable; otherwise we run into circular dependencies. */
|
||||
DECL_INITIAL (r) = NULL_TREE;
|
||||
SET_DECL_RTL (r, NULL_RTX);
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL))
|
||||
SET_DECL_RTL (r, NULL_RTX);
|
||||
DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
|
||||
|
||||
/* Even if the original location is out of scope, the newly
|
||||
|
|
|
@ -1841,7 +1841,8 @@ handle_init_priority_attribute (tree* node,
|
|||
|
||||
if (SUPPORTS_INIT_PRIORITY)
|
||||
{
|
||||
DECL_INIT_PRIORITY (decl) = pri;
|
||||
SET_DECL_INIT_PRIORITY (decl, pri);
|
||||
DECL_HAS_INIT_PRIORITY_P (decl) = 1;
|
||||
return NULL_TREE;
|
||||
}
|
||||
else
|
||||
|
@ -2128,7 +2129,7 @@ decl_linkage (tree decl)
|
|||
template instantiations have internal linkage (in the object
|
||||
file), but the symbols should still be treated as having external
|
||||
linkage from the point of view of the language. */
|
||||
if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
|
||||
if (TREE_CODE (decl) != TYPE_DECL && DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
|
||||
return lk_external;
|
||||
|
||||
/* Things in local scope do not have linkage, if they don't have
|
||||
|
|
|
@ -847,6 +847,15 @@ internal representation, except for declarations of functions
|
|||
(represented by @code{FUNCTION_DECL} nodes), which are described in
|
||||
@ref{Functions}.
|
||||
|
||||
@menu
|
||||
* Working with declarations:: Macros and functions that work on
|
||||
declarations.
|
||||
* Internal structure:: How declaration nodes are represented.
|
||||
@end menu
|
||||
|
||||
@node Working with declarations
|
||||
@subsection Working with declarations
|
||||
|
||||
Some macros can be used with any kind of declaration. These include:
|
||||
@ftable @code
|
||||
@item DECL_NAME
|
||||
|
@ -991,6 +1000,179 @@ Back ends can safely ignore these nodes.
|
|||
|
||||
@end table
|
||||
|
||||
@node Internal structure
|
||||
@subsection Internal structure
|
||||
|
||||
@code{DECL} nodes are represented internally as a hierarchy of
|
||||
structures.
|
||||
|
||||
@menu
|
||||
* Current structure hierarchy:: The current DECL node structure
|
||||
hierarchy.
|
||||
* Adding new DECL node types:: How to add a new DECL node to a
|
||||
frontend.
|
||||
@end menu
|
||||
|
||||
@node Current structure hierarchy
|
||||
@subsubsection Current structure hierarchy
|
||||
|
||||
@table @code
|
||||
|
||||
@item struct tree_decl_minimal
|
||||
This is the minimal structure to inherit from in order for common
|
||||
@code{DECL} macros to work. The fields it contains are a unique ID,
|
||||
source location, context, and name.
|
||||
|
||||
@item struct tree_decl_common
|
||||
This structure inherits from @code{struct tree_decl_minimal}. It
|
||||
contains fields that most @code{DECL} nodes need, such as a field to
|
||||
store alignment, machine mode, size, and attributes.
|
||||
|
||||
@item struct tree_field_decl
|
||||
This structure inherits from @code{struct tree_decl_common}. It is
|
||||
used to represent @code{FIELD_DECL}.
|
||||
|
||||
@item struct tree_label_decl
|
||||
This structure inherits from @code{struct tree_decl_common}. It is
|
||||
used to represent @code{LABEL_DECL}.
|
||||
|
||||
@item struct tree_translation_unit_decl
|
||||
This structure inherits from @code{struct tree_decl_common}. It is
|
||||
used to represent @code{TRANSLATION_UNIT_DECL}.
|
||||
|
||||
@item struct tree_decl_with_rtl
|
||||
This structure inherits from @code{struct tree_decl_common}. It
|
||||
contains a field to store the low-level RTL associated with a
|
||||
@code{DECL} node.
|
||||
|
||||
@item struct tree_result_decl
|
||||
This structure inherits from @code{struct tree_decl_with_rtl}. It is
|
||||
used to represent @code{RESULT_DECL}.
|
||||
|
||||
@item struct tree_const_decl
|
||||
This structure inherits from @code{struct tree_decl_with_rtl}. It is
|
||||
used to represent @code{CONST_DECL}.
|
||||
|
||||
@item struct tree_parm_decl
|
||||
This structure inherits from @code{struct tree_decl_with_rtl}. It is
|
||||
used to represent @code{PARM_DECL}.
|
||||
|
||||
@item struct tree_decl_with_vis
|
||||
This structure inherits from @code{struct tree_decl_with_rtl}. It
|
||||
contains fields necessary to store visibility information, as well as
|
||||
a section name and assembler name.
|
||||
|
||||
@item struct tree_var_decl
|
||||
This structure inherits from @code{struct tree_decl_with_vis}. It is
|
||||
used to represent @code{VAR_DECL}.
|
||||
|
||||
@item struct tree_function_decl
|
||||
This structure inherits from @code{struct tree_decl_with_vis}. It is
|
||||
used to represent @code{FUNCTION_DECL}.
|
||||
|
||||
@end table
|
||||
@node Adding new DECL node types
|
||||
@subsubsection Adding new DECL node types
|
||||
|
||||
Adding a new @code{DECL} tree consists of the following steps
|
||||
|
||||
@table @asis
|
||||
|
||||
@item Add a new tree code for the @code{DECL} node
|
||||
For language specific @code{DECL} nodes, there is a @file{.def} file
|
||||
in each frontend directory where the tree code should be added.
|
||||
For @code{DECL} nodes that are part of the middle-end, the code should
|
||||
be added to @file{tree.def}.
|
||||
|
||||
@item Create a new structure type for the @code{DECL} node
|
||||
These structures should inherit from one of the existing structures in
|
||||
the language hierarchy by using that structure as the first member.
|
||||
|
||||
@smallexample
|
||||
struct tree_foo_decl
|
||||
@{
|
||||
struct tree_decl_with_vis common;
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
Would create a structure name @code{tree_foo_decl} that inherits from
|
||||
@code{struct tree_decl_with_vis}.
|
||||
|
||||
For language specific @code{DECL} nodes, this new structure type
|
||||
should go in the appropriate @file{.h} file.
|
||||
For @code{DECL} nodes that are part of the middle-end, the structure
|
||||
type should go in @file{tree.h}.
|
||||
|
||||
@item Add a member to the tree structure enumerator for the node
|
||||
For garbage collection and dynamic checking purposes, each @code{DECL}
|
||||
node structure type is required to have a unique enumerator value
|
||||
specified with it.
|
||||
For language specific @code{DECL} nodes, this new enumerator value
|
||||
should go in the approriate @file{.def} file.
|
||||
For @code{DECL} nodes that are part of the middle-end, the enumerator
|
||||
values are specified in @file{treestruct.def}.
|
||||
|
||||
@item Update @code{union tree_node}
|
||||
In order to make your new structure type usable, it must be added to
|
||||
@code{union tree_node}.
|
||||
For language specific @code{DECL} nodes, a new entry should be added
|
||||
to the approriate @file{.h} file of the form
|
||||
@smallexample
|
||||
struct tree_foo_decl GTY ((tag ("TS_VAR_DECL"))) foo_decl;
|
||||
@end smallexample
|
||||
For @code{DECL} nodes that are part of the middle-end, the additional
|
||||
member goes directly into @code{union tree_node} in @file{tree.h}.
|
||||
|
||||
@item Update dynamic checking info
|
||||
In order to be able to check whether accessing a named portion of
|
||||
@code{union tree_node} is legal, and whether a certain @code{DECL} node
|
||||
contains one of the enumerated @code{DECL} node structures in the
|
||||
hierarchy, a simple lookup table is used.
|
||||
This lookup table needs to be kept up to date with the tree structure
|
||||
hierarchy, or else checking and containment macros will fail
|
||||
inapproriately.
|
||||
|
||||
For language specific @code{DECL} nodes, their is an @code{init_ts}
|
||||
function in an approriate @file{.c} file, which initializes the lookup
|
||||
table.
|
||||
Code setting up the table for new @code{DECL} nodes should be added
|
||||
there.
|
||||
For each @code{DECL} tree code and enumerator value representing a
|
||||
member of the inheritance hierarchy, the table should contain 1 if
|
||||
that tree code inherits (directly or indirectly) from that member.
|
||||
Thus, a @code{FOO_DECL} node derived from @code{struct decl_with_rtl},
|
||||
and enumerator value @code{TS_FOO_DECL}, would be set up as follows
|
||||
@smallexample
|
||||
tree_contains_struct[FOO_DECL][TS_FOO_DECL] = 1;
|
||||
tree_contains_struct[FOO_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[FOO_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[FOO_DECL][TS_DECL_MINIMAL] = 1;
|
||||
@end smallexample
|
||||
|
||||
For @code{DECL} nodes that are part of the middle-end, the setup code
|
||||
goes into @file{tree.c}.
|
||||
|
||||
@item Add macros to access any new fields and flags
|
||||
|
||||
Each added field or flag should have a macro that is used to access
|
||||
it, that performs approriate checking to ensure only the right type of
|
||||
@code{DECL} nodes access the field.
|
||||
|
||||
These macros generally take the following form
|
||||
@smallexample
|
||||
#define FOO_DECL_FIELDNAME(NODE) FOO_DECL_CHECK(NODE)->foo_decl.fieldname
|
||||
@end smallexample
|
||||
However, if the structure is simply a base class for further
|
||||
structures, something like the following should be used
|
||||
@smallexample
|
||||
#define BASE_STRUCT_CHECK(T) CONTAINS_STRUCT_CHECK(T, TS_BASE_STRUCT)
|
||||
#define BASE_STRUCT_FIELDNAME(NODE) \
|
||||
(BASE_STRUCT_CHECK(NODE)->base_struct.fieldname
|
||||
@end smallexample
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@c ---------------------------------------------------------------------
|
||||
@c Functions
|
||||
@c ---------------------------------------------------------------------
|
||||
|
|
|
@ -4631,6 +4631,9 @@ dwarf_form_name (unsigned int form)
|
|||
static tree
|
||||
decl_ultimate_origin (tree decl)
|
||||
{
|
||||
if (!CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_COMMON))
|
||||
return NULL_TREE;
|
||||
|
||||
/* output_inline_function sets DECL_ABSTRACT_ORIGIN for all the
|
||||
nodes in the function to point to themselves; ignore that if
|
||||
we're trying to output the abstract instance of this function. */
|
||||
|
@ -10143,7 +10146,7 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
|
|||
XXX: If you split a variable across multiple sections, this
|
||||
won't notice. */
|
||||
|
||||
if (DECL_SECTION_NAME (decl))
|
||||
if (VAR_OR_FUNCTION_DECL_P (decl) && DECL_SECTION_NAME (decl))
|
||||
{
|
||||
tree sectree = DECL_SECTION_NAME (decl);
|
||||
secname = TREE_STRING_POINTER (sectree);
|
||||
|
|
|
@ -954,7 +954,7 @@ set_reg_attrs_for_parm (rtx parm_rtx, rtx mem)
|
|||
void
|
||||
set_decl_rtl (tree t, rtx x)
|
||||
{
|
||||
DECL_CHECK (t)->decl.rtl = x;
|
||||
DECL_WRTL_CHECK (t)->decl_with_rtl.rtl = x;
|
||||
|
||||
if (!x)
|
||||
return;
|
||||
|
|
|
@ -4939,7 +4939,7 @@ make_tree (tree type, rtx x)
|
|||
|
||||
/* Note that we do *not* use SET_DECL_RTL here, because we do not
|
||||
want set_decl_rtl to go adjusting REG_ATTRS for this temporary. */
|
||||
t->decl.rtl = x;
|
||||
t->decl_with_rtl.rtl = x;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -8736,7 +8736,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
object against zero, then we know the result. */
|
||||
if ((code == EQ_EXPR || code == NE_EXPR)
|
||||
&& TREE_CODE (arg0) == ADDR_EXPR
|
||||
&& DECL_P (TREE_OPERAND (arg0, 0))
|
||||
&& VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (arg0, 0))
|
||||
&& ! DECL_WEAK (TREE_OPERAND (arg0, 0))
|
||||
&& integer_zerop (arg1))
|
||||
return constant_boolean_node (code != EQ_EXPR, type);
|
||||
|
@ -8746,13 +8746,13 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
|
|||
have access to attributes for externs), then we know the result. */
|
||||
if ((code == EQ_EXPR || code == NE_EXPR)
|
||||
&& TREE_CODE (arg0) == ADDR_EXPR
|
||||
&& DECL_P (TREE_OPERAND (arg0, 0))
|
||||
&& VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (arg0, 0))
|
||||
&& ! DECL_WEAK (TREE_OPERAND (arg0, 0))
|
||||
&& ! lookup_attribute ("alias",
|
||||
DECL_ATTRIBUTES (TREE_OPERAND (arg0, 0)))
|
||||
&& ! DECL_EXTERNAL (TREE_OPERAND (arg0, 0))
|
||||
&& TREE_CODE (arg1) == ADDR_EXPR
|
||||
&& DECL_P (TREE_OPERAND (arg1, 0))
|
||||
&& VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (arg1, 0))
|
||||
&& ! DECL_WEAK (TREE_OPERAND (arg1, 0))
|
||||
&& ! lookup_attribute ("alias",
|
||||
DECL_ATTRIBUTES (TREE_OPERAND (arg1, 0)))
|
||||
|
@ -10181,14 +10181,14 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
|
|||
{
|
||||
void **slot;
|
||||
enum tree_code code;
|
||||
char buf[sizeof (struct tree_decl)];
|
||||
char buf[sizeof (struct tree_decl_non_common)];
|
||||
int i, len;
|
||||
|
||||
recursive_label:
|
||||
|
||||
gcc_assert ((sizeof (struct tree_exp) + 5 * sizeof (tree)
|
||||
<= sizeof (struct tree_decl))
|
||||
&& sizeof (struct tree_type) <= sizeof (struct tree_decl));
|
||||
<= sizeof (struct tree_decl_non_common))
|
||||
&& sizeof (struct tree_type) <= sizeof (struct tree_decl_non_common));
|
||||
if (expr == NULL)
|
||||
return;
|
||||
slot = htab_find_slot (ht, expr, INSERT);
|
||||
|
@ -10834,7 +10834,7 @@ tree_expr_nonzero_p (tree t)
|
|||
return false;
|
||||
|
||||
/* Weak declarations may link to NULL. */
|
||||
if (DECL_P (base))
|
||||
if (VAR_OR_FUNCTION_DECL_P (base))
|
||||
return !DECL_WEAK (base);
|
||||
|
||||
/* Constants are never weak. */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN
|
||||
is removed.
|
||||
|
||||
2005-07-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* primary.c (gfc_match_rvalue): Handle ENTRY the same way
|
||||
|
|
|
@ -1217,7 +1217,6 @@ create_function_arglist (gfc_symbol * sym)
|
|||
/* Fill in arg stuff. */
|
||||
DECL_CONTEXT (parm) = fndecl;
|
||||
DECL_ARG_TYPE (parm) = type;
|
||||
DECL_ARG_TYPE_AS_WRITTEN (parm) = type;
|
||||
/* All implementation args are read-only. */
|
||||
TREE_READONLY (parm) = 1;
|
||||
|
||||
|
|
|
@ -186,7 +186,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|||
|
||||
static const size_t extra_order_size_table[] = {
|
||||
sizeof (struct stmt_ann_d),
|
||||
sizeof (struct tree_decl),
|
||||
sizeof (struct tree_decl_non_common),
|
||||
sizeof (struct tree_field_decl),
|
||||
sizeof (struct tree_parm_decl),
|
||||
sizeof (struct tree_var_decl),
|
||||
sizeof (struct tree_list),
|
||||
TREE_EXP_SIZE (2),
|
||||
RTL_SIZE (2), /* MEM, PLUS, etc. */
|
||||
|
|
|
@ -860,7 +860,8 @@ gimplify_bind_expr (tree *expr_p, tree temp, tree *pre_p)
|
|||
/* Mark variables seen in this bind expr. */
|
||||
for (t = BIND_EXPR_VARS (bind_expr); t ; t = TREE_CHAIN (t))
|
||||
{
|
||||
DECL_SEEN_IN_BIND_EXPR_P (t) = 1;
|
||||
if (TREE_CODE (t) == VAR_DECL)
|
||||
DECL_SEEN_IN_BIND_EXPR_P (t) = 1;
|
||||
|
||||
/* Preliminarily mark non-addressed complex variables as eligible
|
||||
for promotion to gimple registers. We'll transform their uses
|
||||
|
@ -3035,7 +3036,8 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
|
|||
When optimizing, the return_slot pass marks more functions
|
||||
as safe after we have escape info. */
|
||||
use_target = false;
|
||||
else if (DECL_GIMPLE_FORMAL_TEMP_P (*to_p))
|
||||
else if (TREE_CODE (*to_p) != PARM_DECL
|
||||
&& DECL_GIMPLE_FORMAL_TEMP_P (*to_p))
|
||||
/* Don't use the original target if it's a formal temp; we
|
||||
don't want to take their addresses. */
|
||||
use_target = false;
|
||||
|
|
|
@ -137,7 +137,8 @@ copy_decl_for_inlining (tree decl, tree from_fn, tree to_fn)
|
|||
DECL_ABSTRACT_ORIGIN (copy) = DECL_ORIGIN (decl);
|
||||
|
||||
/* The new variable/label has no RTL, yet. */
|
||||
if (!TREE_STATIC (copy) && !DECL_EXTERNAL (copy))
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (copy), TS_DECL_WRTL)
|
||||
&& !TREE_STATIC (copy) && !DECL_EXTERNAL (copy))
|
||||
SET_DECL_RTL (copy, NULL_RTX);
|
||||
|
||||
/* These args would always appear unused, if not for this. */
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* java-tree.h (LABEL_RETURN_LABELS): Use decl_non_common.
|
||||
(LABEL_PENDING_CHAIN): Ditto.
|
||||
(LABEL_PC): Ditto.
|
||||
(DECL_BIT_INDEX): Ditto.
|
||||
|
||||
2005-07-07 Bryce McKinlay <mckinlay@redhat.com>
|
||||
|
||||
PR java/18119
|
||||
|
|
|
@ -850,11 +850,11 @@ union lang_tree_node
|
|||
#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (VAR_OR_FIELD_CHECK (DECL))
|
||||
|
||||
/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
|
||||
#define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (LABEL_DECL_CHECK (NODE)))
|
||||
#define LABEL_TYPE_STATE(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_1)
|
||||
|
||||
/* In the label of a subroutine, a dummy label that records the
|
||||
state following a merge of all the ret instructions in this subroutine. */
|
||||
#define LABEL_RETURN_LABEL(DECL) DECL_ARGUMENTS(DECL)
|
||||
#define LABEL_RETURN_LABEL(DECL) (LABEL_DECL_CHECK (DECL)->label_decl.java_field_2)
|
||||
|
||||
/* In the label of a sub-routine, records the type state at return.
|
||||
A local may be TYPE_UNUSED, which means that the local is not
|
||||
|
@ -869,14 +869,14 @@ union lang_tree_node
|
|||
|
||||
/* In the label of a sub-routine, a chain of the return location labels. */
|
||||
#define LABEL_RETURN_LABELS(node) \
|
||||
(LABEL_DECL_CHECK (LABEL_RETURN_LABEL (node))->decl.result)
|
||||
(LABEL_DECL_CHECK (LABEL_RETURN_LABEL (node))->label_decl.java_field_3)
|
||||
|
||||
/* In a LABEL_DECL, the next pending label.
|
||||
See pending_blocks in expr.c. */
|
||||
#define LABEL_PENDING_CHAIN(NODE) (LABEL_DECL_CHECK (NODE)->decl.result)
|
||||
#define LABEL_PENDING_CHAIN(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_3)
|
||||
|
||||
/* In a LABEL_DECL, the corresponding bytecode program counter. */
|
||||
#define LABEL_PC(NODE) (LABEL_DECL_CHECK (NODE)->decl.u2.i)
|
||||
#define LABEL_PC(NODE) (LABEL_DECL_CHECK (NODE)->label_decl.java_field_4)
|
||||
|
||||
/* Used during verification to mark the label has "changed". (See JVM Spec). */
|
||||
#define LABEL_CHANGED(NODE) DECL_LANG_FLAG_6 (LABEL_DECL_CHECK (NODE))
|
||||
|
@ -969,7 +969,7 @@ union lang_tree_node
|
|||
that specifies if this decl is definitively assigned.
|
||||
The value -1 means the variable has been definitely assigned (and not
|
||||
definitely unassigned). The value -2 means we already reported an error. */
|
||||
#define DECL_BIT_INDEX(DECL) VAR_OR_FIELD_CHECK (DECL)->decl.pointer_alias_set
|
||||
#define DECL_BIT_INDEX(DECL) VAR_OR_FIELD_CHECK (DECL)->decl_common.pointer_alias_set
|
||||
|
||||
/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
|
||||
struct lang_decl_func GTY(())
|
||||
|
|
|
@ -126,6 +126,7 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *);
|
|||
#define LANG_HOOKS_BUILTIN_FUNCTION builtin_function
|
||||
#define LANG_HOOKS_EXPR_TO_DECL lhd_expr_to_decl
|
||||
#define LANG_HOOKS_TO_TARGET_CHARSET lhd_to_target_charset
|
||||
#define LANG_HOOKS_INIT_TS lhd_do_nothing
|
||||
|
||||
#define LANG_HOOKS_FUNCTION_INIT lhd_do_nothing_f
|
||||
#define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f
|
||||
|
@ -301,6 +302,7 @@ extern tree lhd_make_node (enum tree_code);
|
|||
LANG_HOOKS_GIMPLIFY_EXPR, \
|
||||
LANG_HOOKS_FOLD_OBJ_TYPE_REF, \
|
||||
LANG_HOOKS_BUILTIN_FUNCTION, \
|
||||
LANG_HOOKS_INIT_TS, \
|
||||
LANG_HOOKS_EXPR_TO_DECL, \
|
||||
}
|
||||
|
||||
|
|
|
@ -412,6 +412,9 @@ struct lang_hooks
|
|||
enum built_in_class bt_class,
|
||||
const char *library_name, tree attrs);
|
||||
|
||||
/* Used to set up the tree_contains_structure array for a frontend. */
|
||||
void (*init_ts) (void);
|
||||
|
||||
/* Called by recompute_tree_invarant_for_addr_expr to go from EXPR
|
||||
to a contained expression or DECL, possibly updating *TC, *TI or
|
||||
*SE if in the process TREE_CONSTANT, TREE_INVARIANT or
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
2005-07-08 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is
|
||||
removed.
|
||||
* objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common.
|
||||
(KEYWORD_KEY_NAME): Use decl_minimal.
|
||||
(METHOD_SEL_NAME): Ditto..
|
||||
(METHOD_SEL_ARGS): Use decl_non_common.
|
||||
(METHOD_ADD_ARGS): Ditto.
|
||||
(METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common.
|
||||
(METHOD_DEFINITION): Ditto.
|
||||
(METHOD_ENCODING): Ditto.
|
||||
* objc-lang.c: (objc_init_ts): New function.
|
||||
|
||||
2005-07-07 Ziemowit Laski <zlaski@apple.com>
|
||||
|
||||
* objc-act.c (objc_build_struct): Pass in an actual @interface
|
||||
|
|
|
@ -8244,7 +8244,6 @@ objc_push_parm (tree parm)
|
|||
else if (TREE_CODE (TREE_TYPE (parm)) == FUNCTION_TYPE)
|
||||
TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (parm));
|
||||
|
||||
DECL_ARG_TYPE_AS_WRITTEN (parm) = TREE_TYPE (parm);
|
||||
DECL_ARG_TYPE (parm)
|
||||
= lang_hooks.types.type_promotes_to (TREE_TYPE (parm));
|
||||
|
||||
|
|
|
@ -44,16 +44,16 @@ enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *);
|
|||
#define OBJC_INFO_SLOT_ELTS 2
|
||||
|
||||
/* KEYWORD_DECL */
|
||||
#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl.name)
|
||||
#define KEYWORD_ARG_NAME(DECL) ((DECL)->decl.arguments)
|
||||
#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl_minimal.name)
|
||||
#define KEYWORD_ARG_NAME(DECL) ((DECL)->decl_non_common.arguments)
|
||||
|
||||
/* INSTANCE_METHOD_DECL, CLASS_METHOD_DECL */
|
||||
#define METHOD_SEL_NAME(DECL) ((DECL)->decl.name)
|
||||
#define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments)
|
||||
#define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result)
|
||||
#define METHOD_ADD_ARGS_ELLIPSIS_P(DECL) ((DECL)->decl.lang_flag_0)
|
||||
#define METHOD_DEFINITION(DECL) ((DECL)->decl.initial)
|
||||
#define METHOD_ENCODING(DECL) ((DECL)->decl.context)
|
||||
#define METHOD_SEL_NAME(DECL) ((DECL)->decl_minimal.name)
|
||||
#define METHOD_SEL_ARGS(DECL) ((DECL)->decl_non_common.arguments)
|
||||
#define METHOD_ADD_ARGS(DECL) ((DECL)->decl_non_common.result)
|
||||
#define METHOD_ADD_ARGS_ELLIPSIS_P(DECL) ((DECL)->decl_common.lang_flag_0)
|
||||
#define METHOD_DEFINITION(DECL) ((DECL)->decl_common.initial)
|
||||
#define METHOD_ENCODING(DECL) ((DECL)->decl_minimal.context)
|
||||
|
||||
/* CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
|
||||
CATEGORY_INTERFACE_TYPE, CATEGORY_IMPLEMENTATION_TYPE,
|
||||
|
|
|
@ -34,6 +34,7 @@ Boston, MA 02110-1301, USA. */
|
|||
#include "c-objc-common.h"
|
||||
|
||||
enum c_language_kind c_language = clk_objc;
|
||||
static void objc_init_ts (void);
|
||||
|
||||
/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
|
||||
consequently, there should be very few hooks below. */
|
||||
|
@ -48,6 +49,8 @@ enum c_language_kind c_language = clk_objc;
|
|||
#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
|
||||
#undef LANG_HOOKS_GET_CALLEE_FNDECL
|
||||
#define LANG_HOOKS_GET_CALLEE_FNDECL objc_get_callee_fndecl
|
||||
#undef LANG_HOOKS_INIT_TS
|
||||
#define LANG_HOOKS_INIT_TS objc_init_ts
|
||||
|
||||
/* Each front end provides its own lang hook initializer. */
|
||||
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
|
||||
|
@ -97,6 +100,30 @@ const char * const tree_code_name[] = {
|
|||
/* Lang hook routines common to C and ObjC appear in c-objc-common.c;
|
||||
there should be very few (if any) routines below. */
|
||||
|
||||
static void
|
||||
objc_init_ts (void)
|
||||
{
|
||||
tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[KEYWORD_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
|
||||
tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[KEYWORD_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
|
||||
tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[KEYWORD_DECL][TS_DECL_WRTL] = 1;
|
||||
|
||||
tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[KEYWORD_DECL][TS_DECL_MINIMAL] = 1;
|
||||
|
||||
tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[KEYWORD_DECL][TS_DECL_COMMON] = 1;
|
||||
}
|
||||
|
||||
void
|
||||
finish_file (void)
|
||||
{
|
||||
|
|
|
@ -137,7 +137,7 @@ rest_of_decl_compilation (tree decl,
|
|||
|
||||
/* Can't defer this, because it needs to happen before any
|
||||
later function definitions are processed. */
|
||||
if (DECL_REGISTER (decl) && DECL_ASSEMBLER_NAME_SET_P (decl))
|
||||
if (DECL_ASSEMBLER_NAME_SET_P (decl) && DECL_REGISTER (decl))
|
||||
make_decl_rtl (decl);
|
||||
|
||||
/* Forward declarations for nested functions are not "external",
|
||||
|
|
|
@ -167,11 +167,13 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
int len;
|
||||
int i;
|
||||
expanded_location xloc;
|
||||
enum tree_code code;
|
||||
|
||||
if (node == 0)
|
||||
return;
|
||||
|
||||
class = TREE_CODE_CLASS (TREE_CODE (node));
|
||||
|
||||
code = TREE_CODE (node);
|
||||
class = TREE_CODE_CLASS (code);
|
||||
|
||||
/* Don't get too deep in nesting. If the user wants to see deeper,
|
||||
it is easy to use the address of a lowest-level node
|
||||
|
@ -319,21 +321,23 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
if (DECL_IGNORED_P (node))
|
||||
fputs (" ignored", file);
|
||||
if (DECL_ABSTRACT (node))
|
||||
fputs (" abstract", file);
|
||||
if (DECL_IN_SYSTEM_HEADER (node))
|
||||
fputs (" in_system_header", file);
|
||||
if (DECL_COMMON (node))
|
||||
fputs (" common", file);
|
||||
fputs (" abstract", file);
|
||||
if (DECL_EXTERNAL (node))
|
||||
fputs (" external", file);
|
||||
if (DECL_WEAK (node))
|
||||
fputs (" weak", file);
|
||||
if (DECL_REGISTER (node) && TREE_CODE (node) != FIELD_DECL
|
||||
&& TREE_CODE (node) != FUNCTION_DECL
|
||||
&& TREE_CODE (node) != LABEL_DECL)
|
||||
fputs (" regdecl", file);
|
||||
if (DECL_NONLOCAL (node))
|
||||
fputs (" nonlocal", file);
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
{
|
||||
if (DECL_WEAK (node))
|
||||
fputs (" weak", file);
|
||||
if (DECL_IN_SYSTEM_HEADER (node))
|
||||
fputs (" in_system_header", file);
|
||||
}
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
|
||||
&& TREE_CODE (node) != LABEL_DECL
|
||||
&& TREE_CODE (node) != FUNCTION_DECL
|
||||
&& DECL_REGISTER (node))
|
||||
fputs (" regdecl", file);
|
||||
|
||||
if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
|
||||
fputs (" suppress-debug", file);
|
||||
|
@ -357,6 +361,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
|
||||
if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
|
||||
fputs (" in-text-section", file);
|
||||
if (TREE_CODE (node) == VAR_DECL && DECL_COMMON (node))
|
||||
fputs (" common", file);
|
||||
if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL_P (node))
|
||||
{
|
||||
enum tls_model kind = DECL_TLS_MODEL (node);
|
||||
|
@ -384,7 +390,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
|
||||
if (DECL_VIRTUAL_P (node))
|
||||
fputs (" virtual", file);
|
||||
if (DECL_DEFER_OUTPUT (node))
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
|
||||
fputs (" defer-output", file);
|
||||
|
||||
if (DECL_PRESERVE_P (node))
|
||||
|
@ -450,13 +456,20 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
}
|
||||
|
||||
print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
|
||||
|
||||
print_node_brief (file, "attributes",
|
||||
DECL_ATTRIBUTES (node), indent + 4);
|
||||
print_node_brief (file, "abstract_origin",
|
||||
DECL_ABSTRACT_ORIGIN (node), indent + 4);
|
||||
|
||||
print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
|
||||
print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
|
||||
{
|
||||
print_node_brief (file, "abstract_origin",
|
||||
DECL_ABSTRACT_ORIGIN (node), indent + 4);
|
||||
}
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
|
||||
{
|
||||
print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
|
||||
print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
|
||||
}
|
||||
print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
|
||||
|
||||
lang_hooks.print_decl (file, node, indent);
|
||||
|
@ -470,8 +483,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
if (TREE_CODE (node) == PARM_DECL)
|
||||
{
|
||||
print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
|
||||
print_node (file, "arg-type-as-written",
|
||||
DECL_ARG_TYPE_AS_WRITTEN (node), indent + 4);
|
||||
|
||||
if (DECL_INCOMING_RTL (node) != 0)
|
||||
{
|
||||
|
|
|
@ -704,7 +704,8 @@ wrapup_global_declarations (tree *vec, int len)
|
|||
|
||||
/* We're not deferring this any longer. Assignment is
|
||||
conditional to avoid needlessly dirtying PCH pages. */
|
||||
if (DECL_DEFER_OUTPUT (decl) != 0)
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
|
||||
&& DECL_DEFER_OUTPUT (decl) != 0)
|
||||
DECL_DEFER_OUTPUT (decl) = 0;
|
||||
|
||||
if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
|
||||
|
|
|
@ -313,13 +313,6 @@ browse_tree (tree begin)
|
|||
TB_WF;
|
||||
break;
|
||||
|
||||
case TB_ARG_TYPE_AS_WRITTEN:
|
||||
if (head && TREE_CODE (head) == PARM_DECL)
|
||||
TB_SET_HEAD (DECL_ARG_TYPE_AS_WRITTEN (head));
|
||||
else
|
||||
TB_WF;
|
||||
break;
|
||||
|
||||
case TB_ARG_TYPE:
|
||||
if (head && TREE_CODE (head) == PARM_DECL)
|
||||
TB_SET_HEAD (DECL_ARG_TYPE (head));
|
||||
|
|
|
@ -209,9 +209,6 @@ remap_decl (tree decl, inline_data *id)
|
|||
TREE_TYPE (t) = remap_type (TREE_TYPE (t), id);
|
||||
if (TREE_CODE (t) == TYPE_DECL)
|
||||
DECL_ORIGINAL_TYPE (t) = remap_type (DECL_ORIGINAL_TYPE (t), id);
|
||||
else if (TREE_CODE (t) == PARM_DECL)
|
||||
DECL_ARG_TYPE_AS_WRITTEN (t)
|
||||
= remap_type (DECL_ARG_TYPE_AS_WRITTEN (t), id);
|
||||
|
||||
/* Remap sizes as necessary. */
|
||||
walk_tree (&DECL_SIZE (t), copy_body_r, id, NULL);
|
||||
|
|
|
@ -1578,7 +1578,7 @@ print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
|
|||
if (TREE_CODE (t) == TYPE_DECL)
|
||||
pp_string (buffer, "typedef ");
|
||||
|
||||
if (DECL_REGISTER (t))
|
||||
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
|
||||
pp_string (buffer, "register ");
|
||||
|
||||
if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
|
||||
|
|
|
@ -111,7 +111,7 @@ expr_computes_nonzero (tree expr)
|
|||
has requested not to remove NULL pointer checks. */
|
||||
if (flag_delete_null_pointer_checks
|
||||
&& TREE_CODE (expr) == ADDR_EXPR
|
||||
&& DECL_P (TREE_OPERAND (expr, 0))
|
||||
&& VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (expr, 0))
|
||||
&& !DECL_WEAK (TREE_OPERAND (expr, 0)))
|
||||
return true;
|
||||
|
||||
|
|
237
gcc/tree.c
237
gcc/tree.c
|
@ -133,12 +133,6 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
|
|||
|
||||
/* General tree->tree mapping structure for use in hash tables. */
|
||||
|
||||
struct tree_map GTY(())
|
||||
{
|
||||
hashval_t hash;
|
||||
tree from;
|
||||
tree to;
|
||||
};
|
||||
|
||||
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
|
||||
htab_t debug_expr_for_decl;
|
||||
|
@ -146,11 +140,20 @@ static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
|
|||
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
|
||||
htab_t value_expr_for_decl;
|
||||
|
||||
static GTY ((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map)))
|
||||
htab_t init_priority_for_decl;
|
||||
|
||||
struct tree_int_map GTY(())
|
||||
{
|
||||
tree from;
|
||||
unsigned short to;
|
||||
};
|
||||
static unsigned int tree_int_map_hash (const void *);
|
||||
static int tree_int_map_eq (const void *, const void *);
|
||||
static int tree_int_map_marked_p (const void *);
|
||||
static void set_type_quals (tree, int);
|
||||
static int type_hash_eq (const void *, const void *);
|
||||
static hashval_t type_hash_hash (const void *);
|
||||
static int tree_map_eq (const void *, const void *);
|
||||
static hashval_t tree_map_hash (const void *);
|
||||
static hashval_t int_cst_hash_hash (const void *);
|
||||
static int int_cst_hash_eq (const void *, const void *);
|
||||
static void print_type_hash_statistics (void);
|
||||
|
@ -158,19 +161,20 @@ static void print_debug_expr_statistics (void);
|
|||
static void print_value_expr_statistics (void);
|
||||
static tree make_vector_type (tree, int, enum machine_mode);
|
||||
static int type_hash_marked_p (const void *);
|
||||
static int tree_map_marked_p (const void *);
|
||||
static unsigned int type_hash_list (tree, hashval_t);
|
||||
static unsigned int attribute_hash_list (tree, hashval_t);
|
||||
|
||||
tree global_trees[TI_MAX];
|
||||
tree integer_types[itk_none];
|
||||
|
||||
unsigned char tree_contains_struct[256][64];
|
||||
|
||||
/* Init tree.c. */
|
||||
|
||||
void
|
||||
init_ttree (void)
|
||||
{
|
||||
|
||||
/* Initialize the hash table of types. */
|
||||
type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash,
|
||||
type_hash_eq, 0);
|
||||
|
@ -180,12 +184,62 @@ init_ttree (void)
|
|||
|
||||
value_expr_for_decl = htab_create_ggc (512, tree_map_hash,
|
||||
tree_map_eq, 0);
|
||||
init_priority_for_decl = htab_create_ggc (512, tree_int_map_hash,
|
||||
tree_int_map_eq, 0);
|
||||
|
||||
int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash,
|
||||
int_cst_hash_eq, NULL);
|
||||
|
||||
int_cst_node = make_node (INTEGER_CST);
|
||||
|
||||
tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON] = 1;
|
||||
|
||||
|
||||
tree_contains_struct[CONST_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[VAR_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[PARM_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[RESULT_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[FUNCTION_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[TYPE_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[LABEL_DECL][TS_DECL_COMMON] = 1;
|
||||
tree_contains_struct[FIELD_DECL][TS_DECL_COMMON] = 1;
|
||||
|
||||
|
||||
tree_contains_struct[CONST_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[VAR_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[PARM_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[RESULT_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[FUNCTION_DECL][TS_DECL_WRTL] = 1;
|
||||
tree_contains_struct[LABEL_DECL][TS_DECL_WRTL] = 1;
|
||||
|
||||
tree_contains_struct[CONST_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[VAR_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[PARM_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[RESULT_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[FUNCTION_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[TYPE_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[LABEL_DECL][TS_DECL_MINIMAL] = 1;
|
||||
tree_contains_struct[FIELD_DECL][TS_DECL_MINIMAL] = 1;
|
||||
|
||||
tree_contains_struct[VAR_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[FUNCTION_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[TYPE_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_WITH_VIS] = 1;
|
||||
|
||||
tree_contains_struct[VAR_DECL][TS_VAR_DECL] = 1;
|
||||
tree_contains_struct[FIELD_DECL][TS_FIELD_DECL] = 1;
|
||||
tree_contains_struct[PARM_DECL][TS_PARM_DECL] = 1;
|
||||
tree_contains_struct[LABEL_DECL][TS_LABEL_DECL] = 1;
|
||||
tree_contains_struct[RESULT_DECL][TS_RESULT_DECL] = 1;
|
||||
tree_contains_struct[CONST_DECL][TS_CONST_DECL] = 1;
|
||||
tree_contains_struct[TYPE_DECL][TS_TYPE_DECL] = 1;
|
||||
tree_contains_struct[FUNCTION_DECL][TS_FUNCTION_DECL] = 1;
|
||||
|
||||
lang_hooks.init_ts ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,7 +251,7 @@ decl_assembler_name (tree decl)
|
|||
{
|
||||
if (!DECL_ASSEMBLER_NAME_SET_P (decl))
|
||||
lang_hooks.set_decl_assembler_name (decl);
|
||||
return DECL_CHECK (decl)->decl.assembler_name;
|
||||
return DECL_WITH_VIS_CHECK (decl)->decl_with_vis.assembler_name;
|
||||
}
|
||||
|
||||
/* Compute the number of bytes occupied by a tree with code CODE.
|
||||
|
@ -209,7 +263,29 @@ tree_code_size (enum tree_code code)
|
|||
switch (TREE_CODE_CLASS (code))
|
||||
{
|
||||
case tcc_declaration: /* A decl node */
|
||||
return sizeof (struct tree_decl);
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case FIELD_DECL:
|
||||
return sizeof (struct tree_field_decl);
|
||||
case PARM_DECL:
|
||||
return sizeof (struct tree_parm_decl);
|
||||
case VAR_DECL:
|
||||
return sizeof (struct tree_var_decl);
|
||||
case LABEL_DECL:
|
||||
return sizeof (struct tree_label_decl);
|
||||
case RESULT_DECL:
|
||||
return sizeof (struct tree_result_decl);
|
||||
case CONST_DECL:
|
||||
return sizeof (struct tree_const_decl);
|
||||
case TYPE_DECL:
|
||||
return sizeof (struct tree_type_decl);
|
||||
case FUNCTION_DECL:
|
||||
return sizeof (struct tree_function_decl);
|
||||
default:
|
||||
return sizeof (struct tree_decl_non_common);
|
||||
}
|
||||
}
|
||||
|
||||
case tcc_type: /* a type node */
|
||||
return sizeof (struct tree_type);
|
||||
|
@ -395,12 +471,13 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
|
|||
if (code != FUNCTION_DECL)
|
||||
DECL_ALIGN (t) = 1;
|
||||
DECL_USER_ALIGN (t) = 0;
|
||||
DECL_IN_SYSTEM_HEADER (t) = in_system_header;
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
DECL_IN_SYSTEM_HEADER (t) = in_system_header;
|
||||
/* We have not yet computed the alias set for this declaration. */
|
||||
DECL_POINTER_ALIAS_SET (t) = -1;
|
||||
DECL_SOURCE_LOCATION (t) = input_location;
|
||||
DECL_UID (t) = next_decl_uid++;
|
||||
|
||||
/* We have not yet computed the alias set for this declaration. */
|
||||
DECL_POINTER_ALIAS_SET (t) = -1;
|
||||
break;
|
||||
|
||||
case tcc_type:
|
||||
|
@ -480,6 +557,11 @@ copy_node_stat (tree node MEM_STAT_DECL)
|
|||
SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (node));
|
||||
DECL_HAS_VALUE_EXPR_P (t) = 1;
|
||||
}
|
||||
if (TREE_CODE (node) == VAR_DECL && DECL_HAS_INIT_PRIORITY_P (node))
|
||||
{
|
||||
SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node));
|
||||
DECL_HAS_INIT_PRIORITY_P (t) = 1;
|
||||
}
|
||||
|
||||
}
|
||||
else if (TREE_CODE_CLASS (code) == tcc_type)
|
||||
|
@ -1814,9 +1896,31 @@ tree_node_structure (tree t)
|
|||
enum tree_code code = TREE_CODE (t);
|
||||
|
||||
switch (TREE_CODE_CLASS (code))
|
||||
{
|
||||
{
|
||||
case tcc_declaration:
|
||||
return TS_DECL;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case FIELD_DECL:
|
||||
return TS_FIELD_DECL;
|
||||
case PARM_DECL:
|
||||
return TS_PARM_DECL;
|
||||
case VAR_DECL:
|
||||
return TS_VAR_DECL;
|
||||
case LABEL_DECL:
|
||||
return TS_LABEL_DECL;
|
||||
case RESULT_DECL:
|
||||
return TS_RESULT_DECL;
|
||||
case CONST_DECL:
|
||||
return TS_CONST_DECL;
|
||||
case TYPE_DECL:
|
||||
return TS_TYPE_DECL;
|
||||
case FUNCTION_DECL:
|
||||
return TS_FUNCTION_DECL;
|
||||
default:
|
||||
return TS_DECL_NON_COMMON;
|
||||
}
|
||||
}
|
||||
case tcc_type:
|
||||
return TS_TYPE;
|
||||
case tcc_reference:
|
||||
|
@ -2877,10 +2981,13 @@ build_decl_stat (enum tree_code code, tree name, tree type MEM_STAT_DECL)
|
|||
else if (code == FUNCTION_DECL)
|
||||
DECL_MODE (t) = FUNCTION_MODE;
|
||||
|
||||
/* Set default visibility to whatever the user supplied with
|
||||
visibility_specified depending on #pragma GCC visibility. */
|
||||
DECL_VISIBILITY (t) = default_visibility;
|
||||
DECL_VISIBILITY_SPECIFIED (t) = visibility_options.inpragma;
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
|
||||
{
|
||||
/* Set default visibility to whatever the user supplied with
|
||||
visibility_specified depending on #pragma GCC visibility. */
|
||||
DECL_VISIBILITY (t) = default_visibility;
|
||||
DECL_VISIBILITY_SPECIFIED (t) = visibility_options.inpragma;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -3513,7 +3620,7 @@ build_variant_type_copy (tree type)
|
|||
|
||||
/* Return true if the from tree in both tree maps are equal. */
|
||||
|
||||
static int
|
||||
int
|
||||
tree_map_eq (const void *va, const void *vb)
|
||||
{
|
||||
const struct tree_map *a = va, *b = vb;
|
||||
|
@ -3522,7 +3629,7 @@ tree_map_eq (const void *va, const void *vb)
|
|||
|
||||
/* Hash a from tree in a tree_map. */
|
||||
|
||||
static hashval_t
|
||||
unsigned int
|
||||
tree_map_hash (const void *item)
|
||||
{
|
||||
return (((const struct tree_map *) item)->hash);
|
||||
|
@ -3532,7 +3639,7 @@ tree_map_hash (const void *item)
|
|||
purposes. We simply return true if the from tree is marked, so that this
|
||||
structure goes away when the from tree goes away. */
|
||||
|
||||
static int
|
||||
int
|
||||
tree_map_marked_p (const void *p)
|
||||
{
|
||||
tree from = ((struct tree_map *) p)->from;
|
||||
|
@ -3540,6 +3647,65 @@ tree_map_marked_p (const void *p)
|
|||
return ggc_marked_p (from);
|
||||
}
|
||||
|
||||
/* Return true if the trees in the tree_int_map *'s VA and VB are equal. */
|
||||
|
||||
static int
|
||||
tree_int_map_eq (const void *va, const void *vb)
|
||||
{
|
||||
const struct tree_int_map *a = va, *b = vb;
|
||||
return (a->from == b->from);
|
||||
}
|
||||
|
||||
/* Hash a from tree in the tree_int_map * ITEM. */
|
||||
|
||||
static unsigned int
|
||||
tree_int_map_hash (const void *item)
|
||||
{
|
||||
return htab_hash_pointer (((const struct tree_int_map *)item)->from);
|
||||
}
|
||||
|
||||
/* Return true if this tree int map structure is marked for garbage collection
|
||||
purposes. We simply return true if the from tree_int_map *P's from tree is marked, so that this
|
||||
structure goes away when the from tree goes away. */
|
||||
|
||||
static int
|
||||
tree_int_map_marked_p (const void *p)
|
||||
{
|
||||
tree from = ((struct tree_int_map *) p)->from;
|
||||
|
||||
return ggc_marked_p (from);
|
||||
}
|
||||
/* Lookup an init priority for FROM, and return it if we find one. */
|
||||
|
||||
unsigned short
|
||||
decl_init_priority_lookup (tree from)
|
||||
{
|
||||
struct tree_int_map *h, in;
|
||||
in.from = from;
|
||||
|
||||
h = htab_find_with_hash (init_priority_for_decl,
|
||||
&in, htab_hash_pointer (from));
|
||||
if (h)
|
||||
return h->to;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Insert a mapping FROM->TO in the init priority hashtable. */
|
||||
|
||||
void
|
||||
decl_init_priority_insert (tree from, unsigned short to)
|
||||
{
|
||||
struct tree_int_map *h;
|
||||
void **loc;
|
||||
|
||||
h = ggc_alloc (sizeof (struct tree_int_map));
|
||||
h->from = from;
|
||||
h->to = to;
|
||||
loc = htab_find_slot_with_hash (init_priority_for_decl, h,
|
||||
htab_hash_pointer (from), INSERT);
|
||||
*(struct tree_int_map **) loc = h;
|
||||
}
|
||||
|
||||
/* Print out the statistics for the DECL_DEBUG_EXPR hash table. */
|
||||
|
||||
static void
|
||||
|
@ -5664,6 +5830,31 @@ tree_class_check_failed (const tree node, const enum tree_code_class cl,
|
|||
TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
|
||||
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
|
||||
}
|
||||
#undef DEFTREESTRUCT
|
||||
#define DEFTREESTRUCT(VAL, NAME) NAME,
|
||||
|
||||
static const char *ts_enum_names[] = {
|
||||
#include "treestruct.def"
|
||||
};
|
||||
#undef DEFTREESTRUCT
|
||||
|
||||
#define TS_ENUM_NAME(EN) (ts_enum_names[(EN)])
|
||||
|
||||
/* Similar to tree_class_check_failed, except that we check for
|
||||
whether CODE contains the tree structure identified by EN. */
|
||||
|
||||
void
|
||||
tree_contains_struct_check_failed (const tree node,
|
||||
const enum tree_node_structure_enum en,
|
||||
const char *file, int line,
|
||||
const char *function)
|
||||
{
|
||||
internal_error
|
||||
("tree check: expected tree that contains %qs structure, have %qs in %s, at %s:%d",
|
||||
TS_ENUM_NAME(en),
|
||||
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
|
||||
}
|
||||
|
||||
|
||||
/* Similar to above, except that the check is for the bounds of a TREE_VEC's
|
||||
(dynamically sized) vector. */
|
||||
|
|
1260
gcc/tree.h
1260
gcc/tree.h
File diff suppressed because it is too large
Load diff
60
gcc/treestruct.def
Normal file
60
gcc/treestruct.def
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* This file contains the definitions for the tree structure
|
||||
enumeration used in GCC.
|
||||
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GCC; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* The format of this file is
|
||||
DEFTREESTRUCT(enumeration value, printable name).
|
||||
Each enumeration value should correspond with a single member of union
|
||||
tree_node.
|
||||
These enumerator values are used in order to distinguish members of union
|
||||
tree_node for garbage collection purposes, as well as specifying what structures
|
||||
contain what other structures in the tree_contains_struct array. */
|
||||
|
||||
DEFTREESTRUCT(TS_COMMON, "common")
|
||||
DEFTREESTRUCT(TS_INT_CST, "integer cst")
|
||||
DEFTREESTRUCT(TS_REAL_CST, "real cst")
|
||||
DEFTREESTRUCT(TS_VECTOR, "vector")
|
||||
DEFTREESTRUCT(TS_STRING, "string")
|
||||
DEFTREESTRUCT(TS_COMPLEX, "complex")
|
||||
DEFTREESTRUCT(TS_IDENTIFIER, "indentifier")
|
||||
DEFTREESTRUCT(TS_DECL_MINIMAL, "decl minimal")
|
||||
DEFTREESTRUCT(TS_DECL_COMMON, "decl common")
|
||||
DEFTREESTRUCT(TS_DECL_WRTL, "decl with RTL")
|
||||
DEFTREESTRUCT(TS_DECL_NON_COMMON, "decl non-common")
|
||||
DEFTREESTRUCT(TS_DECL_WITH_VIS, "decl with visibility")
|
||||
DEFTREESTRUCT(TS_FIELD_DECL, "field decl")
|
||||
DEFTREESTRUCT(TS_VAR_DECL, "var decl")
|
||||
DEFTREESTRUCT(TS_PARM_DECL, "parm decl")
|
||||
DEFTREESTRUCT(TS_LABEL_DECL, "label decl")
|
||||
DEFTREESTRUCT(TS_RESULT_DECL, "result decl")
|
||||
DEFTREESTRUCT(TS_CONST_DECL, "const decl")
|
||||
DEFTREESTRUCT(TS_TYPE_DECL, "label decl")
|
||||
DEFTREESTRUCT(TS_FUNCTION_DECL, "function decl")
|
||||
DEFTREESTRUCT(TS_TYPE, "type")
|
||||
DEFTREESTRUCT(TS_LIST, "list")
|
||||
DEFTREESTRUCT(TS_VEC, "vec")
|
||||
DEFTREESTRUCT(TS_EXP, "exp")
|
||||
DEFTREESTRUCT(TS_SSA_NAME, "ssa name")
|
||||
DEFTREESTRUCT(TS_PHI_NODE, "phi node")
|
||||
DEFTREESTRUCT(TS_BLOCK, "block")
|
||||
DEFTREESTRUCT(TS_BINFO, "binfo")
|
||||
DEFTREESTRUCT(TS_STATEMENT_LIST, "statement list")
|
||||
DEFTREESTRUCT(TS_VALUE_HANDLE, "value handle")
|
Loading…
Add table
Reference in a new issue