* RTL/SYMREF/VOLATILE question
@ 2004-01-20 12:28 xyzzy
2004-01-21 0:34 ` Jim Wilson
0 siblings, 1 reply; 4+ messages in thread
From: xyzzy @ 2004-01-20 12:28 UTC (permalink / raw)
To: GCC list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Greetings,
If I have an RTL fragment such as:
rtx bar;
bar = gen_rtx_SYMBOL_REF(Pmode,"*foo");
this generates exactly the code I need, but then if I optimize, it gets moved
and even deleted in the final target output.
SYMBOL_REF_FLAG (bar) = 1; has no effect, of course.
Using, instead:
rtx bar;
bar = gen_rtx_MEM(Pmode,gen_rtx_SYMBOL_REF(Pmode,"*foo"));
MEM_VOLATILE_P(bar) = 1;
now acts correctly for me in terms of optimization, but adds an extra level of
indirection which I have to account for in the following code generation.
Is there a simple way to do what I want (that is, get the least amount of
indirection possible for a SYMREF and be optimization safe?)
Thanks for any help.
-----BEGIN PGP SIGNATURE-----
iD8DBQFADR75rT0x/nxLkjwRAzlOAJ9PFePJXb2xl653rvEui8SdwIzAvgCfReJ3
SGAqVcbobv/Sk4ohSXsB1m0=
=v+9s
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RTL/SYMREF/VOLATILE question
2004-01-20 12:28 RTL/SYMREF/VOLATILE question xyzzy
@ 2004-01-21 0:34 ` Jim Wilson
2004-01-21 15:33 ` xyzzy
0 siblings, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2004-01-21 0:34 UTC (permalink / raw)
To: xyzzy; +Cc: gcc
xyzzy@hotpop.com wrote:
> Is there a simple way to do what I want (that is, get the least amount of
> indirection possible for a SYMREF and be optimization safe?)
You haven't provided enough information. None of your code samples will
actually produce code for instance. Just generating a symbol_ref does
not do anything interesting. You have to emit insns that use it. How
it gets optimized depends on what insns you emit. Since you did not
give us this info, there isn't much we can do.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RTL/SYMREF/VOLATILE question
2004-01-21 0:34 ` Jim Wilson
@ 2004-01-21 15:33 ` xyzzy
2004-01-21 18:24 ` Jim Wilson
0 siblings, 1 reply; 4+ messages in thread
From: xyzzy @ 2004-01-21 15:33 UTC (permalink / raw)
To: Jim Wilson, GCC list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
On Wednesday 21 January 2004 2:34 am, Jim Wilson wrote:
> xyzzy@hotpop.com wrote:
> > Is there a simple way to do what I want (that is, get the least amount of
> > indirection possible for a SYMREF and be optimization safe?)
>
> You haven't provided enough information. None of your code samples will
> actually produce code for instance. Just generating a symbol_ref does
> not do anything interesting. You have to emit insns that use it. How
> it gets optimized depends on what insns you emit. Since you did not
> give us this info, there isn't much we can do.
Sorry...
In essence I am passing this rtx up the chain to the expand_va_arg code, so I
don't KNOW what insns are emitted unless I do a lot of painful digging.
Again, the code sequence is:
rtx bar;
and either
bar = gen_rtx_SYMBOL_REF(Pmode,"*foo");
or
bar = gen_rtx_MEM(Pmode,gen_rtx_SYMBOL_REF(Pmode,"*foo"));
MEM_VOLATILE_P(bar) = 1;
... whereupon I return force_operand(copy_to_reg(bar),NULL_RTX) as the result
of EXPAND_BUILTIN_VA_ARG.
-----BEGIN PGP SIGNATURE-----
iD8DBQFADprlrT0x/nxLkjwRA4G8AJ4026dmw84/b4189tv/jrnypkHUkwCeKQv5
MlEcCADWFoYP5oX2kpJM7Zc=
=GTQd
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: RTL/SYMREF/VOLATILE question
2004-01-21 15:33 ` xyzzy
@ 2004-01-21 18:24 ` Jim Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Jim Wilson @ 2004-01-21 18:24 UTC (permalink / raw)
To: xyzzy; +Cc: gcc
xyzzy@hotpop.com wrote:
> In essence I am passing this rtx up the chain to the expand_va_arg code, so I
> don't KNOW what insns are emitted unless I do a lot of painful digging.
There still isn't enough info here to understand what your problem is.
There should be no need to use a volatile mem in EXPAND_BUILTIN_VA_ARG.
The compiler will only eliminate symbol references that are unused. So
if they are being optimized away, then either the C source code is not
using them, or else the RTL you are emitting is not using them. This
could be a bug in either the C source code or in your RTL, neither or
which I have access to, so I can't tell.
Returning a naked symbol ref from EXPAND_BUILTIN_VA_ARG is unlikely to
be useful. The return value is supposed to be the address of the next
unnamed argument, and I don't see how it is possible for such arguments
to be located inside a variable. Hence the address can't possibly be a
symbol_ref. The address could be stored in a variable, but in that case
you need a MEM of a SYMBOL_REF.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-01-21 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-20 12:28 RTL/SYMREF/VOLATILE question xyzzy
2004-01-21 0:34 ` Jim Wilson
2004-01-21 15:33 ` xyzzy
2004-01-21 18:24 ` Jim Wilson
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).