On Mon, Apr 11, 2011 at 1:46 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > Xingzhi Pan <vengeance.storm@xxxxxxxxx> writes: > >> 1. Does gcc compile C bitfields into some intermediate representation (IR)? > > Yes. > >> 2. If so, does the optimization happen BEFORE or AFTER the IR? Or both? > > What optimization in particular? BEFORE or AFTER what? In general, the > answer is going to be that optimizations are applied to the IR, so they > are applied after the IR is created and before it is converted to > assembly code. gcc has bitfield optimizations which apply to both the > GIMPLE and the RTL IRs. Thanks. This is the answer I want. I didn't have any particular optimization in mind when asking this question. > >> 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. > >> 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? > > You said you wanted "to learn how to optimize bitfield compilation" but > I don't know what that means to you. Sorry about the confusion. I'm doing a research on optimizing bitfield compilation (probably to be implemented in some dialect of Haskell which deals with low-level system programming). Thank you very much for your help. > > Ian >