arm: patch for output_return_instruction

Richard Earnshaw rearnsha@arm.com
Wed Feb 13 06:52:00 GMT 2002


> This is an updated version of an old patch from last year sometime.
> The changes are only really interesting when interworking is enabled; it
> converts code like
> 
> 	str	lr, [sp, #-4]!
> 	bl	f
> 	ldmfd	sp!, {lr}
> 	bx	lr
> 
> into either (ARMv4T)
> 
>         str     lr, [sp, #-4]!
>         bl      f
>         ldr     lr, [sp], #4
>         bx      lr
> 
> or (ARMv5)
> 
>         str     lr, [sp, #-4]!
>         bl      f
>         ldmfd   sp!, {pc}

Two things about this last form.

1) "ldr pc, [sp], #4" will also work in this case.
2) We really need a way to turn this final form off without losing the 
other v5 features.  V5 cpus can disable ldr/ldm PC from permitting a mode 
change (though most people won't want to do that).  Oh dear! another 
flag...

R.




More information about the Gcc-patches mailing list