public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ia64: accept alternative forms of .pred.rel
@ 2005-01-31 16:32 Jan Beulich
  2005-01-31 20:48 ` James E Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-01-31 16:32 UTC (permalink / raw)
  To: binutils

Change to allow ias forms of .pred.rel (with @-prefixed designators).
Also
eliminate a memory leak in the original code dealing with the quoted
form.

Built and tested on ia64-unknown-linux-gnu.

Jan

gas/
2005-01-31  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (dot_pred_rel): Update comment. Handle
@-prefixed
	designators along with quoted ones. Free copy of quoted
designator
	when done.

gas/testsuite/
2005-01-31  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/pred-rel.s: New.
	* gas/ia64/ia64.exp: Run new test.

---
/home/jbeulich/src/binutils/mainline/2005-01-31/gas/config/tc-ia64.c	2005-01-28
09:16:03.000000000 +0100
+++ 2005-01-31/gas/config/tc-ia64.c	2005-01-31 17:20:05.409146225
+0100
@@ -4773,9 +4773,9 @@ print_prmask (mask)
 }
 
 /*
-  .pred.rel.clear [p1 [,p2 [,...]]]     (also .pred.rel "clear")
-  .pred.rel.imply p1, p2                (also .pred.rel "imply")
-  .pred.rel.mutex p1, p2 [,...]         (also .pred.rel "mutex")
+  .pred.rel.clear [p1 [,p2 [,...]]]     (also .pred.rel "clear" or
@clear)
+  .pred.rel.imply p1, p2                (also .pred.rel "imply" or
@imply)
+  .pred.rel.mutex p1, p2 [,...]         (also .pred.rel "mutex" or
@mutex)
   .pred.safe_across_calls p1 [, p2 [,...]]
  */
 
@@ -4789,28 +4789,43 @@ dot_pred_rel (type)
 
   if (type == 0)
     {
-      if (*input_line_pointer != '"')
-	{
-	  as_bad (_("Missing predicate relation type"));
-	  ignore_rest_of_line ();
-	  return;
-	}
-      else
+      if (*input_line_pointer == '"')
 	{
 	  int len;
 	  char *form = demand_copy_C_string (&len);
+
 	  if (strcmp (form, "mutex") == 0)
 	    type = 'm';
 	  else if (strcmp (form, "clear") == 0)
 	    type = 'c';
 	  else if (strcmp (form, "imply") == 0)
 	    type = 'i';
-	  else
-	    {
-	      as_bad (_("Unrecognized predicate relation type"));
-	      ignore_rest_of_line ();
-	      return;
-	    }
+	  obstack_free (&notes, form);
+	}
+      else if (*input_line_pointer == '@')
+	{
+	  char *form = ++input_line_pointer;
+	  char c = get_symbol_end();
+
+	  if (strcmp (form, "mutex") == 0)
+	    type = 'm';
+	  else if (strcmp (form, "clear") == 0)
+	    type = 'c';
+	  else if (strcmp (form, "imply") == 0)
+	    type = 'i';
+	  *input_line_pointer = c;
+	}
+      else
+	{
+	  as_bad (_("Missing predicate relation type"));
+	  ignore_rest_of_line ();
+	  return;
+	}
+      if (type == 0)
+	{
+	  as_bad (_("Unrecognized predicate relation type"));
+	  ignore_rest_of_line ();
+	  return;
 	}
       if (*input_line_pointer == ',')
 	++input_line_pointer;
---
/home/jbeulich/src/binutils/mainline/2005-01-31/gas/testsuite/gas/ia64/ia64.exp	2005-01-27
10:09:57.000000000 +0100
+++ 2005-01-31/gas/testsuite/gas/ia64/ia64.exp	2005-01-31
17:20:05.410122787 +0100
@@ -35,6 +35,7 @@ if [istarget "ia64-*"] then {
     run_dump_test "dv-branch"
     run_dump_test "dv-imply"
     run_dump_test "dv-mutex"
+    gas_test "pred-rel.s" "" "" ".pred.rel alternative forms"
     run_dump_test "dv-safe"
     run_dump_test "dv-srlz"
     run_dump_test "tls"
---
/home/jbeulich/src/binutils/mainline/2005-01-31/gas/testsuite/gas/ia64/pred-rel.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-01-31/gas/testsuite/gas/ia64/pred-rel.s	2005-01-31
16:39:14.000000000 +0100
@@ -0,0 +1,21 @@
+// Make sure all forms of .pred.rel are accepted
+_start:
+	.pred.rel "mutex", p1, p2
+	.pred.rel "imply", p2, p3
+	.pred.rel "clear", p1, p2, p3
+
+	.pred.rel "mutex" p1, p2
+	.pred.rel "imply" p2, p3
+	.pred.rel "clear" p1, p2, p3
+
+	.pred.rel.mutex p1, p2
+	.pred.rel.imply p2, p3
+	.pred.rel.clear p1, p2, p3
+
+	.pred.rel @mutex, p1, p2
+	.pred.rel @imply, p2, p3
+	.pred.rel @clear, p1, p2, p3
+
+	.pred.rel @mutex p1, p2
+	.pred.rel @imply p2, p3
+	.pred.rel @clear p1, p2, p3

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

* Re: [PATCH] ia64: accept alternative forms of .pred.rel
  2005-01-31 16:32 [PATCH] ia64: accept alternative forms of .pred.rel Jan Beulich
@ 2005-01-31 20:48 ` James E Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: James E Wilson @ 2005-01-31 20:48 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Mon, 2005-01-31 at 08:32, Jan Beulich wrote:
> Change to allow ias forms of .pred.rel (with @-prefixed designators).

Neither the Intel Assembly Language Reference Guide nor the Intel
Assembler User's Guide mentions this syntax.  Where did it come from? 
We already have two supported syntaxes.  Do we really need a third one? 
I do agree that using @ operators here makes sense though, as it makes
it more similar to how other directives work, but I'd like to know more
about why we need it.

Otherwise, this looks OK.

> Also
> eliminate a memory leak in the original code dealing with the quoted
> form.

There are 3 places that call demand_copy_C_string, and only one calls
obstack_free afterwards.  The other one is much harder to fix though. 
Curiously, I see that tc-ia64.c is not the only config file that calls
demand_copy_C_string, but it is the only one calling obstack_free
afterwards.  It does look like the right thing to do though.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Re: [PATCH] ia64: accept alternative forms of .pred.rel
  2005-02-01  8:07 Jan Beulich
@ 2005-02-01 20:27 ` James E Wilson
  0 siblings, 0 replies; 4+ messages in thread
From: James E Wilson @ 2005-02-01 20:27 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, 2005-02-01 at 00:07, Jan Beulich wrote:
> I assume this is because these are rather aged;

Yes, I noticed that the manual hasn't been updated since 2001, though
the sources seem to have been updated every year.  This is unfortunate. 
We can't keep gas compatible with ias if we can't get documentation.

> learned about them (perhaps release notes). In any case I would think
> one could check with their assembler sources, but the simple observation
> that ias accepts these speaks for itself, I guess.

I can't look at the Intel assembler sources.  If I do, then any gas
sources I write would be a derived work, subject to copyright by Intel. 
And since I can't get a copyright assignment from Intel, I would no
longer to able to contribute to gas.

> I'll wait for your final agreement to commit based on the above.

Yes, it is OK.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Re: [PATCH] ia64: accept alternative forms of .pred.rel
@ 2005-02-01  8:07 Jan Beulich
  2005-02-01 20:27 ` James E Wilson
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2005-02-01  8:07 UTC (permalink / raw)
  To: wilson; +Cc: binutils

>>> James E Wilson <wilson@specifixinc.com> 31.01.05 21:48:41 >>>
>On Mon, 2005-01-31 at 08:32, Jan Beulich wrote:
>> Change to allow ias forms of .pred.rel (with @-prefixed
designators).
>
>Neither the Intel Assembly Language Reference Guide nor the Intel
>Assembler User's Guide mentions this syntax.  Where did it come from?

>We already have two supported syntaxes.  Do we really need a third
one? 
>I do agree that using @ operators here makes sense though, as it
makes
>it more similar to how other directives work, but I'd like to know
more
>about why we need it.

I assume this is because these are rather aged; at least I haven't been
able to find recent copies anywhere. These alternative syntaxes where
added fairly late in the Itanium1 time frame I believe (and obviously
for exactly the sake of consistency), and but I don't recall how I
learned about them (perhaps release notes). In any case I would think
one could check with their assembler sources, but the simple observation
that ias accepts these speaks for itself, I guess.

>Otherwise, this looks OK.

I'll wait for your final agreement to commit based on the above.

>> Also
>> eliminate a memory leak in the original code dealing with the
quoted
>> form.
>
>There are 3 places that call demand_copy_C_string, and only one calls
>obstack_free afterwards.  The other one is much harder to fix though.

>Curiously, I see that tc-ia64.c is not the only config file that
calls
>demand_copy_C_string, but it is the only one calling obstack_free
>afterwards.  It does look like the right thing to do though.

Yes, I saw one other, more difficult to fix place immediately, too. And
I thought of grepping for similar instances, but at this point I didn't
do so. I may at some point, and then also check for (less likely)
demand_copy_string uses.

Jan

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

end of thread, other threads:[~2005-02-01 20:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-31 16:32 [PATCH] ia64: accept alternative forms of .pred.rel Jan Beulich
2005-01-31 20:48 ` James E Wilson
2005-02-01  8:07 Jan Beulich
2005-02-01 20:27 ` James E Wilson

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