[lto][patch] Handle COMPOUND_LITERAL_EXPR for initializers in lto1

Bill Maddox maddox@google.com
Mon Sep 8 23:46:00 GMT 2008


When a COMPOUND_LITERAL_EXPR appears in a constant initializer, it is
not gimplified,
but passed through unchanged.  A callback implemented by the C-family front ends
handles the expansion to RTL.  In discussion with Diego, we agreed
that these should
not be gimplified, and that COMPOUND_LITERAL_EXPR should become part of the
language-independent IR (which is essentially the C IR, and should
subsume it).  This
patch implements this functionality in the least intrusive way by
simply implementing the
same langhooks in lto1 as are used by cc1 and cc1plus.

The following regression tests that have been failing now pass with this fix:

gcc.c-torture/compile/init-1.c
gcc.c-torture/execute/20050929-1.c

gcc:
        * lto-tags.h (enum LTO_tags): Add new tags LTO_decl_expr and
        LTO_compound_literal_expr.
        * lto-tree-tags.h:  Add MAP_EXPR_TAG and SET_NAME calls for
        new LTO tags.  Cleanup comments.
        * lto-tree-flags.def: Add START_EXPR_CASE/END_EXPR_CASE calls
        for COMPOUND_LITERAL_EXPR.
        * lto-function-out.c (static expr_to_tag): Size array to
        include all tree codes, including front-end specific ones.
        * lto-function-in.c (static flags_length_for_code): Size array
        to include all tree codes, including front-end specific ones.

gcc/lto:
        * lto-lang.c: Include header file expr.h.
        (COMPOUND_LITERAL_EXPR_DECL_STMT,
        COMPOUND_LITERAL_EXPR_DECL): Copied from c-common.h.
        (emit_local_var):  Copied from c-semantics.c.
        (lto_expand_expr, lto_staticp): Copied from c_expand_expr
        and c_staticp in c-common.c.
        (LANG_HOOKS_EXPAND_EXPR,LANG_HOOKS_STATICP):  Redefined.

--Bill
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: streamer-compound-literal-patch-09-08.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080908/965fb16c/attachment.txt>


More information about the Gcc-patches mailing list