Commit 2c0d84d6 by Mike Stump

cp-decl.c (flag_conserve_space): New language specific flag to tell the compiler…

cp-decl.c (flag_conserve_space): New language specific flag to tell the compiler to use .common when possible.

	* cp-decl.c (flag_conserve_space): New language specific flag to
	tell the compiler to use .common when possible.  Reduces the size of
	.o files.
	* cp-decl.c (duplicate_decls): Copy DECL_COMMON from the olddecl.
	* cp-decl.c (start_decl): Set DECL_COMMON appropriately.
	* cp-decl.c (finish_decl): Use flag_conserve_space, instead of
	flag_no_common.
	* cp-decl2.c (flag_conserve_space, lang_f_options): New flag.
	* toplev.c (lang_options): New -fconserve-space flag.
	* tree.h (DECL_COMMON): New flag.
	* tree.h (tree_decl): New common_flag.
	* varasm.c (assemble_variable): Use DECL_COMMON to help determine if
	an object can be put in .common.
	* c-decl.c (start_decl): Set DECL_COMMON to 1..

From-SVN: r6244
parent 3d5e2367
......@@ -3333,6 +3333,10 @@ start_decl (declarator, declspecs, initialized)
TEM may equal DECL or it may be a previous decl of the same name. */
tem = pushdecl (decl);
/* For C and Obective-C, we by default put things in .common when
possible. */
DECL_COMMON (tem) = 1;
/* For a local variable, define the RTL now. */
if (current_binding_level != global_binding_level
/* But not if this is a duplicate decl
......
......@@ -646,6 +646,10 @@ char *lang_options[] =
"-fno-external-templates",
"-fansi-overloading",
"-fno-ansi-overloading",
"-fhuge-objects",
"-fno-huge-objects",
"-fconserve-space",
"-fno-conserve-space",
"-Wreturn-type",
"-Wno-return-type",
......
......@@ -832,6 +832,11 @@ struct tree_type
because this decl is unused. */
#define DECL_IN_SYSTEM_HEADER(NODE) ((NODE)->decl.in_system_header_flag)
/* Nonzero for a given ..._DECL node means that this node should be
put in .common, if possible. If a DECL_INITIAL is given, and it
is not error_mark_node, then the decl cannot be put in .common. */
#define DECL_COMMON(NODE) ((NODE)->decl.common_flag)
/* Language-specific decl information. */
#define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
......@@ -914,7 +919,8 @@ struct tree_decl
unsigned abstract_flag : 1;
unsigned in_system_header_flag : 1;
/* room for seven more */
unsigned common_flag : 1;
/* room for six more */
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
......
......@@ -979,6 +979,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
-fno-common gives strict ANSI behavior. Usually you don't want it.
This matters only for variables with external linkage. */
if ((! flag_no_common || ! TREE_PUBLIC (decl))
&& DECL_COMMON (decl)
&& ! dont_output_data
&& (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment