This is the mail archive of the gcc-help@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: Do not spill variables/registers on the stack


On Thu, Feb 3, 2011 at 12:58 PM, David Brown <david@westcontrol.com> wrote:
> On 03/02/2011 10:56, Drasko DRASKOVIC wrote:
>>
>> On Thu, Feb 3, 2011 at 10:42 AM, David Brown<david@westcontrol.com>
>> ?wrote:
>>>
>>> My understanding is that "register" is ignored at -O1 and above, which
>>> would
>>> seem to match your experience.
>>
>> You wanted to say "-O1 and below", right ?
>>
>
> No, "register" is ignored at -O1 and above. ?When the optimiser is enabled,
> /it/ decides whether data should go in a register, or has to go on the
> stack, or can be eliminated entirely. ?It is only at -O0 that the compiler
> puts everything on the stack by default, and puts "register" data in
> registers. ?That's why the "register" keyword has been considered redundant
> for many years - the compiler almost always does a much better job than any
> human at deciding what data to put in registers.

OK, thanks.

This would say that Stefan has no problem at all, because he wanted to
compile his program without optimization (thus -O0) and put "register"
variables in registers (which will be done, because compiler will not
ignore "register keyword at this level, as the code he pasted before
proves).

BR,
Drasko


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