[net.lang] function call implementation query

emjej@uokvax.UUCP (04/23/84)

#N:uokvax:9000023:000:1277
uokvax!emjej    Apr 23 12:35:00 1984

I have implemented a code generator which uses the convention of "caller
saves whatever registers it wants saved." This convention typically works
very well (especially since often there are no such registers, and thank
you, Guy Steele, wherever you are, for writing "The Myth of the Expensive
Procedure Call, or Lambda: the Ultimate GOTO"), but sometimes, I find

			<save registers>
			call FOO
			<restore registers>
			<save registers>
			call BAR
			...

and I want to collapse the consecutive restore/save (or keep only
deltas, such as the register that no doubt contains the result of FOO).
(Oh, yes; this is for a C compiler, by the way, and the compiler as it
stands may well generate *worse* code if you use register variables
with reckless abandon!) Has anyone done this sort of thing? Please mail
responses, and I'll summarize after a reasonable interval (about 2
weeks, I reckon).

						James Jones

Come to think of it, here is as good a place as any for me to partially
recant previous rantings of mine about C. Even though the pre/post
increment/decrement operators *are* inspired by the PDP-11, it is not
too hard to implement them without those addressing modes quite
respectably. (No doubt everybody knew this already, but confession is
good for the soul.)