* Move DECL_ARGUMENTS into tree_function_decl
@ 2014-06-25 6:51 Jan Hubicka
2014-07-14 8:42 ` Jan Hubicka
2014-07-14 14:01 ` Jason Merrill
0 siblings, 2 replies; 4+ messages in thread
From: Jan Hubicka @ 2014-06-25 6:51 UTC (permalink / raw)
To: gcc-patches, jason, rguenther, mikestump, stanshebs
Hi,
this patch moves DECL_ARGUMENTS into FUNCTION_DECL. For this I needed to solve
reuse in C++ and objC frontends. In C++ I think I actually run out of places
to use for TEMPLATE_DECL (well, perhaps DECL_ATTRIBUTES but I would definitely
run out of pointers fro DECL_RESULT I want to move next) so I decided to go
ahead and allow lang frontends to make their own structures for their own decls
as we currently support for exceptional trees.
This allows me to make TEMPLATE_DECL decl_common and save there quite few pointers
that go with decl_non_common (rtl, assembler name, symtab etc).
I think other DECL_NON_COMMON declarations in C++ FE can now be put on the diet
too.
In objc I simply used DECL_SIZE. I have noticed that the accesors was never
updated for type checking and added these (sincerely hope I won't be asked to
fix bugs found by those at daily basis).
Similarly objc can use some custom layouts for the decls, but I did not do it.
THe added tree_size langhook is there only becuase I changed generic code to
die when lang does not handle its decls correctly.
Ada/C++/Fortran do not add its own decl trees.
Honza
* tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL,
NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL;
call langhook for unknown declaration.
(find_decls_types_r): Do not walk DECL_ARGUMENT_FLD.
* tree.h (DECL_ARGUMENTS): Update.
* print-tree.c (print_node): Update.
* tree-core.h (tree_decl_non_common): Remove arguments.
(tree_function_decl): Add arguments.
* class.c (build_clone): Do not clear assembler names of
templates.
* decl.c (cp_tree_node_structure): Add TEMPLATE_DECL.
* cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL
as a special case return sizeof (struct tree_decl_non_common)
for other decls.
(cp_common_init_ts): Do not initialize NAMESPACE_DECL;
initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON.
* cp/cp-tree.h (tree_template_decl): New structure.
(cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL.
(union cp_lang_tree_node): Add template_decl.
(DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update.
* lto/lto.c (mentions_vars_p_decl_non_common): Skip
DECL_ARGUMENT_FLD.
mentions_vars_p_function): Do DECL_ARGUMENTS.
(lto_fixup_prevailing_decls): Update.
* objc-act.c (objc_common_tree_size): New function.
* objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type
checking.
(INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro.
(METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS,
METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING,
METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking.
(METHOD_SEL_ARGS): Use decl_common.size instead of
decl_non_common.result.
(PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME,
PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS,
PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER,
PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking.
(objc_common_tree_size): Declare.
* objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro.
Index: tree.c
===================================================================
--- tree.c (revision 211965)
+++ tree.c (working copy)
@@ -708,8 +708,14 @@ tree_code_size (enum tree_code code)
return sizeof (struct tree_function_decl);
case DEBUG_EXPR_DECL:
return sizeof (struct tree_decl_with_rtl);
- default:
+ case TRANSLATION_UNIT_DECL:
+ return sizeof (struct tree_translation_unit_decl);
+ case NAMESPACE_DECL:
+ case IMPORTED_DECL:
+ case NAMELIST_DECL:
return sizeof (struct tree_decl_non_common);
+ default:
+ return lang_hooks.tree_size (code);
}
}
@@ -5305,7 +5311,6 @@ find_decls_types_r (tree *tp, int *ws, v
}
else if (TREE_CODE (t) == TYPE_DECL)
{
- fld_worklist_push (DECL_ARGUMENT_FLD (t), fld);
fld_worklist_push (DECL_ORIGINAL_TYPE (t), fld);
}
else if (TREE_CODE (t) == FIELD_DECL)
Index: tree.h
===================================================================
--- tree.h (revision 211965)
+++ tree.h (working copy)
@@ -2616,13 +2616,9 @@ extern vec<tree, va_gc> **decl_debug_arg
#define DECL_BUILT_IN_CLASS(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.built_in_class)
-/* In FUNCTION_DECL, a chain of ..._DECL nodes.
- VAR_DECL and PARM_DECL reserve the arguments slot for language-specific
- uses. */
+/* In FUNCTION_DECL, a chain of ..._DECL nodes. */
#define DECL_ARGUMENTS(NODE) \
- (FUNCTION_DECL_CHECK (NODE)->decl_non_common.arguments)
-#define DECL_ARGUMENT_FLD(NODE) \
- (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments)
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.arguments)
/* In FUNCTION_DECL, the function specific target options to use when compiling
this function. */
Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c (revision 211965)
+++ objc/objc-act.c (working copy)
@@ -10111,4 +10111,21 @@ objc_common_init_ts (void)
MARK_TS_TYPED (PROPERTY_REF);
}
+size_t
+objc_common_tree_size (enum tree_code code)
+{
+ switch (code)
+ {
+ case CLASS_METHOD_DECL:
+ case INSTANCE_METHOD_DECL:
+ case KEYWORD_DECL:
+ case PROPERTY_DECL:
+ return sizeof (struct tree_decl_non_common);
+ default:
+ gcc_unreachable ();
+
+ }
+}
+
+
#include "gt-objc-objc-act.h"
Index: objc/objc-act.h
===================================================================
--- objc/objc-act.h (revision 211965)
+++ objc/objc-act.h (working copy)
@@ -38,18 +38,29 @@ void objc_common_init_ts (void);
#define OBJC_INFO_SLOT_ELTS 2
/* KEYWORD_DECL */
-#define KEYWORD_KEY_NAME(DECL) ((DECL)->decl_minimal.name)
-#define KEYWORD_ARG_NAME(DECL) ((DECL)->decl_non_common.arguments)
+#define KEYWORD_KEY_NAME(DECL) (KEYWORD_DECL_CHECK (DECL)->decl_minimal.name)
+#define KEYWORD_ARG_NAME(DECL) (KEYWORD_DECL_CHECK (DECL)->decl_common.size)
+
+#define INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK(NODE) \
+ TREE_CHECK2(NODE,INSTANCE_METHOD_DECL,CLASS_METHOD_DECL)
/* INSTANCE_METHOD_DECL, CLASS_METHOD_DECL */
-#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)
-#define METHOD_TYPE_ATTRIBUTES(DECL) ((DECL)->decl_common.abstract_origin)
-#define METHOD_PROPERTY_CONTEXT(DECL) ((DECL)->decl_common.size_unit)
+#define METHOD_SEL_NAME(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_minimal.name)
+#define METHOD_SEL_ARGS(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.size)
+#define METHOD_ADD_ARGS(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_non_common.result)
+#define METHOD_ADD_ARGS_ELLIPSIS_P(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.lang_flag_0)
+#define METHOD_DEFINITION(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.initial)
+#define METHOD_ENCODING(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_minimal.context)
+#define METHOD_TYPE_ATTRIBUTES(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.abstract_origin)
+#define METHOD_PROPERTY_CONTEXT(DECL) \
+ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.size_unit)
/* PROPERTY_DECL. A PROPERTY_DECL repesents a @property declaration
@@ -65,19 +76,24 @@ void objc_common_init_ts (void);
valid getter/setter. */
/* PROPERTY_NAME is the name of the property. */
-#define PROPERTY_NAME(DECL) DECL_NAME(DECL)
+#define PROPERTY_NAME(DECL) \
+ DECL_NAME(PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_GETTER_NAME is the identifier of the getter method. */
-#define PROPERTY_GETTER_NAME(DECL) ((DECL)->decl_non_common.arguments)
+#define PROPERTY_GETTER_NAME(DECL)\
+ (PROPERTY_DECL_CHECK (DECL)->decl_common.size)
/* PROPERTY_SETTER_NAME is the identifier of the setter method. */
-#define PROPERTY_SETTER_NAME(DECL) ((DECL)->decl_non_common.result)
+#define PROPERTY_SETTER_NAME(DECL) \
+ (PROPERTY_DECL_CHECK (DECL)->decl_non_common.result)
/* PROPERTY_READONLY can be 0 or 1. */
-#define PROPERTY_READONLY(DECL) DECL_LANG_FLAG_0 (DECL)
+#define PROPERTY_READONLY(DECL) \
+ DECL_LANG_FLAG_0 (PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_NONATOMIC can be 0 or 1. */
-#define PROPERTY_NONATOMIC(DECL) DECL_LANG_FLAG_1 (DECL)
+#define PROPERTY_NONATOMIC(DECL) \
+ DECL_LANG_FLAG_1 (PROPERTY_DECL_CHECK (DECL))
typedef enum objc_property_assign_semantics {
OBJC_PROPERTY_ASSIGN = 1,
@@ -89,31 +105,37 @@ typedef enum objc_property_assign_semant
OBJC_PROPERTY_RETAIN or OBJC_PROPERTY_COPY. We need an integer to
store it, so we hijack the alignment, that properties don't
have. */
-#define PROPERTY_ASSIGN_SEMANTICS(DECL) ((DECL)->decl_common.align)
+#define PROPERTY_ASSIGN_SEMANTICS(DECL) \
+ (PROPERTY_DECL_CHECK (DECL)->decl_common.align)
/* PROPERTY_IVAR_NAME is the identifier of the instance variable.
This is set only if the PROPERTY_DECL represents a @synthesize;
otherwise, it is set to TREE_NULL. */
-#define PROPERTY_IVAR_NAME(DECL) ((DECL)->decl_common.initial)
+#define PROPERTY_IVAR_NAME(DECL) \
+ (PROPERTY_DECL_CHECK (DECL)->decl_common.initial)
/* PROPERTY_DYNAMIC can be 0 or 1. This is 1 if the PROPERTY_DECL
represents a @dynamic; otherwise, it is set to 0. */
-#define PROPERTY_DYNAMIC(DECL) DECL_LANG_FLAG_2 (DECL)
+#define PROPERTY_DYNAMIC(DECL) \
+ DECL_LANG_FLAG_2 (PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_HAS_NO_GETTER can be 0 or 1. Normally it is 0, but if
this is an artificial PROPERTY_DECL that we generate even without a
getter, it is set to 1. */
-#define PROPERTY_HAS_NO_GETTER(DECL) DECL_LANG_FLAG_3 (DECL)
+#define PROPERTY_HAS_NO_GETTER(DECL) \
+ DECL_LANG_FLAG_3 (PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_HAS_NO_SETTER can be 0 or 1. Normally it is 0, but if
this is an artificial PROPERTY_DECL that we generate even without a
setter, it is set to 1. */
-#define PROPERTY_HAS_NO_SETTER(DECL) DECL_LANG_FLAG_4 (DECL)
+#define PROPERTY_HAS_NO_SETTER(DECL) \
+ DECL_LANG_FLAG_4 (PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_OPTIONAL can be 0 or 1. Normally it is 0, but if this is
a property declared as @optional in a @protocol, then it is set to
1. */
-#define PROPERTY_OPTIONAL(DECL) DECL_LANG_FLAG_5 (DECL)
+#define PROPERTY_OPTIONAL(DECL) \
+ DECL_LANG_FLAG_5 (PROPERTY_DECL_CHECK (DECL))
/* PROPERTY_REF. A PROPERTY_REF represents an 'object.property'
expression. It is normally used for property access, but when
@@ -693,6 +715,9 @@ struct objc_try_context
extern tree objc_create_temporary_var (tree, const char *);
+size_t objc_common_tree_size (enum tree_code code);
+
+
#define objc_is_object_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_object_id)
#define objc_is_class_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_class_id)
Index: objc/objc-lang.c
===================================================================
--- objc/objc-lang.c (revision 211965)
+++ objc/objc-lang.c (working copy)
@@ -49,6 +49,8 @@ enum c_language_kind c_language = clk_ob
#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS objc_common_init_ts
+#undef LANG_HOOKS_TREE_SIZE
+#define LANG_HOOKS_TREE_SIZE objc_common_tree_size
/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
Index: cp/class.c
===================================================================
--- cp/class.c (revision 211965)
+++ cp/class.c (working copy)
@@ -4388,7 +4388,8 @@ build_clone (tree fn, tree name)
clone = copy_decl (fn);
/* Reset the function name. */
DECL_NAME (clone) = name;
- SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
+ if (TREE_CODE (clone) != TEMPLATE_DECL)
+ SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
/* Remember where this function came from. */
DECL_ABSTRACT_ORIGIN (clone) = fn;
/* Make it easy to find the CLONE given the FN. */
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 211965)
+++ cp/decl.c (working copy)
@@ -14479,6 +14479,7 @@ cp_tree_node_structure (union lang_tree_
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;
Index: cp/cp-objcp-common.c
===================================================================
--- cp/cp-objcp-common.c (revision 211965)
+++ cp/cp-objcp-common.c (working copy)
@@ -103,7 +103,11 @@ cp_tree_size (enum tree_code code)
case USERDEF_LITERAL: return sizeof (struct tree_userdef_literal);
+ case TEMPLATE_DECL: return sizeof (struct tree_template_decl);
+
default:
+ if (TREE_CODE_CLASS (code) == tcc_declaration)
+ return sizeof (struct tree_decl_non_common);
gcc_unreachable ();
}
/* NOTREACHED */
@@ -245,9 +249,8 @@ cxx_block_may_fallthru (const_tree stmt)
void
cp_common_init_ts (void)
{
- MARK_TS_DECL_NON_COMMON (NAMESPACE_DECL);
MARK_TS_DECL_NON_COMMON (USING_DECL);
- MARK_TS_DECL_NON_COMMON (TEMPLATE_DECL);
+ MARK_TS_DECL_COMMON (TEMPLATE_DECL);
MARK_TS_COMMON (TEMPLATE_TEMPLATE_PARM);
MARK_TS_COMMON (TEMPLATE_TYPE_PARM);
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h (revision 211965)
+++ cp/cp-tree.h (working copy)
@@ -360,6 +360,12 @@ struct GTY(()) tree_overload {
tree function;
};
+struct GTY(()) tree_template_decl {
+ struct tree_decl_common common;
+ tree arguments;
+ tree result;
+};
+
/* Returns true iff NODE is a BASELINK. */
#define BASELINK_P(NODE) \
(TREE_CODE (NODE) == BASELINK)
@@ -794,6 +800,7 @@ enum cp_tree_node_structure_enum {
TS_CP_BINDING,
TS_CP_OVERLOAD,
TS_CP_BASELINK,
+ TS_CP_TEMPLATE_DECL,
TS_CP_WRAPPER,
TS_CP_DEFAULT_ARG,
TS_CP_DEFERRED_NOEXCEPT,
@@ -815,6 +822,7 @@ union GTY((desc ("cp_tree_node_structure
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
+ struct tree_template_decl GTY ((tag ("TS_CP_TEMPLATE_DECL"))) template_decl;
struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
@@ -3747,16 +3755,22 @@ more_aggr_init_expr_args_p (const aggr_i
parameter). The TREE_PURPOSE is the default value, if any. The
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). */
+ TYPE_DECL).
+
+ FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
+ tree is converted to C++ class hiearchy. */
#define DECL_TEMPLATE_PARMS(NODE) \
- TEMPLATE_DECL_CHECK (NODE)->decl_non_common.arguments
+ ((struct tree_template_decl *)CONST_CAST_TREE (TEMPLATE_DECL_CHECK (NODE)))->arguments
#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
#define DECL_NTPARMS(NODE) \
TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
-/* For function, method, class-data templates. */
+/* For function, method, class-data templates.
+
+ FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
+ tree is converted to C++ class hiearchy. */
#define DECL_TEMPLATE_RESULT(NODE) \
- DECL_RESULT_FLD (TEMPLATE_DECL_CHECK (NODE))
+ ((struct tree_template_decl *)CONST_CAST_TREE(TEMPLATE_DECL_CHECK (NODE)))->result
/* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS
lists all instantiations and specializations of the function so that
tsubst_friend_function can reassign them to another template if we find
Index: lto/lto.c
===================================================================
--- lto/lto.c (revision 211965)
+++ lto/lto.c (working copy)
@@ -775,7 +775,6 @@ mentions_vars_p_decl_non_common (tree t)
{
if (mentions_vars_p_decl_with_vis (t))
return true;
- CHECK_NO_VAR (DECL_ARGUMENT_FLD (t));
CHECK_NO_VAR (DECL_RESULT_FLD (t));
return false;
}
@@ -787,6 +786,7 @@ mentions_vars_p_function (tree t)
{
if (mentions_vars_p_decl_non_common (t))
return true;
+ CHECK_NO_VAR (DECL_ARGUMENTS (t));
CHECK_NO_VAR (DECL_VINDEX (t));
CHECK_VAR (DECL_FUNCTION_PERSONALITY (t));
return false;
@@ -2712,11 +2712,11 @@ lto_fixup_prevailing_decls (tree t)
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
{
- LTO_NO_PREVAIL (DECL_ARGUMENT_FLD (t));
LTO_NO_PREVAIL (DECL_RESULT_FLD (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
{
+ LTO_NO_PREVAIL (DECL_ARGUMENTS (t));
LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t));
LTO_NO_PREVAIL (DECL_VINDEX (t));
}
Index: print-tree.c
===================================================================
--- print-tree.c (revision 211965)
+++ print-tree.c (working copy)
@@ -514,7 +514,6 @@ print_node (FILE *file, const char *pref
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
{
- print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
}
@@ -540,6 +539,7 @@ print_node (FILE *file, const char *pref
else if (code == FUNCTION_DECL
&& DECL_STRUCT_FUNCTION (node) != 0)
{
+ print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
indent_to (file, indent + 4);
dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node));
}
Index: tree-core.h
===================================================================
--- tree-core.h (revision 211965)
+++ tree-core.h (working copy)
@@ -1494,8 +1494,6 @@ struct GTY(()) tree_var_decl {
struct GTY(()) tree_decl_non_common {
struct tree_decl_with_vis common;
- /* C++ uses this in templates. */
- tree arguments;
/* Almost all FE's use this. */
tree result;
};
@@ -1510,6 +1508,8 @@ struct GTY(()) tree_function_decl {
struct function *f;
+ /* Arguments of the function. */
+ tree arguments;
/* The personality function. Used for stack unwinding. */
tree personality;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Move DECL_ARGUMENTS into tree_function_decl
2014-06-25 6:51 Move DECL_ARGUMENTS into tree_function_decl Jan Hubicka
@ 2014-07-14 8:42 ` Jan Hubicka
2014-07-14 14:01 ` Jason Merrill
1 sibling, 0 replies; 4+ messages in thread
From: Jan Hubicka @ 2014-07-14 8:42 UTC (permalink / raw)
To: Jan Hubicka; +Cc: gcc-patches, jason, rguenther, mikestump, stanshebs
> Hi,
> this patch moves DECL_ARGUMENTS into FUNCTION_DECL. For this I needed to solve
> reuse in C++ and objC frontends. In C++ I think I actually run out of places
> to use for TEMPLATE_DECL (well, perhaps DECL_ATTRIBUTES but I would definitely
> run out of pointers fro DECL_RESULT I want to move next) so I decided to go
> ahead and allow lang frontends to make their own structures for their own decls
> as we currently support for exceptional trees.
>
> This allows me to make TEMPLATE_DECL decl_common and save there quite few pointers
> that go with decl_non_common (rtl, assembler name, symtab etc).
>
> I think other DECL_NON_COMMON declarations in C++ FE can now be put on the diet
> too.
>
> In objc I simply used DECL_SIZE. I have noticed that the accesors was never
> updated for type checking and added these (sincerely hope I won't be asked to
> fix bugs found by those at daily basis).
>
> Similarly objc can use some custom layouts for the decls, but I did not do it.
>
> THe added tree_size langhook is there only becuase I changed generic code to
> die when lang does not handle its decls correctly.
>
> Ada/C++/Fortran do not add its own decl trees.
>
> Honza
>
> * tree.c (tree_code_size): Add TRANSLATION_UNIT_DECL,
> NAMESPACE_DECL, IMPORTED_DECL and NAMELIST_DECL;
> call langhook for unknown declaration.
> (find_decls_types_r): Do not walk DECL_ARGUMENT_FLD.
> * tree.h (DECL_ARGUMENTS): Update.
> * print-tree.c (print_node): Update.
> * tree-core.h (tree_decl_non_common): Remove arguments.
> (tree_function_decl): Add arguments.
>
> * class.c (build_clone): Do not clear assembler names of
> templates.
> * decl.c (cp_tree_node_structure): Add TEMPLATE_DECL.
> * cp-objcp-common.c (cp_tree_size): Add TEMPLATE_DECL
> as a special case return sizeof (struct tree_decl_non_common)
> for other decls.
> (cp_common_init_ts): Do not initialize NAMESPACE_DECL;
> initialize TEMPLATE_DECL as MARK_TS_DECL_COMMON.
> * cp/cp-tree.h (tree_template_decl): New structure.
> (cp_tree_node_structure_enum): Add TS_CP_TEMPLATE_DECL.
> (union cp_lang_tree_node): Add template_decl.
> (DECL_TEMPLATE_PARMS, DECL_TEMPLATE_RESULT): Update.
>
> * lto/lto.c (mentions_vars_p_decl_non_common): Skip
> DECL_ARGUMENT_FLD.
> mentions_vars_p_function): Do DECL_ARGUMENTS.
> (lto_fixup_prevailing_decls): Update.
>
> * objc-act.c (objc_common_tree_size): New function.
> * objc-act.h (KEYWORD_KEY_NAME, KEYWORD_ARG_NAME): Add type
> checking.
> (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): New macro.
> (METHOD_SEL_NAME, METHOD_SEL_ARGS, METHOD_ADD_ARGS,
> METHOD_ADD_ARGS_ELLIPSIS_P, METHOD_DEFINITION, METHOD_ENCODING,
> METHOD_TYPE_ATTRIBUTES, METHOD_PROPERTY_CONTEXT): Add type checking.
> (METHOD_SEL_ARGS): Use decl_common.size instead of
> decl_non_common.result.
> (PROPERTY_NAME, PROPERTY_GETTER_NAME, PROPERTY_SETTER_NAME,
> PROPERTY_READONLY, PROPERTY_NONATOMIC, PROPERTY_ASSIGN_SEMANTICS,
> PROPERTY_IVAR_NAME, PROPERTY_DYNAMIC, PROPERTY_HAS_NO_GETTER,
> PROPERTY_HAS_NO_SETTER, PROPERTY_OPTIONAL): Add type checking.
> (objc_common_tree_size): Declare.
> * objc/objc-lang.c (LANG_HOOKS_TREE_SIZE): New macro.
Ping...
I would really like to finish the transition here and decompose
decl_non_common/decl_with_vis so we can get the inehriatance hiearchy more
explicit.
Honza
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Move DECL_ARGUMENTS into tree_function_decl
2014-06-25 6:51 Move DECL_ARGUMENTS into tree_function_decl Jan Hubicka
2014-07-14 8:42 ` Jan Hubicka
@ 2014-07-14 14:01 ` Jason Merrill
2014-07-14 15:24 ` Jan Hubicka
1 sibling, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2014-07-14 14:01 UTC (permalink / raw)
To: Jan Hubicka, gcc-patches, rguenther, mikestump, stanshebs
On 06/25/2014 02:51 AM, Jan Hubicka wrote:
> @@ -4388,7 +4388,8 @@ build_clone (tree fn, tree name)
> clone = copy_decl (fn);
> /* Reset the function name. */
> DECL_NAME (clone) = name;
> - SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
> + if (TREE_CODE (clone) != TEMPLATE_DECL)
> + SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
Instead of this, move the SET_DECL_ASSEMBLER_NAME down below the
template block.
OK with that change.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Move DECL_ARGUMENTS into tree_function_decl
2014-07-14 14:01 ` Jason Merrill
@ 2014-07-14 15:24 ` Jan Hubicka
0 siblings, 0 replies; 4+ messages in thread
From: Jan Hubicka @ 2014-07-14 15:24 UTC (permalink / raw)
To: Jason Merrill; +Cc: Jan Hubicka, gcc-patches, rguenther, mikestump, stanshebs
> On 06/25/2014 02:51 AM, Jan Hubicka wrote:
> >@@ -4388,7 +4388,8 @@ build_clone (tree fn, tree name)
> > clone = copy_decl (fn);
> > /* Reset the function name. */
> > DECL_NAME (clone) = name;
> >- SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
> >+ if (TREE_CODE (clone) != TEMPLATE_DECL)
> >+ SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
>
> Instead of this, move the SET_DECL_ASSEMBLER_NAME down below the
> template block.
>
> OK with that change.
Thanks a lot!
I wonder how necessary are those DECL_RTL/DECL_ASSEMBLER_NAME hacks
these days. THeoretically those should be computed only late once clonning is done.
Honza
>
> Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-14 15:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 6:51 Move DECL_ARGUMENTS into tree_function_decl Jan Hubicka
2014-07-14 8:42 ` Jan Hubicka
2014-07-14 14:01 ` Jason Merrill
2014-07-14 15:24 ` Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).