This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Generated unique labels
- From: "Jonah" <gccmail at whalesolutions dot ca>
- To: "Richard Henderson" <rth at redhat dot com>,"James Buchanan" <jamesbuch at iprimus dot com dot au>,"Joseph D. Wagner" <wagnerjd at prodigy dot net>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 3 Jan 2003 12:27:49 -0000
- Subject: Re: Generated unique labels
- References: <5.1.0.14.0.20021230031449.009ec6a0@pop.iprimus.com.au> <5.1.0.14.0.20021230031449.009ec6a0@pop.iprimus.com.au> <5.1.0.14.0.20030103114214.009e9640@pop.iprimus.com.au>
I am a bit confused by where this conversation is going. Isn't the Projects
list item referring to having labels in inline assembler. I will give you
the problem I was having which I thought was the same problem as the
projects file item.
int simple_func (int b, int c)
{
int x;
asm (
"simple_func_loop_start:\n\t"
" Do Assebly Stuff \n\t"
" LOOP to simple_func_loop_start"
: [x] "=r" (x)
: [b] "r" (b), [c] "r" (c)
: "r0", "r1", "memory" );
return x;
}
int bigger_func ()
{
...
simple_func (1, 2);
...
simple_func (4, 1);
}
If I compile the above I get simple_func inlined in bigger_func twice,
casuing the same label "simple_func_loop_start" to exist twice in the
assembly for function bigger_func. If there was a way to generate a unique
label in the asm block, the inlining could then give me two different
labels.
For example if the asm statement were extended to have a fifth field which
was the number of unique labels needed in the asm block, or a list of the
names of the unqiue labels like this:
asm (
"%[simple_func_loop_start]:\n\t"
" Do Assembly Stuff \n\t"
" Loop to %[simple_func_loop_start]"
: [x] "=r" (x)
: [b] "r" (b), [c] "r" (c)
: "r0", "r1", "memory"
: "simple_func_loop_start" );
Is what I have described above the project described in the projects file?
Maybe we could have a little discussion about the best syntax for this
extension?
Jonah
In the Projects file:
===
Generated unique labels. Have some way of generating distinct
labels for use in extended asm statements. I don't know what a
good syntax would be.
===
----- Original Message -----
From: "James Buchanan" <jamesbuch@iprimus.com.au>
To: "Richard Henderson" <rth@redhat.com>
Cc: <gcc@gcc.gnu.org>
Sent: Friday, January 03, 2003 12:43 AM
Subject: Re: Generated unique labels
> This means a different label syntax for different assembler languages
> doesn't it? So the function needs to know an "assembly context"
> depending on what the target CPU is for the program.
>
> At 04:25 PM 1/2/2003 -0800, Richard Henderson wrote:
> >On Mon, Dec 30, 2002 at 03:31:30AM +1100, James Buchanan wrote:
> > > Has this been done yet? If not has anyone been assigned to it?
> >
> >No and no. Best option is to use assembler local labels.
> >
> >
> >r~