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




_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to