AVR GCC: register usage changeable?

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

is it possible to change compiler options in a way that it doesn't use specific AVR registers? Is it possible to use a different calling convention? (default is R25 - R16 + stack, isn't it?)

Regards

Thomas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For obvious reasons, you can't change the calling convention without
modifying the compiler source code. (IIRC, you can choose a different
register allocation algorithm, but I've got no ideas how much value
this would really have.)

You can globally bind a variable to a register though (see the
avr-libc FAQ), but you gotta be careful about this feature. If you
exaggerate this, you're likely to cause the compiler to pessimize your
code since it is no longer free in its register allocator. Also, not
all registers are safe for global allocation, IIRC you can only use
regs r2 through r15.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.