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: Reorder some tree codes


Nathan Sidwell <nathan@codesourcery.com> wrote:

>> This patch reorders the _TYPE codes and a few others to allow
>> range comparison to determine certain kinds of types.  This showed
>> a 0.25% speed improvement on darwin, and a 2% text size reduction in
>> cc1plus.


I do not like this because we lose clarity in the definition of the macros, and
thus we make debugging much harder. For instance:

>> *************** struct lang_decl GTY(())
>> *** 2680,2690 ****
>>   #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE (NODE)
>>
>>   /* Nonzero for a DECL which is actually a template parameter.  */
>> ! #define DECL_TEMPLATE_PARM_P(NODE) \
>> !   (DECL_LANG_FLAG_0 (NODE) \
>> !    && (TREE_CODE (NODE) == CONST_DECL \
>> !        || TREE_CODE (NODE) == PARM_DECL \
>> !        || TREE_CODE (NODE) == TYPE_DECL \
>>          || TREE_CODE (NODE) == TEMPLATE_DECL))
>>
>>   /* Mark NODE as a template parameter.  */
>> --- 2669,2677 ----
>>   #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE (NODE)
>>
>>   /* Nonzero for a DECL which is actually a template parameter.  */
>> ! #define DECL_TEMPLATE_PARM_P(NODE) \
>> !   (DECL_LANG_FLAG_0 (NODE) \
>> !    && (IN_RANGE (TREE_CODE (NODE), CONST_DECL, TYPE_DECL) \
>>          || TREE_CODE (NODE) == TEMPLATE_DECL))
>>
>>   /* Mark NODE as a template parameter.  */


Now it's much harder to find out which codes are allowed for a
DECL_TEMPLATE_PARM_P, while it was obvious before. Maybe we should teach the
middle-end to use the IN_RANGE() semantic itself as an optimization. That'd
still make the reordering useful.

Giovanni Bajo


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