public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Generated unique labels
@ 2002-12-29 11:47 James Buchanan
  2003-01-02  7:42 ` Joseph D. Wagner
  2003-01-03  0:25 ` Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: James Buchanan @ 2002-12-29 11:47 UTC (permalink / raw)
  To: gcc

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.
===

Has this been done yet?  If not has anyone been assigned to it?

Where would this be done?  What is an extended asm statement,
is this asm code generated by the back end?  Is there any
distinction between asm and extended asm?  So things peculiar
to local labels can't be used?

Would this be a function, let's say:

...in file uniquelabel.h

char *
gen_unique_label();

...in file uniquelabel.c
char *
gen_unique_label()
{
	/* Get some memory or just return a pointer?? */
	char *the_label = (char *)safe_malloc();

	/*
	Let's say we only use a static char array
	and return a pointer to it.  The caller gets it
	and copies the string straight away, but
	this seems silly.  Functions should take
	care of it.
	*/
	
	/*
	Or perhaps allocate a string, the caller
	can do free(the_label)
	*/

	/* do stuff */
	return (the_label);
}

?

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Generated unique labels
@ 2003-01-07 16:29 Joern Rennecke
  0 siblings, 0 replies; 10+ messages in thread
From: Joern Rennecke @ 2003-01-07 16:29 UTC (permalink / raw)
  To: Jonah; +Cc: Richard Henderson, James Buchanan, Joseph D. Wagner, gcc

> 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;
> }

I'm a bit surprised that this conversation is going on at all.  We got the
%= output specifier which is perfectly fine to handle this problem, and it
is documented in md.texi.

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;
} 

-- 
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-01-07 15:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-29 11:47 Generated unique labels James Buchanan
2003-01-02  7:42 ` Joseph D. Wagner
2003-01-03  0:43   ` James Buchanan
2003-01-03  0:25 ` Richard Henderson
2003-01-03  0:44   ` James Buchanan
2003-01-03 12:28     ` Jonah
2003-01-03 17:34       ` Richard Henderson
2003-01-03 18:16         ` Jonah
2003-01-03 19:37           ` Joseph S. Myers
2003-01-07 16:29 Joern Rennecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).