This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix processing of ADDR_EXPR in get_expr_operands
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 29 Jul 2004 22:55:56 -0400
- Subject: Re: Fix processing of ADDR_EXPR in get_expr_operands
- Organization: Red Hat Canada
- References: <10407300238.AA14813@vlsi1.ultra.nyu.edu>
On Thu, 2004-07-29 at 22:38, Richard Kenner wrote:
> Invariant addresses are supposed to be marked with TREE_INVARIANT, not
> TREE_CONSTANT. That's what I've been told by the FE folks and that's
> why the tree optimizers almost always rely on
> is_gimple_min_invariant().
>
> What does this have to do with the volatile question I'm asking about?
>
It's rather obvious. You cannot rely on TREE_CONSTANT to determine
constness of ADDR_EXPRs.
I don't know *why* ADDR_EXPR of a volatile is not TREE_CONSTANT. I
don't really care. All I know, and always use, is that constness of
ADDR_EXPRs is tested with TREE_INVARIANT. Hence the call to
is_gimple_min_invariant. Even TREE_CONSTANT is not always right, you
have to check for overflow as well.
> these flags on ADDR_EXPRs and they would be blown away by the middle-end
> if it did. They are set by recompute_tree_invarant_for_addr_expr.
>
Which you will notice sets both TREE_CONSTANT and TREE_INVARIANT, not
necessarily with the same value.
Diego.