code generation for arm targets

Nick Clifton nickc@cygnus.com
Wed Mar 22 10:11:00 GMT 2000


Hi Vadim,

: I see some strange things in code generation for arm-elf target:
:
:     28		str	lr, [sp, #-4]!
: 
: Take a look at line 28.
: 
: The lr register is saved in the "unallocated" stack area. The stack
: pointer is updated to include local variables frame only  at line
: 33. 

No its not.

: Wouldn't it be safer (with respect to interrupt and signal handling)
: to update the stack pointer immiedately upon entering the function? 

You missed the ! at the end of the instruction.  This indicates a
pre-indexed addressing mode.  In this case the instruction will
compute:

	sp  = sp - 4
	*sp = lr

so that stack pointer is updated before (or at the same time as) the
stack slot is written to.

Cheers
	Nick


More information about the Gcc mailing list