git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH GIT 0.6] make use of register variables & size_t

From
Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org> <7eggert@gmx.de>
Date
Apr 26, 2005, 18:18 UTC
Message-ID
<E1DQUdL-0000rx-P3@be1.7eggert.dyndns.org>
In-Reply-To
<3XfpD-21C-11@gated-at.bofh.it>
Matthias-Christian Ott <matthias.christian@tiscali.de> wrote:
> And if you think "register" variables are outdated, please remove the
> CONFIG_REGPARM option from the Kernel source.

Register variables are outdated because they hinder the compiler from optimizing by taking away 1/7 of the usable registers on x86. Use six register variables and you're back to a accumulator-machine. Use -O2 or -Os instead, the compiler is smarter than you.

The regparm calling convention will change the load value -> store value on stack -> call sequence into load value -> call -> store if needed Obviously the second form can be better optimized than the first one. Therefore it's a gain instead of a loss.

If you really want to help the compiler, look for something like repeated pointer dereference or access to global variables and cache them in block- local variables (pointers, int and uint only, even for caching chars). Beware of volatile variables, and don't forget to look at the assembler code.

-- 
The generation of random numbers is too important to be left to chance. 
Previous: Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>
Message 2 of 2 in “Re: [PATCH GIT 0.6] make use of register variables & size_t”
  1. Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>Apr 25, 2005
  2. Bodo Eggert <harvested.in.lkml@posting.7eggert.dyndns.org>Apr 26, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.