This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Optimizing gcc to use lr / r14 in leaf functions...?

Note: This was originally posted on 5th November 2009 at http://forums.arm.com

Hi everyone,

I'm having difficulty convincing gcc to use r14 when cross-compiling C code for my most critical leaf function - arguably the oldest ARM hand-coding trick in the book (yes, I had an Archimedes), yet it's just not happening here. :-(

Is there some kind of secret gcc option-fu trickery that enables this? Or are there any special conditions which make gcc think that non-function-calling functions should not be treated as leaf functions?

Any suggestions or comments much appreciated!

Cheers, ....Nick Pelling....

PS: this is what "arm-elf-gcc --v" returns, in case this is a silent side-effect of one of the preconfigured options:-

Configured with: ../gcc-4.4.1/configure --target=arm-elf --prefix=/home/yagarto/install --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 --enable-languages=c,c++ --enable-interwork --enable-multilib --with-newlib --with-headers=../newlib-1.17.0/newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp -v

Thread model: single
gcc version 4.4.1 (GCC)


...and this is the basic command line I'm using (note that I've tried both -O2 and -O3 optimization levels without success)...

arm-elf-gcc -mtune=arm926ej-s -Wall -g -O2 -c -o obj\main.o main.c


PPS: might it conceivably be that the arm926ej-s does not allow r14 to be used as a completely general-purpose register?
0