This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Remove workaround for copy_backward
Phil Edwards <phil@jaj.com> writes:
| On Mon, Sep 29, 2003 at 06:13:01PM +0200, Gabriel Dos Reis wrote:
| >
| > Because C and C++ have genuire separate compilation models :-). The
| > above example is the function definition, and in that context it is
| > clear that the last argument is not used. However, a call to foo
| > needs only to have its prototype available. And prototype does say
| > nothing about used parameters.
|
| Exactly. Which is wh- ah, I see the disconnect. It all depends on who's
| responsible for loading the registers. If it's the caller, as in your
| model, there's no way to know and the register must be loaded. If the
| called fuction is responsible for loading its arguments from known relative
| stack addresses, the compiler can generate code that safely ignores the
| unused arguments.
even in the calleed load model, the compiler could make an economy of
evaluating/placing those expressions in appropriate slots for the
callee to load.
| I doubt that our compiler tries to perform that particular "optimization"
| on those platforms for which it is appropriate. It may not even be a real
| win, because (IIRC) the appropriate platforms are not register-starved to
| begin with.
I have no idea of which targets do callee load.
However, I'm almost certain that it will be a non-negligible win for
targets like SPARCs or PowerPCs to be freed of unncessary/redundant loads.
-- Gaby