Explicitly naming loop labels

Guest #1921340
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
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

A question of your own? This thread is over 16 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.