This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
TREE_UNCHANGING?
- From: Jason Merrill <jason at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Wed, 08 May 2002 13:56:07 +0100
- Subject: TREE_UNCHANGING?
I would like to be able to tell the backend that the vtable for a class
object will never change, regardless of anything else we might or might not
know about that object, so we can hoist vtable lookups out of loops.
Unfortunately, there doesn't seem to be any way to do this in the trees;
TREE_READONLY isn't strong enough (since something const might still be
modified behind our backs), and TREE_CONSTANT is too strong (since the
value depends on which object we're dealing with). What I want to express
is, I believe, the same concept as RTX_UNCHANGING on a MEM; asserting that
the value at a particular memory location will not change, without saying
anything about how the location is calculated.
It seems that setting TREE_CONSTANT on the INDIRECT_REF does what I want,
thanks to the check in set_mem_attributes; would it make sense to bless
this usage?
Jason