This patch turns the cl_optimization structure from an OPTIMIZATION_NODE
into a pointer inmstead of an actual instance. This is analgous to what
I did in a previously checked in patch for target optimizations
(https://gcc.gnu.org/ml/gcc-patches/2015-06/msg01152.html), I just
missed this one then. This time it really does remove the dependency
of tree-core.h on optons.h and thus tm.h.
These nodes are not used very much, so I don't expect any performance or
memory issues.
Bootstraps on x86_64-unknown-linux-gnu with no new regressions. Also
builds stage 1 on all the targets in config-list.mk.
OK for trunk?
Andrew
* tree-core.h (struct tree_optimization_option): Make opts a pointer to
struct cl_optimization.
* tree.h (TREE_OPTIMIZATION): Return the pointer, not the address of it.
* tree.c (make_node_stat): Allocate cl_optimization struct.
(copy_node_stat): Allocate and copy cl_optimization struct.
Index: tree-core.h
===================================================================
*** tree-core.h (revision 224602)
--- tree-core.h (working copy)
*************** struct GTY(()) tree_optimization_option
*** 1652,1658 ****
struct tree_common common;
/* The optimization options used by the user. */
! struct cl_optimization opts;
/* Target optabs for this set of optimization options. This is of
type `struct target_optabs *'. */
--- 1652,1658 ----
struct tree_common common;
/* The optimization options used by the user. */
! struct cl_optimization *opts;
/* Target optabs for this set of optimization options. This is of
type `struct target_optabs *'. */
Index: tree.h
===================================================================
*** tree.h (revision 224602)
--- tree.h (working copy)
*************** extern vec<tree, va_gc> **decl_debug_arg
*** 2827,2833 ****
(STATEMENT_LIST_CHECK (NODE)->stmt_list.tail)
#define TREE_OPTIMIZATION(NODE) \
! (&OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts)
#define TREE_OPTIMIZATION_OPTABS(NODE) \
(OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs)
--- 2827,2833 ----
(STATEMENT_LIST_CHECK (NODE)->stmt_list.tail)
#define TREE_OPTIMIZATION(NODE) \
! (OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts)
#define TREE_OPTIMIZATION_OPTABS(NODE) \
(OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs)
Index: tree.c
===================================================================
*** tree.c (revision 224602)
--- tree.c (working copy)
*************** along with GCC; see the file COPYING3.
*************** make_node_stat (enum tree_code code MEM_
*** 1095,1103 ****
break;
case tcc_exceptional:
! if (code == TARGET_OPTION_NODE)
! {
! TREE_TARGET_OPTION(t) = ggc_cleared_alloc<struct cl_target_option> ();
}
break;
--- 1094,1113 ----
break;
case tcc_exceptional:
! switch (code)
! {
! case TARGET_OPTION_NODE:
! TREE_TARGET_OPTION(t)
! = ggc_cleared_alloc<struct cl_target_option> ();
! break;
!
! case OPTIMIZATION_NODE:
! TREE_OPTIMIZATION (t)
! = ggc_cleared_alloc<struct cl_optimization> ();
! break;
!
! default:
! break;
}
break;
*************** copy_node_stat (tree node MEM_STAT_DECL)
*** 1188,1193 ****
--- 1198,1209 ----
memcpy (TREE_TARGET_OPTION (t), TREE_TARGET_OPTION (node),
sizeof (struct cl_target_option));
}
+ else if (code == OPTIMIZATION_NODE)
+ {
+ TREE_OPTIMIZATION (t) = ggc_alloc<struct cl_optimization>();
+ memcpy (TREE_OPTIMIZATION (t), TREE_OPTIMIZATION (node),
+ sizeof (struct cl_optimization));
+ }
return t;
}