Bozos

Mark Terribile mat at hou4b.UUCP
Thu Mar 21 06:35:13 AEST 1985


>5) Register variables are a hopeless hack advertised as a feature by
>   lazy-ass compiler writers.  Even when I DO know which variables are
>   more frequently used, I cannot achieve the same results as a worthwhile
>   compiler that places a variable in a register only when it really needs
>   to be there, and then (GASP!) puts SOMETHING ELSE in that same register.

>David Chase, Rice University

The problem of deciding what to place in fast, easy-to-access registers is
dependent on whether you need to optimize for space or speed, on which paths
you expect to be be the most frequently executed, etc.  When you can show me
a compiler that can read the programmer's mind and be clairvoyant as well (to
determine what the program's input will be) I will accept your advice.

In the mean time, I welcome the chance to give the compiler hints as to what
should be made easily addressable, though it would be nice to have it make a
try if you don't.

If you tell me that space is irrelevant, then I can only assume that your
code will be running on machines that you don't buy.  If you have to write code
for an embedded application, and you expect to sell 100 000 of them, then you
are damn well concerned with how little memory you can squeeze your code into.
And if you are writing real-time applications, you sure do care about how fast
things run.

This is not to say that compilers shouldn't be better.  They should.  Most
production compilers have some awful mishandling of some really simple cases.
But why shouldn't a compiler be willing to take a little advice?

If you want to bellyache, how about the hardware designers who make it easier
to address this datum than that datum?  Don't bother.  There are engineering
trade-offs, and unless you've done it once or twice yourself, please don't
pontificate.

As to sharing registers ...

	{
		register struct schmonk	schp = exschmonk[ newschmonk ].next;

		...
	}

	{
		register int	n_widget;	

		...
	}

'nuf said?
-- 

	from Mole End			Mark Terribile
		(scrape .. dig )	hou4b!mat
    ,..      .,,       ,,,   ..,***_*.



More information about the Comp.lang.c mailing list