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


* David Brown <david@westcontrol.com> wrote:

> No, it's a hint - but one that gcc will take seriously and do its best 
> to honour (at -O0).  The compiler cannot guarantee that it will be able 
> to put the data into a register - there are many things that could keep 
> it out of the register, including register pressure and the way the data 
> is used.  The text says that with -O0 gcc will put all non-register 
> variables on the stack - that does /not/ imply that it will put all 
> register variables in registers.

What does the ANSI C spec say about the "register" keyword ?

Does GCC issue some warning when it fails to put such a variable
directly into a register ?

Is it that keyword still useful at all on todays compilers ?


I'm not really experienced at that low level, but i can imagine 
scenarios where it's essential to keep certain things in registers
(eg. when there's no valid stack), so the compiler should issue
a warning (which can be made fatal w/ -Werror) in those cases.



cu
-- 
----------------------------------------------------------------------
 Enrico Weigelt, metux IT service -- http://www.metux.de/

 phone:  +49 36207 519931  email: weigelt@metux.de
 mobile: +49 151 27565287  icq:   210169427         skype: nekrad666
----------------------------------------------------------------------
 Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
----------------------------------------------------------------------


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