Explicitly naming loop labels

Guest #1921340
Rate this post
useful
not useful
Hello.

I was wondering if it is possible to explicitly attribute name to the 
labels that mark a loop entry.

By default, those are named something like ".L2".

What I would like is to be able to do something like

asm ("my_loop_label")
for(i=0...)

and the compilation would yield ARM assembly with that label name at the 
loop entry point.

Is something like that possible?

If not, do you happen to know a way to detect loops in ARM assembly?

Thank you.
#1921771
Rate this post
useful
not useful
Did you check out asm goto?

http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

This if for gcc >= 4.5 and said to be unstable...

Then, if you program GNU-C building a C-label and passing it to the 
assembler should work. However, I never tried that, look hackish, works 
for local labels only and you probably have to jump indirect.

Maybe most convenient will be to just return some value and jump 
conditionally on that instead of jumping from inside asm.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now