[PATCH] some tree struct marking

https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00697.html
	gcc/
	* tree.h (MARK_TS_TYPE_NON_COMMON): New.
	* tree.c (tree_node_structure_for_code): Reformat and alphabetize.

	gcc/cp/
	* c-objcp-common.c (cp-objcp-common.c): Alphababetize and
	correctly mark all C++ nodes.

From-SVN: r275641
This commit is contained in:
Nathan Sidwell 2019-09-11 11:28:00 +00:00 committed by Nathan Sidwell
parent 5a307ee54b
commit 7994803c00
6 changed files with 154 additions and 140 deletions

View File

@ -1,3 +1,8 @@
2019-09-11 Nathan Sidwell <nathan@acm.org>
* tree.h (MARK_TS_TYPE_NON_COMMON): New.
* tree.c (tree_node_structure_for_code): Reformat and alphabetize.
2019-09-11 Richard Biener <rguenther@suse.de>
* lto-opts.c (lto_write_options): Stream -g when debug is enabled.

View File

@ -1,3 +1,9 @@
2019-09-11 Nathan Sidwell <nathan@acm.org>
* c-objcp-common.c (cp-objcp-common.c): Alphababetize and
correctly mark all C++ nodes.
* decl.c (cp_tree_node_structure): Alphabetize.
2019-09-10 Marek Polacek <polacek@redhat.com>
PR c++/91673 - ICE with noexcept in alias-declaration.

View File

@ -365,104 +365,113 @@ cp_register_dumps (gcc::dump_manager *dumps)
void
cp_common_init_ts (void)
{
MARK_TS_DECL_NON_COMMON (USING_DECL);
/* With type. */
MARK_TS_TYPED (PTRMEM_CST);
MARK_TS_TYPED (LAMBDA_EXPR);
MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
/* Random new trees. */
MARK_TS_COMMON (BASELINK);
MARK_TS_COMMON (DECLTYPE_TYPE);
MARK_TS_COMMON (OVERLOAD);
MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
MARK_TS_COMMON (TYPENAME_TYPE);
MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
MARK_TS_COMMON (UNDERLYING_TYPE);
/* New decls. */
MARK_TS_DECL_COMMON (TEMPLATE_DECL);
MARK_TS_DECL_COMMON (WILDCARD_DECL);
MARK_TS_COMMON (TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (TEMPLATE_TYPE_PARM);
MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
MARK_TS_COMMON (OVERLOAD);
MARK_TS_COMMON (TYPENAME_TYPE);
MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (UNDERLYING_TYPE);
MARK_TS_COMMON (BASELINK);
MARK_TS_COMMON (TYPE_PACK_EXPANSION);
MARK_TS_COMMON (TYPE_ARGUMENT_PACK);
MARK_TS_COMMON (DECLTYPE_TYPE);
MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
MARK_TS_DECL_NON_COMMON (USING_DECL);
MARK_TS_TYPED (SWITCH_STMT);
MARK_TS_TYPED (IF_STMT);
MARK_TS_TYPED (FOR_STMT);
MARK_TS_TYPED (RANGE_FOR_STMT);
MARK_TS_TYPED (EH_SPEC_BLOCK);
MARK_TS_TYPED (CLEANUP_STMT);
MARK_TS_TYPED (SCOPE_REF);
MARK_TS_TYPED (TRY_BLOCK);
MARK_TS_TYPED (HANDLER);
MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
MARK_TS_TYPED (NOEXCEPT_EXPR);
MARK_TS_TYPED (WHILE_STMT);
MARK_TS_TYPED (BREAK_STMT);
MARK_TS_TYPED (DO_STMT);
MARK_TS_TYPED (CONTINUE_STMT);
MARK_TS_TYPED (PTRMEM_CST);
MARK_TS_TYPED (USING_STMT);
MARK_TS_TYPED (OMP_DEPOBJ);
/* New Types. */
MARK_TS_TYPE_NON_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
MARK_TS_TYPE_NON_COMMON (TEMPLATE_TEMPLATE_PARM);
MARK_TS_TYPE_NON_COMMON (TEMPLATE_TYPE_PARM);
MARK_TS_TYPE_NON_COMMON (TYPE_ARGUMENT_PACK);
MARK_TS_TYPE_NON_COMMON (TYPE_PACK_EXPANSION);
MARK_TS_EXP (AGGR_INIT_EXPR);
MARK_TS_EXP (CTOR_INITIALIZER);
MARK_TS_EXP (EXPR_STMT);
MARK_TS_EXP (TAG_DEFN);
MARK_TS_EXP (EMPTY_CLASS_EXPR);
MARK_TS_EXP (MODOP_EXPR);
MARK_TS_EXP (THROW_EXPR);
MARK_TS_EXP (CAST_EXPR);
MARK_TS_EXP (TYPE_EXPR);
MARK_TS_EXP (REINTERPRET_CAST_EXPR);
MARK_TS_EXP (CONST_CAST_EXPR);
MARK_TS_EXP (STATIC_CAST_EXPR);
MARK_TS_EXP (DYNAMIC_CAST_EXPR);
MARK_TS_EXP (IMPLICIT_CONV_EXPR);
MARK_TS_EXP (TEMPLATE_ID_EXPR);
MARK_TS_EXP (ARROW_EXPR);
MARK_TS_EXP (UNARY_PLUS_EXPR);
MARK_TS_EXP (TRAIT_EXPR);
/* Statements. */
MARK_TS_EXP (BREAK_STMT);
MARK_TS_EXP (CLEANUP_STMT);
MARK_TS_EXP (CONTINUE_STMT);
MARK_TS_EXP (DO_STMT);
MARK_TS_EXP (EH_SPEC_BLOCK);
MARK_TS_EXP (FOR_STMT);
MARK_TS_EXP (HANDLER);
MARK_TS_EXP (IF_STMT);
MARK_TS_EXP (OMP_DEPOBJ);
MARK_TS_EXP (RANGE_FOR_STMT);
MARK_TS_EXP (SWITCH_STMT);
MARK_TS_EXP (TRY_BLOCK);
MARK_TS_EXP (USING_STMT);
MARK_TS_EXP (WHILE_STMT);
MARK_TS_EXP (NON_DEPENDENT_EXPR);
MARK_TS_EXP (NEW_EXPR);
MARK_TS_EXP (VEC_NEW_EXPR);
MARK_TS_EXP (MEMBER_REF);
MARK_TS_EXP (DOTSTAR_EXPR);
MARK_TS_EXP (DELETE_EXPR);
MARK_TS_EXP (VEC_DELETE_EXPR);
MARK_TS_EXP (PSEUDO_DTOR_EXPR);
MARK_TS_EXP (TYPEID_EXPR);
MARK_TS_EXP (MUST_NOT_THROW_EXPR);
MARK_TS_EXP (STMT_EXPR);
MARK_TS_EXP (OFFSET_REF);
MARK_TS_EXP (OFFSETOF_EXPR);
/* Random expressions. */
MARK_TS_EXP (ADDRESSOF_EXPR);
MARK_TS_EXP (VEC_INIT_EXPR);
MARK_TS_EXP (LAMBDA_EXPR);
MARK_TS_EXP (AGGR_INIT_EXPR);
MARK_TS_EXP (ALIGNOF_EXPR);
MARK_TS_EXP (ARROW_EXPR);
MARK_TS_EXP (AT_ENCODE_EXPR);
MARK_TS_EXP (CAST_EXPR);
MARK_TS_EXP (CONST_CAST_EXPR);
MARK_TS_EXP (CTOR_INITIALIZER);
MARK_TS_EXP (DELETE_EXPR);
MARK_TS_EXP (DOTSTAR_EXPR);
MARK_TS_EXP (DYNAMIC_CAST_EXPR);
MARK_TS_EXP (EMPTY_CLASS_EXPR);
MARK_TS_EXP (EXPR_STMT);
MARK_TS_EXP (IMPLICIT_CONV_EXPR);
MARK_TS_EXP (MEMBER_REF);
MARK_TS_EXP (MODOP_EXPR);
MARK_TS_EXP (MUST_NOT_THROW_EXPR);
MARK_TS_EXP (NEW_EXPR);
MARK_TS_EXP (NOEXCEPT_EXPR);
MARK_TS_EXP (NON_DEPENDENT_EXPR);
MARK_TS_EXP (OFFSETOF_EXPR);
MARK_TS_EXP (OFFSET_REF);
MARK_TS_EXP (PSEUDO_DTOR_EXPR);
MARK_TS_EXP (REINTERPRET_CAST_EXPR);
MARK_TS_EXP (SCOPE_REF);
MARK_TS_EXP (STATIC_CAST_EXPR);
MARK_TS_EXP (STMT_EXPR);
MARK_TS_EXP (TAG_DEFN);
MARK_TS_EXP (TEMPLATE_ID_EXPR);
MARK_TS_EXP (THROW_EXPR);
MARK_TS_EXP (TRAIT_EXPR);
MARK_TS_EXP (TYPEID_EXPR);
MARK_TS_EXP (TYPE_EXPR);
MARK_TS_EXP (UNARY_PLUS_EXPR);
MARK_TS_EXP (VEC_DELETE_EXPR);
MARK_TS_EXP (VEC_INIT_EXPR);
MARK_TS_EXP (VEC_NEW_EXPR);
MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
MARK_TS_EXP (EXPR_PACK_EXPANSION);
MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
/* Fold expressions. */
MARK_TS_EXP (BINARY_LEFT_FOLD_EXPR);
MARK_TS_EXP (BINARY_RIGHT_FOLD_EXPR);
MARK_TS_EXP (EXPR_PACK_EXPANSION);
MARK_TS_EXP (NONTYPE_ARGUMENT_PACK);
MARK_TS_EXP (UNARY_LEFT_FOLD_EXPR);
MARK_TS_EXP (UNARY_RIGHT_FOLD_EXPR);
/* Constraints. */
MARK_TS_EXP (CHECK_CONSTR);
MARK_TS_EXP (COMPOUND_REQ);
MARK_TS_EXP (CONJ_CONSTR);
MARK_TS_EXP (DEDUCT_CONSTR);
MARK_TS_EXP (DISJ_CONSTR);
MARK_TS_EXP (EXCEPT_CONSTR);
MARK_TS_EXP (EXPR_CONSTR);
MARK_TS_EXP (ICONV_CONSTR);
MARK_TS_EXP (NESTED_REQ);
MARK_TS_EXP (PARM_CONSTR);
MARK_TS_EXP (PRED_CONSTR);
MARK_TS_EXP (REQUIRES_EXPR);
MARK_TS_EXP (SIMPLE_REQ);
MARK_TS_EXP (TYPE_REQ);
MARK_TS_EXP (COMPOUND_REQ);
MARK_TS_EXP (NESTED_REQ);
MARK_TS_EXP (PRED_CONSTR);
MARK_TS_EXP (CHECK_CONSTR);
MARK_TS_EXP (EXPR_CONSTR);
MARK_TS_EXP (TYPE_CONSTR);
MARK_TS_EXP (ICONV_CONSTR);
MARK_TS_EXP (DEDUCT_CONSTR);
MARK_TS_EXP (EXCEPT_CONSTR);
MARK_TS_EXP (PARM_CONSTR);
MARK_TS_EXP (CONJ_CONSTR);
MARK_TS_EXP (DISJ_CONSTR);
MARK_TS_EXP (TYPE_REQ);
c_common_init_ts ();
}

View File

@ -16827,20 +16827,20 @@ cp_tree_node_structure (union lang_tree_node * t)
{
switch (TREE_CODE (&t->generic))
{
case DEFERRED_PARSE: return TS_CP_DEFERRED_PARSE;
case DEFERRED_NOEXCEPT: return TS_CP_DEFERRED_NOEXCEPT;
case IDENTIFIER_NODE: return TS_CP_IDENTIFIER;
case OVERLOAD: return TS_CP_OVERLOAD;
case TEMPLATE_PARM_INDEX: return TS_CP_TPI;
case PTRMEM_CST: return TS_CP_PTRMEM;
case BASELINK: return TS_CP_BASELINK;
case TEMPLATE_DECL: return TS_CP_TEMPLATE_DECL;
case STATIC_ASSERT: return TS_CP_STATIC_ASSERT;
case ARGUMENT_PACK_SELECT: return TS_CP_ARGUMENT_PACK_SELECT;
case TRAIT_EXPR: return TS_CP_TRAIT_EXPR;
case LAMBDA_EXPR: return TS_CP_LAMBDA_EXPR;
case TEMPLATE_INFO: return TS_CP_TEMPLATE_INFO;
case BASELINK: return TS_CP_BASELINK;
case CONSTRAINT_INFO: return TS_CP_CONSTRAINT_INFO;
case DEFERRED_NOEXCEPT: return TS_CP_DEFERRED_NOEXCEPT;
case DEFERRED_PARSE: return TS_CP_DEFERRED_PARSE;
case IDENTIFIER_NODE: return TS_CP_IDENTIFIER;
case LAMBDA_EXPR: return TS_CP_LAMBDA_EXPR;
case OVERLOAD: return TS_CP_OVERLOAD;
case PTRMEM_CST: return TS_CP_PTRMEM;
case STATIC_ASSERT: return TS_CP_STATIC_ASSERT;
case TEMPLATE_DECL: return TS_CP_TEMPLATE_DECL;
case TEMPLATE_INFO: return TS_CP_TEMPLATE_INFO;
case TEMPLATE_PARM_INDEX: return TS_CP_TPI;
case TRAIT_EXPR: return TS_CP_TRAIT_EXPR;
case USERDEF_LITERAL: return TS_CP_USERDEF_LITERAL;
default: return TS_CP_GENERIC;
}

View File

@ -455,71 +455,61 @@ tree_node_structure_for_code (enum tree_code code)
switch (TREE_CODE_CLASS (code))
{
case tcc_declaration:
{
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 DEBUG_EXPR_DECL:
return TS_DECL_WRTL;
case CONST_DECL:
return TS_CONST_DECL;
case TYPE_DECL:
return TS_TYPE_DECL;
case FUNCTION_DECL:
return TS_FUNCTION_DECL;
case TRANSLATION_UNIT_DECL:
return TS_TRANSLATION_UNIT_DECL;
default:
return TS_DECL_NON_COMMON;
}
}
case tcc_type:
return TS_TYPE_NON_COMMON;
case tcc_reference:
case tcc_comparison:
case tcc_unary:
switch (code)
{
case CONST_DECL: return TS_CONST_DECL;
case DEBUG_EXPR_DECL: return TS_DECL_WRTL;
case FIELD_DECL: return TS_FIELD_DECL;
case FUNCTION_DECL: return TS_FUNCTION_DECL;
case LABEL_DECL: return TS_LABEL_DECL;
case PARM_DECL: return TS_PARM_DECL;
case RESULT_DECL: return TS_RESULT_DECL;
case TRANSLATION_UNIT_DECL: return TS_TRANSLATION_UNIT_DECL;
case TYPE_DECL: return TS_TYPE_DECL;
case VAR_DECL: return TS_VAR_DECL;
default: return TS_DECL_NON_COMMON;
}
case tcc_type: return TS_TYPE_NON_COMMON;
case tcc_binary:
case tcc_comparison:
case tcc_expression:
case tcc_reference:
case tcc_statement:
case tcc_vl_exp:
return TS_EXP;
case tcc_unary:
case tcc_vl_exp: return TS_EXP;
default: /* tcc_constant and tcc_exceptional */
break;
}
switch (code)
{
/* tcc_constant cases. */
case VOID_CST: return TS_TYPED;
case COMPLEX_CST: return TS_COMPLEX;
case FIXED_CST: return TS_FIXED_CST;
case INTEGER_CST: return TS_INT_CST;
case POLY_INT_CST: return TS_POLY_INT_CST;
case REAL_CST: return TS_REAL_CST;
case FIXED_CST: return TS_FIXED_CST;
case COMPLEX_CST: return TS_COMPLEX;
case VECTOR_CST: return TS_VECTOR;
case STRING_CST: return TS_STRING;
case VECTOR_CST: return TS_VECTOR;
case VOID_CST: return TS_TYPED;
/* tcc_exceptional cases. */
case ERROR_MARK: return TS_COMMON;
case IDENTIFIER_NODE: return TS_IDENTIFIER;
case TREE_LIST: return TS_LIST;
case TREE_VEC: return TS_VEC;
case SSA_NAME: return TS_SSA_NAME;
case PLACEHOLDER_EXPR: return TS_COMMON;
case STATEMENT_LIST: return TS_STATEMENT_LIST;
case BLOCK: return TS_BLOCK;
case CONSTRUCTOR: return TS_CONSTRUCTOR;
case TREE_BINFO: return TS_BINFO;
case ERROR_MARK: return TS_COMMON;
case IDENTIFIER_NODE: return TS_IDENTIFIER;
case OMP_CLAUSE: return TS_OMP_CLAUSE;
case OPTIMIZATION_NODE: return TS_OPTIMIZATION;
case PLACEHOLDER_EXPR: return TS_COMMON;
case SSA_NAME: return TS_SSA_NAME;
case STATEMENT_LIST: return TS_STATEMENT_LIST;
case TARGET_OPTION_NODE: return TS_TARGET_OPTION;
case TREE_BINFO: return TS_BINFO;
case TREE_LIST: return TS_LIST;
case TREE_VEC: return TS_VEC;
default:
gcc_unreachable ();

View File

@ -94,6 +94,10 @@ as_internal_fn (combined_fn code)
(MARK_TS_TYPE_COMMON (C), \
tree_contains_struct[C][TS_TYPE_WITH_LANG_SPECIFIC] = true)
#define MARK_TS_TYPE_NON_COMMON(C) \
(MARK_TS_TYPE_WITH_LANG_SPECIFIC (C), \
tree_contains_struct[C][TS_TYPE_NON_COMMON] = true) \
#define MARK_TS_DECL_MINIMAL(C) \
(MARK_TS_COMMON (C), \
tree_contains_struct[C][TS_DECL_MINIMAL] = true)