avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Tablejumps - needless run time conversion to byte address


From: Andrew Hutchinson
Subject: [avr-gcc-list] Tablejumps - needless run time conversion to byte address
Date: Fri, 04 Jan 2008 12:56:14 -0500
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hi

Does anyone have some code that creates tablejump in Avr-gcc? This is where gcc will create table instead of long line of if-then-else tests

I cant seem to create enough switch cases to force one!

I have been looking at compilation patterns and noticed that gcc address is multiplied by 2 to form address for LPM (table being in ROM). LPM needs byte address and gcc has word address.
"lsl r30
  rol r31
  lpm __tmp_reg__,Z+
  lpm r31,Z
  mov r30,__tmp_reg__
  ijmp"

Asm Pattern currently expects value to be in R30. However, it would appear that this would be better with a symbol rather than value in register - thus providing a means to multiply that value by 2 at compile time. (and I cant see any reason it would be called with other than constant address in ROM)

Obviously, I'd like to test it.

Andy






reply via email to

[Prev in Thread] Current Thread [Next in Thread]