[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] SIGNAL and INTERRUPT overhead
From: |
Bernard Fouché |
Subject: |
Re: [avr-gcc-list] SIGNAL and INTERRUPT overhead |
Date: |
Tue, 23 Aug 2005 16:39:59 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Royce Pereira wrote:
That's a big problem with the usual way of building code, with
functions or set of related functions in
different files. When the compiler groks the files, it does not have
all the information that would help it build a much better optimized
code.
If a 'callee-saves" convention is followed universally, then the
calling function need not know the registers used by the callee, right?
--Royce.
Suppose you have:
f1()
{
push rA
push rB
.. uses rA & rB then does not care of their value until the end of the
function..
f2()
...
f2()
..
f2()
pop rB
pop rA
}
f2()
{
push rA
push rB
.. uses rA & rB..
pop rB
pop rA
}
If f2() is only called from f1(), then it is possible to skip the
push/pops in f2().
If f2() is called only once in the final .elf then it could have been
inline'd with
a sure win.
The point is that you don't need anymore "callee-saves" convention when you
don't need to call a function anymore, or if you perfectly know what the
called
function does, you can optimize (and break!) the convention locally.
If f1() and f2() are in two different files, the compiler can not know what
to do in a optimal way and has to stick to the convention.
Bernard