This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about usage of r12 (ip) on ARM


>> Couldn't this be compiled to as the following, with using r12 'ip':
>> 
>> 00000000 <test>:
>> 0: xxxxxxxx push {r4, lr}
>> 4: xxxxxxxx mov r4, r0
>> 8: xxxxxxxx ldr ip, [r0]
>> c: xxxxxxxx bl 0 <func>
>> 10: xxxxxxxx str ip, [r4]
>> 14: xxxxxxxx pop {r4, pc}
>> 
>
>No. IP cna be clobbered either by func itself or any
>inter-procedural
>veneer that might be generated by the linker. You'd need to prove
>that
>neither could happen before IP could be used to hold a value over a
>function call.
>
>R.

Ah, yes of course you are right, my mistake.

Meaning also that r1-r3 which be used as unsused arguments/scratch in this case cannot be used either,
since inner function calls are not obliged to restore them according to AAPCS.
I think I got confused by the dummy register pushes added to keep stack alignment.

Thanks!
BR Fredrik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]