This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Reinstate old usage of TREE_STATIC on ADDR_EXPR


On Sun, May 25, 2008 at 10:56 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Well, it's not really about it being static, it's about some special
>> piece of information that you happen to store there.
>> As such, you really should be using a different name than TREE_STATIC,
>> even if that is what field you happen to reuse.
>
> OK.  Note that there is something worse: using a flag without declaring it.
> I recently toyed with unsigned_flag which is declared as being used only for
>
>   unsigned_flag:
>
>       TYPE_UNSIGNED in
>           all types
>       DECL_UNSIGNED in
>           all decls
>
> and got all sorts of interesting effects with optimization enabled...  Not
> very surprising:
>
> eric@linux:~/svn/gcc/gcc> grep unsigned_flag *.c
> tree-into-ssa.c:#define REGISTER_DEFS_IN_THIS_STMT(T)
> (T)->base.unsigned_flag
>
> And it's not the only one:
>
>   asm_written_flag:
>
>       TREE_ASM_WRITTEN in
>           VAR_DECL, FUNCTION_DECL, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE
>           BLOCK, SSA_NAME, STRING_CST
>
> eric@linux:~/svn/gcc/gcc> grep asm_written_flag *.c
> tree-ssa-dce.c:#define NECESSARY(stmt)          stmt->base.asm_written_flag
> tree-ssa-pre.c:#define NECESSARY(stmt)          stmt->base.asm_written_flag
>
>
> Conversely, default_def_flag is not even declared, albeit being used for

tree.h:  unsigned default_def_flag : 1;

> /* Nonzero if this SSA_NAME is the default definition for the
>   underlying symbol.  A default SSA name is created for symbol S if
>   the very first reference to S in the function is a read operation.
>   Default definitions are always created by an empty statement and
>   belong to no basic block.  */
> #define SSA_NAME_IS_DEFAULT_DEF(NODE)   \
>    SSA_NAME_CHECK (NODE)->base.default_def_flag

If you spent the time figuring those out, can you update the
documentation for them? ;)

Otherwise the patch is ok if you add a new accessor with a suitable name.

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]