public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* RFH: gen_rtx_MEM / gen_rtx_CONST in ada front-end code
@ 2010-05-26 12:40 Steven Bosscher
  2010-05-26 21:22 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Bosscher @ 2010-05-26 12:40 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: GCC Mailing List

Hello Eric,

Could you please help me with some code in
ada/gcc-interface/decl.c::gnat_to_gnu_entity:

        /* For a debug renaming declaration, build a pure debug entity.  */
        if (Present (Debug_Renaming_Link (gnat_entity)))
          {
            rtx addr;
            gnu_decl = build_decl (input_location,
                                   VAR_DECL, gnu_entity_name, gnu_type);
            /* The (MEM (CONST (0))) pattern is prescribed by STABS.  */
            if (global_bindings_p ())
              addr = gen_rtx_CONST (VOIDmode, const0_rtx);
            else
              addr = stack_pointer_rtx;
            SET_DECL_RTL (gnu_decl, gen_rtx_MEM (Pmode, addr));
            gnat_pushdecl (gnu_decl, gnat_entity);
            break;
          }

Setting DECL_RTL here is a problem. Front ends should not have to set
DECL_RTL, and it breaks with LTO (which does not stream DECL_RTL). Ada
is the last front end to set DECL_RTL to something non-NULL:

$ grep SET_DECL_RTL c-*.[ch] cp/*.[ch] objc/*.[ch] objcp/*.[ch]
fortran/*.[ch] java/*.[ch] ada/gcc-interface/*.[ch]
cp/class.c:  SET_DECL_RTL (clone, NULL);
cp/method.c:      SET_DECL_RTL (x, NULL);
cp/pt.c:      SET_DECL_RTL (new_friend, NULL);
cp/pt.c:        SET_DECL_RTL (r, NULL);
cp/pt.c:          SET_DECL_RTL (r, NULL);
cp/pt.c:          SET_DECL_RTL (r, NULL);
cp/pt.c:      SET_DECL_RTL (d, NULL);
java/decl.c:      SET_DECL_RTL (decl, 0);
ada/gcc-interface/decl.c:           SET_DECL_RTL (gnu_decl,
gen_rtx_MEM (Pmode, addr));


I would like to remove this code from ada, but I am not sure what the
purpose of this code is. What should I do with this code?

Thanks for any help/advice you can give,

Ciao!
Steven

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFH: gen_rtx_MEM / gen_rtx_CONST in ada front-end code
  2010-05-26 12:40 RFH: gen_rtx_MEM / gen_rtx_CONST in ada front-end code Steven Bosscher
@ 2010-05-26 21:22 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2010-05-26 21:22 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: GCC Mailing List

> Could you please help me with some code in
> ada/gcc-interface/decl.c::gnat_to_gnu_entity:
>
>         /* For a debug renaming declaration, build a pure debug entity.  */
>         if (Present (Debug_Renaming_Link (gnat_entity)))
>           {
>             rtx addr;
>             gnu_decl = build_decl (input_location,
>                                    VAR_DECL, gnu_entity_name, gnu_type);
>             /* The (MEM (CONST (0))) pattern is prescribed by STABS.  */
>             if (global_bindings_p ())
>               addr = gen_rtx_CONST (VOIDmode, const0_rtx);
>             else
>               addr = stack_pointer_rtx;
>             SET_DECL_RTL (gnu_decl, gen_rtx_MEM (Pmode, addr));
>             gnat_pushdecl (gnu_decl, gnat_entity);
>             break;
>           }

It's a gigi hack to support a front-end kludge. :-)

> I would like to remove this code from ada, but I am not sure what the
> purpose of this code is. What should I do with this code?

The goal is to build a pure debugging variable, i.e. a variable that will be 
present only in the debug info.  GDB is supposed to magically recognize its 
name and deduce something from its presence in the scope.

This was done this way to prevent debug stuff from altering code generation 
and avoid wasting space.  Yes, the whole design is questionable, give me a 
few days to investigate whether it can be modified.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-26 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-26 12:40 RFH: gen_rtx_MEM / gen_rtx_CONST in ada front-end code Steven Bosscher
2010-05-26 21:22 ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).