[PATCH][C++] Move cgraph_finalize_compilation_unit call
Richard Guenther
rguenther@suse.de
Tue Dec 1 15:05:00 GMT 2009
This moves the call to cgraph_finalize_compilation_unit last
in the cp_write_global_declarations langhook. This avoids
walking frontend specific data after it, namely through
the walking of namespaces.
The patch actually causes
libtool: compile: /space/rguenther/obj2/./gcc/xgcc -shared-libgcc
-B/space/rguenther/obj2/./gcc -nostdinc++
-L/space/rguenther/obj2/x86_64-unknown-linux-gnu/libstdc++-v3/src
-L/space/rguenther/obj2/x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/usr/local/x86_64-unknown-linux-gnu/bin/
-B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem
/usr/local/x86_64-unknown-linux-gnu/include -isystem
/usr/local/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I.
-I../../../trunk/libjava -I./include -I./gcj -I../../../trunk/libjava
-Iinclude -I../../../trunk/libjava/include
-I../../../trunk/libjava/classpath/include -Iclasspath/include
-I../../../trunk/libjava/classpath/native/fdlibm
-I../../../trunk/libjava/../boehm-gc/include -I../boehm-gc/include
-I../../../trunk/libjava/libltdl -I../../../trunk/libjava/libltdl
-I../../../trunk/libjava/.././libjava/../gcc
-I../../../trunk/libjava/../zlib
-I../../../trunk/libjava/../libffi/include -I../libffi/include -fno-rtti
-fnon-call-exceptions -fdollars-in-identifiers -Wswitch-enum
-D_FILE_OFFSET_BITS=64 -fomit-frame-pointer -Wextra -Wall -D_GNU_SOURCE
-DPREFIX=\"/usr/local\" -DTOOLEXECLIBDIR=\"/usr/local/lib/../lib64\"
-DJAVA_HOME=\"/usr/local\"
-DBOOT_CLASS_PATH=\"/usr/local/share/java/libgcj-4.5.0.jar\"
-DJAVA_EXT_DIRS=\"/usr/local/share/java/ext\"
-DGCJ_ENDORSED_DIRS=\"/usr/local/share/java/gcj-endorsed\"
-DGCJ_VERSIONED_LIBDIR=\"/usr/local/lib/../lib64/gcj-4.5.0-11\"
-DPATH_SEPARATOR=\":\" -DECJ_JAR_FILE=\"\"
-DLIBGCJ_DEFAULT_DATABASE=\"/usr/local/lib/../lib64/gcj-4.5.0-11/classmap.db\"
-DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL=\"gcj-4.5.0-11/classmap.db\" -g -O2
-D_GNU_SOURCE -MT jni-libjvm.lo -MD -MP -MF .deps/jni-libjvm.Tpo -c
../../../trunk/libjava/jni-libjvm.cc -fPIC -DPIC -o .libs/jni-libjvm.o
/tmp/ccB6PUqb.s: Assembler messages:
/tmp/ccB6PUqb.s:226: Error: junk at end of line, first unrecognized
character is `*'
/tmp/ccB6PUqb.s:227: Error: junk at end of line, first unrecognized
character is `*'
/tmp/ccB6PUqb.s:228: Error: expected comma after "_ZGAN8__JArrayC1Ev"
when building libjava, so it isn't applicable in its current form.
The assembler looks like
.globl _ZGAN8__JArrayC1Ev *INTERNAL*
.hidden _ZGAN8__JArrayC1Ev *INTERNAL*
.set _ZGAN8__JArrayC1Ev *INTERNAL* ,_ZN8__JArrayC1Ev *INTERNAL*
so it seems we are emitting sth that is DECL_ABSTRACT.
Maybe C++ maintainers have an idea here how to make the FE magic
that currently follows cgraph_finalize_compilation_unit more
middle-end friendly.
Thanks,
Richard.
2009-12-01 Richard Guenther <rguenther@suse.de>
* tree.c (free_lang_data_in_type): Reset TYPE_LANG_SPECIFIC.
(free_lang_data_in_decl): Reset DECL_LANG_SPECIFIC.
cp/
* decl2.c (cp_write_global_declarations): Call
cgraph_finalize_compilation_unit last.
Index: gcc/tree.c
===================================================================
--- gcc/tree.c (revision 154868)
+++ gcc/tree.c (working copy)
@@ -4254,6 +4254,8 @@ free_lang_data_in_type (tree type)
TYPE_CONTEXT (type) = NULL_TREE;
TYPE_STUB_DECL (type) = NULL_TREE;
+
+ TYPE_LANG_SPECIFIC (type) = NULL;
}
@@ -4461,6 +4463,8 @@ free_lang_data_in_decl (tree decl)
nesting beyond this point. */
DECL_CONTEXT (decl) = NULL_TREE;
}
+
+ DECL_LANG_SPECIFIC (decl) = NULL;
}
Index: gcc/cp/decl2.c
===================================================================
--- gcc/cp/decl2.c (revision 154868)
+++ gcc/cp/decl2.c (working copy)
@@ -3777,8 +3777,6 @@ cp_write_global_declarations (void)
/* Collect candidates for Java hidden aliases. */
candidates = collect_candidates_for_java_method_aliases ();
- cgraph_finalize_compilation_unit ();
-
/* Now, issue warnings about static, but not defined, functions,
etc., and emit debugging information. */
walk_namespaces (wrapup_globals_for_namespace, /*data=*/&reconsider);
@@ -3824,6 +3822,8 @@ cp_write_global_declarations (void)
#ifdef ENABLE_CHECKING
validate_conversion_obstack ();
#endif /* ENABLE_CHECKING */
+
+ cgraph_finalize_compilation_unit ();
}
/* FN is an OFFSET_REF, DOTSTAR_EXPR or MEMBER_REF indicating the
More information about the Gcc-patches
mailing list