tree-core.h won't compile without seeing options.h (which is usually
brought in by tm.h) because a TARGET_OPTION node contains an instance
of struct cl_target_option, defined thru options.h.
Its fairly straightforward to change it so the tree node simply contains
a pointer to one of these structures, and allocates it whenever the node
is created or copied. This adds an extra allocation, but I don't think
this tree node is extensively utilized.
This removes the only compilation dependency on options.h from
tree-core. This will hopefully lead to many less instances of tm,h
being required.
THis bootstraps on x86_64-unknown-linux-gnu with no new regressions, and
passes compilation on all the config-list.mk targets.
OK for mainline?
Andrew
* tree-core.h (tree_target_option): Make opts a pointer to a
cl_target_option.
* tree.h (TREE_TARGET_OPTION): Return the pointer, not an address of
the structure.
* tree.c (make_node_stat ): Allocate a cl_target_option struct for
TARGET_OPTION_NODE.
(copy_node_stat): Allocate and copy struct cl_target_option.
Index: tree-core.h
===================================================================
*** tree-core.h (revision 224342)
--- tree-core.h (working copy)
*************** struct GTY(()) tree_target_option {
*** 1676,1682 ****
struct target_globals *globals;
/* The optimization options used by the user. */
! struct cl_target_option opts;
};
/* Define the overall contents of a tree node.
--- 1676,1682 ----
struct target_globals *globals;
/* The optimization options used by the user. */
! struct cl_target_option *opts;
};
/* Define the overall contents of a tree node.
Index: tree.h
===================================================================
*** tree.h (revision 224342)
--- tree.h (working copy)
*************** extern vec<tree, va_gc> **decl_debug_arg
*** 2839,2845 ****
extern tree build_optimization_node (struct gcc_options *opts);
#define TREE_TARGET_OPTION(NODE) \
! (&TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts)
#define TREE_TARGET_GLOBALS(NODE) \
(TARGET_OPTION_NODE_CHECK (NODE)->target_option.globals)
--- 2839,2845 ----
extern tree build_optimization_node (struct gcc_options *opts);
#define TREE_TARGET_OPTION(NODE) \
! (TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts)
#define TREE_TARGET_GLOBALS(NODE) \
(TARGET_OPTION_NODE_CHECK (NODE)->target_option.globals)
Index: tree.c
===================================================================
*** tree.c (revision 224342)
--- tree.c (working copy)
*************** make_node_stat (enum tree_code code MEM_
*** 1096,1101 ****
--- 1096,1108 ----
}
break;
+ case tcc_exceptional:
+ if (code == TARGET_OPTION_NODE)
+ {
+ TREE_TARGET_OPTION(t) = ggc_cleared_alloc<struct cl_target_option> ();
+ }
+ break;
+
default:
/* Other classes need no special treatment. */
break;
*************** copy_node_stat (tree node MEM_STAT_DECL)
*** 1177,1182 ****
--- 1184,1195 ----
TYPE_CACHED_VALUES (t) = NULL_TREE;
}
}
+ else if (code == TARGET_OPTION_NODE)
+ {
+ TREE_TARGET_OPTION (t) = ggc_alloc<struct cl_target_option>();
+ memcpy (TREE_TARGET_OPTION (t), TREE_TARGET_OPTION (node),
+ sizeof (struct cl_target_option));
+ }
return t;
}