public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* struct tree_type
@ 2010-07-13  0:29 BLUE 3TOO
  2010-07-13  9:09 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: BLUE 3TOO @ 2010-07-13  0:29 UTC (permalink / raw)
  To: gcc gcc


Hello,
 
    I did a quick search on "gcc internal" document and cannot find any explanation about the field meaning of struct tree_type. I am trying to use typedef to introduce some new aggregrate types that my gcc can handle. And I want to mark these  types so that I can handle these types specifically.  I might have to differenciate my own types into several categories, therefore I need several marking bits. My application will be in C/C++. Is there any fields that I can recycle? Or it is better to introduce some new fields. 
 
 
     Can somebody quickly explain what the bit fields are for? thanks
 
  unsigned int precision : 10;
  unsigned no_force_blk_flag : 1;
  unsigned needs_constructing_flag : 1;
  unsigned transparent_aggr_flag : 1;
  unsigned restrict_flag : 1;
  unsigned contains_placeholder_bits : 2;
  ENUM_BITFIELD(machine_mode) mode : 8;
  unsigned string_flag : 1;
  unsigned lang_flag_0 : 1;
  unsigned lang_flag_1 : 1;
  unsigned lang_flag_2 : 1;
  unsigned lang_flag_3 : 1;
  unsigned lang_flag_4 : 1;
  unsigned lang_flag_5 : 1;
  unsigned lang_flag_6 : 1; 		 	   		  
_________________________________________________________________
Game on: Challenge friends to great games on Messenger
http://go.microsoft.com/?linkid=9734387

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: struct tree_type
  2010-07-13  0:29 struct tree_type BLUE 3TOO
@ 2010-07-13  9:09 ` Ian Lance Taylor
  2010-07-13 15:31   ` Manuel López-Ibáñez
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2010-07-13  9:09 UTC (permalink / raw)
  To: BLUE 3TOO; +Cc: gcc gcc

BLUE 3TOO <blue_3too@hotmail.com> writes:

>      Can somebody quickly explain what the bit fields are for? thanks
>  
>   unsigned int precision : 10;
>   unsigned no_force_blk_flag : 1;
>   unsigned needs_constructing_flag : 1;
>   unsigned transparent_aggr_flag : 1;
>   unsigned restrict_flag : 1;
>   unsigned contains_placeholder_bits : 2;
>   ENUM_BITFIELD(machine_mode) mode : 8;
>   unsigned string_flag : 1;
>   unsigned lang_flag_0 : 1;
>   unsigned lang_flag_1 : 1;
>   unsigned lang_flag_2 : 1;
>   unsigned lang_flag_3 : 1;
>   unsigned lang_flag_4 : 1;
>   unsigned lang_flag_5 : 1;
>   unsigned lang_flag_6 : 1; 		 	   		  

Look for the uses of the bitfields in the macros in tree.h, and look at
the comments on those macros.  Never refer to the fields directly;
always use the macros.

E.g., no_force_blk_flag is used in two macros, TYPE_NO_FORCE_BLK and
TYPE_IS_SIZETYPE, and the comments explain when those macros are valid
and what they mean.

The lang_flag_N fields are used for frontend specific purposes, so for
them you have to look at the individual frontends.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: struct tree_type
  2010-07-13  9:09 ` Ian Lance Taylor
@ 2010-07-13 15:31   ` Manuel López-Ibáñez
  0 siblings, 0 replies; 3+ messages in thread
From: Manuel López-Ibáñez @ 2010-07-13 15:31 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: BLUE 3TOO, gcc gcc

On 13 July 2010 11:09, Ian Lance Taylor <iant@google.com> wrote:
> BLUE 3TOO <blue_3too@hotmail.com> writes:
>
>>      Can somebody quickly explain what the bit fields are for? thanks
>>
>>   unsigned int precision : 10;
>>   unsigned no_force_blk_flag : 1;
>>   unsigned needs_constructing_flag : 1;
>>   unsigned transparent_aggr_flag : 1;
>>   unsigned restrict_flag : 1;
>>   unsigned contains_placeholder_bits : 2;
>>   ENUM_BITFIELD(machine_mode) mode : 8;
>>   unsigned string_flag : 1;
>>   unsigned lang_flag_0 : 1;
>>   unsigned lang_flag_1 : 1;
>>   unsigned lang_flag_2 : 1;
>>   unsigned lang_flag_3 : 1;
>>   unsigned lang_flag_4 : 1;
>>   unsigned lang_flag_5 : 1;
>>   unsigned lang_flag_6 : 1;
>
> Look for the uses of the bitfields in the macros in tree.h, and look at
> the comments on those macros.  Never refer to the fields directly;
> always use the macros.
>
> E.g., no_force_blk_flag is used in two macros, TYPE_NO_FORCE_BLK and
> TYPE_IS_SIZETYPE, and the comments explain when those macros are valid
> and what they mean.
>
> The lang_flag_N fields are used for frontend specific purposes, so for
> them you have to look at the individual frontends.

Blue_3too, an improvement would be to submit a patch adding the above
explanation as comments before the bitfields (where you would have
expected to find such explanation). Such a small patch does not
require copyright assignment, just send it to gcc-patches with a
changelog.

Cheers,

Manuel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-13 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-13  0:29 struct tree_type BLUE 3TOO
2010-07-13  9:09 ` Ian Lance Taylor
2010-07-13 15:31   ` Manuel López-Ibáñez

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).