[Icc-430] Re: Interrupt handler wrapper preserves R8,9 - repost

bailey at peak.org bailey at peak.org
Thu Jan 25 15:11:44 PST 2007


Richard,
    As I commented earlier, I strongly agree with Kris on this.  I
understand your point of view well (I spent a decade doing compiler support
myself!), but if you follow your logic further you would decide that you
really should preserve ALL the registers with the wrapper, "just in case"!

    This is a real issue for folks and you already have a calling convention
that you have defined and is well documented.  Better that folks that follow
the rules get good results than people who don't follow the rules have
bad code with a slightly higher chance of working by accident.

    My two cents.

    Kirk Bailey
    bailey at peak.org

> The problem here is that the compiler does not compute the total register
> usage of all functions nor generate a call graph (it can't anyway) so if
> your ISR calls out to another routine, that routine can be anything! C,
> asm, who knows that may eventually touch preserved registers etc. In
> theory, we can ignore the preserved registers IF the users read the manual
> and obey the calling convention. However, if they don't, their ISR may
> fail
> randomly and usually the compiler gets blamed for random failures :-) [
> Just have a case where a user says: hey the AVR compiler is unreliable
> when
> my program gets bigger than 64K bytes on the AVR, and it turns out to be
> his hardware power supply problem... The worst is people are very keen on
> blaming the compiler and usually not tell me when they found out it's not
> the compiler problem after all, leaving me wondering whether it is a
> compiler .... but I digress. sorry]
>
> Anyway, I know what you are saying, I am just weighting the PROs and
> CONs...
>
> At 12:10 PM 1/25/2007, Kris Heidenstrom wrote:
> ...Sorry, I was not clear. I should have said... my interrupt handler
>>calls a function. That's all it does. (The function is also called from
>>elsewhere.) So the interrupt handler code itself doesn't destroy
>>any registers, it is only the called function that does. That's why I
>>listed the descriptions of the "preserved registers" and "volatile
>>registers" from the help.
>>
>>...
>
> // richard (This email is for mailing lists. To reach me directly, please
> use richard at imagecraft.com)
>
> _______________________________________________
> Icc-430 mailing list
> Icc-430 at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-430
>




More information about the Icc-430 mailing list