Xingzhi Pan <vengeance.storm@xxxxxxxxx> writes: >>> 3. Where can I find relevant source code? ÂI already did a find+grep >>> in gcc-4.4.3/gcc directory but I lack the general knowledge of the >>> overall structure of gcc so the result didn't help much. >> >> I'm not clear what you looking for. > > After seeing your answer above, I would like to rephrase my questions > as: which source files should I look at to learn how the optimizations > of bitfield are done? I guess that means I need to look at the IR > optimization relevant to bitfield. Any further narrowing-down is > appreciated. GCC has various optimizations which apply to all structure field references. It does not have a lot of optimizations which apply specifically to bitfield references. However, there is at least one: look for optimize_bit_field_compare in gcc/fold-const.c. It may also be interesting to look at how GIMPLE bitfield references are converted to RTL, in store_bit_field and and extract_bit_field in gcc/expmed.c. >>> 4. Is there any special flags for this feature? >> >> Not clear here either, sorry. > > I mean is there any gcc command line switch to turn on/off these > bitfield optimizations? Not independently of other optimizations, no. Ian