public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] ia64: certain symbol names were unusable
@ 2005-02-11 15:54 Jan Beulich
  2005-02-17  3:22 ` James E Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2005-02-11 15:54 UTC (permalink / raw)
  To: wilson; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 4592 bytes --]

>>> James E Wilson <wilson@specifixinc.com> 11.02.05 01:33:29 >>>
>On Tue, 2005-02-08 at 03:16, Jan Beulich wrote:
>> +      if (name[1] == 'n' && ISDIGIT (name[idx = 2]))
>> +	dr = &md.in;
>
>Please don't hide assignments like this.  It makes the code hard to
>read.  This should be name[2] with "idx = 2;" on a separate line.
>...
>> +  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))
>
>This one puzzled me for a while.  There should be a comment
explaining
>what it is for, to ignore any number with a leading zero, other than
>zero itself.

Update patch below/attached (the original one also didn't apply anymore
after one of the others was committed).

Jan

gas/
2005-02-11  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
	parsing inN, locN, outN. Set 'idx' to offset register number
starts
	at. Don't handle numbers with leading zeroes or beyond 95.
Remove
	pointless cast.

gas/testsuite/
2005-02-11  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/nostkreg.[ds]: New.
	* gas/ia64/ia64.exp: Run new test.

---
/home/jbeulich/src/binutils/mainline/2005-02-11/gas/config/tc-ia64.c	2005-02-11
11:09:20.000000000 +0100
+++ 2005-02-11/gas/config/tc-ia64.c	2005-02-11 11:29:01.872465160
+0100
@@ -7482,7 +7482,6 @@ ia64_parse_name (name, e, nextcharP)
 {
   struct const_desc *cdesc;
   struct dynreg *dr = 0;
-  unsigned int regnum;
   unsigned int idx;
   struct symbol *sym;
   char *end;
@@ -7588,13 +7587,14 @@ ia64_parse_name (name, e, nextcharP)
     }
 
   /* check for inN, locN, or outN:  */
+  idx = 0;
   switch (name[0])
     {
     case 'i':
       if (name[1] == 'n' && ISDIGIT (name[2]))
 	{
 	  dr = &md.in;
-	  name += 2;
+	  idx = 2;
 	}
       break;
 
@@ -7602,7 +7602,7 @@ ia64_parse_name (name, e, nextcharP)
       if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
 	{
 	  dr = &md.loc;
-	  name += 3;
+	  idx = 3;
 	}
       break;
 
@@ -7610,7 +7610,7 @@ ia64_parse_name (name, e, nextcharP)
       if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
 	{
 	  dr = &md.out;
-	  name += 3;
+	  idx = 3;
 	}
       break;
 
@@ -7618,13 +7618,16 @@ ia64_parse_name (name, e, nextcharP)
       break;
     }
 
-  if (dr)
+  /* Ignore register numbers with leading zeroes, except zero itself. 
*/
+  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))
     {
+      unsigned long regnum;
+
       /* The name is inN, locN, or outN; parse the register number. 
*/
-      regnum = strtoul (name, &end, 10);
-      if (end > name && *end == '\0')
+      regnum = strtoul (name + idx, &end, 10);
+      if (end > name + idx && *end == '\0' && regnum < 96)
 	{
-	  if ((unsigned) regnum >= dr->num_regs)
+	  if (regnum >= dr->num_regs)
 	    {
 	      if (!dr->num_regs)
 		as_bad ("No current frame");
---
/home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/ia64.exp	2005-02-02
08:33:18.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/ia64.exp	2005-02-08
11:43:19.000000000 +0100
@@ -44,7 +44,8 @@ if [istarget "ia64-*"] then {
     run_dump_test "ldxmov-1"
     run_list_test "ldxmov-2" ""
     run_dump_test "ltoff22x-1"
-    
+
+    run_dump_test "nostkreg"
     run_list_test "invalid-ar" ""
 
     run_dump_test "dependency-1"
---
/home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/nostkreg.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/nostkreg.d	2005-02-04
15:02:33.000000000 +0100
@@ -0,0 +1,16 @@
+#objdump: -dr
+#name: ia64 not stacked registers
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]I\][[:space:]]+mov[[:space:]]+r5=0
+[[:space:]]+0:[[:space:]]+IMM22[[:space:]]+in00
+[[:space:]]+1:[[:space:]]+IMM22[[:space:]]+loc96
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r6=0
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r7=r32
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]B\][[:space:]]+mov[[:space:]]+r8=r34
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r9=r36
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+br\.ret\.sptk\.few[[:space:]]+(b0|rp);;
---
/home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/nostkreg.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/nostkreg.s	2005-02-04
14:47:29.000000000 +0100
@@ -0,0 +1,9 @@
+_start:
+	mov		r5 = in00
+	mov		r6 = loc96
+	.regstk 2, 6, 2, 8
+	.rotr in0I[2], loc1L[2], out2O[2]
+	mov		r7 = in0I[0]
+	mov		r8 = loc1L[0]
+	mov		r9 = out2O[0]
+	br.ret.sptk	rp


[-- Attachment #2: binutils-mainline-ia64-in-loc-out.patch --]
[-- Type: text/plain, Size: 4341 bytes --]

Variables starting with 'in', 'loc', or 'out' and continuing with decimal
numbers not fitting the 0-95 range (used for the stacked register aliases) or
starting with zeroes were considered reserved, while they really aren't.
Rotating registers allocated through .rotX could not start with 'in', 'loc',
or 'out' followed by at least one digit (and then anything) at all.

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

Jan

gas/
2005-02-11  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
	parsing inN, locN, outN. Set 'idx' to offset register number starts
	at. Don't handle numbers with leading zeroes or beyond 95. Remove
	pointless cast.

gas/testsuite/
2005-02-11  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/nostkreg.[ds]: New.
	* gas/ia64/ia64.exp: Run new test.

--- /home/jbeulich/src/binutils/mainline/2005-02-11/gas/config/tc-ia64.c	2005-02-11 11:09:20.000000000 +0100
+++ 2005-02-11/gas/config/tc-ia64.c	2005-02-11 11:29:01.872465160 +0100
@@ -7482,7 +7482,6 @@ ia64_parse_name (name, e, nextcharP)
 {
   struct const_desc *cdesc;
   struct dynreg *dr = 0;
-  unsigned int regnum;
   unsigned int idx;
   struct symbol *sym;
   char *end;
@@ -7588,13 +7587,14 @@ ia64_parse_name (name, e, nextcharP)
     }
 
   /* check for inN, locN, or outN:  */
+  idx = 0;
   switch (name[0])
     {
     case 'i':
       if (name[1] == 'n' && ISDIGIT (name[2]))
 	{
 	  dr = &md.in;
-	  name += 2;
+	  idx = 2;
 	}
       break;
 
@@ -7602,7 +7602,7 @@ ia64_parse_name (name, e, nextcharP)
       if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
 	{
 	  dr = &md.loc;
-	  name += 3;
+	  idx = 3;
 	}
       break;
 
@@ -7610,7 +7610,7 @@ ia64_parse_name (name, e, nextcharP)
       if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
 	{
 	  dr = &md.out;
-	  name += 3;
+	  idx = 3;
 	}
       break;
 
@@ -7618,13 +7618,16 @@ ia64_parse_name (name, e, nextcharP)
       break;
     }
 
-  if (dr)
+  /* Ignore register numbers with leading zeroes, except zero itself.  */
+  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))
     {
+      unsigned long regnum;
+
       /* The name is inN, locN, or outN; parse the register number.  */
-      regnum = strtoul (name, &end, 10);
-      if (end > name && *end == '\0')
+      regnum = strtoul (name + idx, &end, 10);
+      if (end > name + idx && *end == '\0' && regnum < 96)
 	{
-	  if ((unsigned) regnum >= dr->num_regs)
+	  if (regnum >= dr->num_regs)
 	    {
 	      if (!dr->num_regs)
 		as_bad ("No current frame");
--- /home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/ia64.exp	2005-02-02 08:33:18.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/ia64.exp	2005-02-08 11:43:19.000000000 +0100
@@ -44,7 +44,8 @@ if [istarget "ia64-*"] then {
     run_dump_test "ldxmov-1"
     run_list_test "ldxmov-2" ""
     run_dump_test "ltoff22x-1"
-    
+
+    run_dump_test "nostkreg"
     run_list_test "invalid-ar" ""
 
     run_dump_test "dependency-1"
--- /home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/nostkreg.d	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/nostkreg.d	2005-02-04 15:02:33.000000000 +0100
@@ -0,0 +1,16 @@
+#objdump: -dr
+#name: ia64 not stacked registers
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]I\][[:space:]]+mov[[:space:]]+r5=0
+[[:space:]]+0:[[:space:]]+IMM22[[:space:]]+in00
+[[:space:]]+1:[[:space:]]+IMM22[[:space:]]+loc96
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r6=0
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r7=r32
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]B\][[:space:]]+mov[[:space:]]+r8=r34
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r9=r36
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+br\.ret\.sptk\.few[[:space:]]+(b0|rp);;
--- /home/jbeulich/src/binutils/mainline/2005-02-11/gas/testsuite/gas/ia64/nostkreg.s	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-11/gas/testsuite/gas/ia64/nostkreg.s	2005-02-04 14:47:29.000000000 +0100
@@ -0,0 +1,9 @@
+_start:
+	mov		r5 = in00
+	mov		r6 = loc96
+	.regstk 2, 6, 2, 8
+	.rotr in0I[2], loc1L[2], out2O[2]
+	mov		r7 = in0I[0]
+	mov		r8 = loc1L[0]
+	mov		r9 = out2O[0]
+	br.ret.sptk	rp

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

* Re: [PATCH] ia64: certain symbol names were unusable
  2005-02-11 15:54 [PATCH] ia64: certain symbol names were unusable Jan Beulich
@ 2005-02-17  3:22 ` James E Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: James E Wilson @ 2005-02-17  3:22 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Fri, 2005-02-11 at 02:57, Jan Beulich wrote:
> 	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
> 	parsing inN, locN, outN. ...

FYI This is the in-loc-out patch.  I haven't seen this one get applied
yet.  I approved it Friday last week.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com


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

* Re: [PATCH] ia64: certain symbol names were unusable
@ 2005-02-17 15:37 Jan Beulich
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2005-02-17 15:37 UTC (permalink / raw)
  To: wilson; +Cc: binutils

>>> James E Wilson <wilson@specifixinc.com> 16.02.05 21:11:28 >>>
>On Fri, 2005-02-11 at 02:57, Jan Beulich wrote:
>> 	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
>> 	parsing inN, locN, outN. ...
>
>FYI This is the in-loc-out patch.  I haven't seen this one get
applied
>yet.  I approved it Friday last week.

I must have lost track of it while applying other patches. Thanks for
reminding me!

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

* Re: [PATCH] ia64: certain symbol names were unusable
       [not found] <s20c8f76.004@emea1-mh.id2.novell.com>
@ 2005-02-11 20:41 ` James E Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: James E Wilson @ 2005-02-11 20:41 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Fri, 2005-02-11 at 02:57, Jan Beulich wrote:
> 	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
> 	parsing inN, locN, outN. Set 'idx' to offset register number
> starts
> 	at. Don't handle numbers with leading zeroes or beyond 95.
> Remove
> 	pointless cast.

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


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

* Re: [PATCH] ia64: certain symbol names were unusable
  2005-02-08 17:05 Jan Beulich
@ 2005-02-11  3:46 ` James E Wilson
  0 siblings, 0 replies; 6+ messages in thread
From: James E Wilson @ 2005-02-11  3:46 UTC (permalink / raw)
  To: Jan Beulich; +Cc: binutils

On Tue, 2005-02-08 at 03:16, Jan Beulich wrote:
> +      if (name[1] == 'n' && ISDIGIT (name[idx = 2]))
> +	dr = &md.in;

Please don't hide assignments like this.  It makes the code hard to
read.  This should be name[2] with "idx = 2;" on a separate line.

> +      if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[idx =
> 3]))
> +	dr = &md.loc;

Likewise.

> +      if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[idx =
> 3]))
> +	dr = &md.out;

Likewise.

> +  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))

This one puzzled me for a while.  There should be a comment explaining
what it is for, to ignore any number with a leading zero, other than
zero itself.

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


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

* [PATCH] ia64: certain symbol names were unusable
@ 2005-02-08 17:05 Jan Beulich
  2005-02-11  3:46 ` James E Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2005-02-08 17:05 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 4318 bytes --]

Variables starting with 'in', 'loc', or 'out' and continuing with
decimal
numbers not fitting the 0-95 range (used for the stacked register
aliases) or
starting with zeroes were considered reserved, while they really
aren't.
Rotating registers allocated through .rotX could not start with 'in',
'loc',
or 'out' followed by at least one digit (and then anything) at all.

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

Jan

gas/
2005-02-08  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
	parsing inN, locN, outN. Set 'idx' to offset register number
starts
	at. Don't handle numbers with leading zeroes or beyond 95.
Remove
	pointless cast.

gas/testsuite/
2005-02-08  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/nostkreg.[ds]: New.
	* gas/ia64/ia64.exp: Run new test.

---
/home/jbeulich/src/binutils/mainline/2005-02-08/gas/config/tc-ia64.c	2005-02-02
08:33:18.000000000 +0100
+++ 2005-02-08/gas/config/tc-ia64.c	2005-02-08 12:05:12.000000000
+0100
@@ -7586,7 +7586,7 @@ ia64_parse_name (name, e)
 {
   struct const_desc *cdesc;
   struct dynreg *dr = 0;
-  unsigned int regnum;
+  unsigned int idx;
   struct symbol *sym;
   char *end;
 
@@ -7608,43 +7608,37 @@ ia64_parse_name (name, e)
     }
 
   /* check for inN, locN, or outN:  */
+  idx = 0;
   switch (name[0])
     {
     case 'i':
-      if (name[1] == 'n' && ISDIGIT (name[2]))
-	{
-	  dr = &md.in;
-	  name += 2;
-	}
+      if (name[1] == 'n' && ISDIGIT (name[idx = 2]))
+	dr = &md.in;
       break;
 
     case 'l':
-      if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
-	{
-	  dr = &md.loc;
-	  name += 3;
-	}
+      if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[idx =
3]))
+	dr = &md.loc;
       break;
 
     case 'o':
-      if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
-	{
-	  dr = &md.out;
-	  name += 3;
-	}
+      if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[idx =
3]))
+	dr = &md.out;
       break;
 
     default:
       break;
     }
 
-  if (dr)
+  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))
     {
+      unsigned long regnum;
+
       /* The name is inN, locN, or outN; parse the register number. 
*/
-      regnum = strtoul (name, &end, 10);
-      if (end > name && *end == '\0')
+      regnum = strtoul (name + idx, &end, 10);
+      if (end > name + idx && *end == '\0' && regnum < 96)
 	{
-	  if ((unsigned) regnum >= dr->num_regs)
+	  if (regnum >= dr->num_regs)
 	    {
 	      if (!dr->num_regs)
 		as_bad ("No current frame");
---
/home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/ia64.exp	2005-02-02
08:33:18.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/ia64.exp	2005-02-08
11:43:19.000000000 +0100
@@ -44,7 +44,8 @@ if [istarget "ia64-*"] then {
     run_dump_test "ldxmov-1"
     run_list_test "ldxmov-2" ""
     run_dump_test "ltoff22x-1"
-    
+
+    run_dump_test "nostkreg"
     run_list_test "invalid-ar" ""
 
     run_dump_test "dependency-1"
---
/home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/nostkreg.d	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/nostkreg.d	2005-02-04
15:02:33.000000000 +0100
@@ -0,0 +1,16 @@
+#objdump: -dr
+#name: ia64 not stacked registers
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]I\][[:space:]]+mov[[:space:]]+r5=0
+[[:space:]]+0:[[:space:]]+IMM22[[:space:]]+in00
+[[:space:]]+1:[[:space:]]+IMM22[[:space:]]+loc96
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r6=0
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r7=r32
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]B\][[:space:]]+mov[[:space:]]+r8=r34
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r9=r36
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+br\.ret\.sptk\.few[[:space:]]+(b0|rp);;
---
/home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/nostkreg.s	1970-01-01
01:00:00.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/nostkreg.s	2005-02-04
14:47:29.000000000 +0100
@@ -0,0 +1,9 @@
+_start:
+	mov		r5 = in00
+	mov		r6 = loc96
+	.regstk 2, 6, 2, 8
+	.rotr in0I[2], loc1L[2], out2O[2]
+	mov		r7 = in0I[0]
+	mov		r8 = loc1L[0]
+	mov		r9 = out2O[0]
+	br.ret.sptk	rp


[-- Attachment #2: binutils-mainline-ia64-in-loc-out.patch --]
[-- Type: text/plain, Size: 4317 bytes --]

Variables starting with 'in', 'loc', or 'out' and continuing with decimal
numbers not fitting the 0-95 range (used for the stacked register aliases) or
starting with zeroes were considered reserved, while they really aren't.
Rotating registers allocated through .rotX could not start with 'in', 'loc',
or 'out' followed by at least one digit (and then anything) at all.

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

Jan

gas/
2005-02-08  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (ia64_parse_name): Don't advance 'name' when
	parsing inN, locN, outN. Set 'idx' to offset register number starts
	at. Don't handle numbers with leading zeroes or beyond 95. Remove
	pointless cast.

gas/testsuite/
2005-02-08  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/nostkreg.[ds]: New.
	* gas/ia64/ia64.exp: Run new test.

--- /home/jbeulich/src/binutils/mainline/2005-02-08/gas/config/tc-ia64.c	2005-02-02 08:33:18.000000000 +0100
+++ 2005-02-08/gas/config/tc-ia64.c	2005-02-08 12:05:12.000000000 +0100
@@ -7586,7 +7586,7 @@ ia64_parse_name (name, e)
 {
   struct const_desc *cdesc;
   struct dynreg *dr = 0;
-  unsigned int regnum;
+  unsigned int idx;
   struct symbol *sym;
   char *end;
 
@@ -7608,43 +7608,37 @@ ia64_parse_name (name, e)
     }
 
   /* check for inN, locN, or outN:  */
+  idx = 0;
   switch (name[0])
     {
     case 'i':
-      if (name[1] == 'n' && ISDIGIT (name[2]))
-	{
-	  dr = &md.in;
-	  name += 2;
-	}
+      if (name[1] == 'n' && ISDIGIT (name[idx = 2]))
+	dr = &md.in;
       break;
 
     case 'l':
-      if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[3]))
-	{
-	  dr = &md.loc;
-	  name += 3;
-	}
+      if (name[1] == 'o' && name[2] == 'c' && ISDIGIT (name[idx = 3]))
+	dr = &md.loc;
       break;
 
     case 'o':
-      if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[3]))
-	{
-	  dr = &md.out;
-	  name += 3;
-	}
+      if (name[1] == 'u' && name[2] == 't' && ISDIGIT (name[idx = 3]))
+	dr = &md.out;
       break;
 
     default:
       break;
     }
 
-  if (dr)
+  if (dr && (name[idx] != '0' || name[idx + 1] == '\0'))
     {
+      unsigned long regnum;
+
       /* The name is inN, locN, or outN; parse the register number.  */
-      regnum = strtoul (name, &end, 10);
-      if (end > name && *end == '\0')
+      regnum = strtoul (name + idx, &end, 10);
+      if (end > name + idx && *end == '\0' && regnum < 96)
 	{
-	  if ((unsigned) regnum >= dr->num_regs)
+	  if (regnum >= dr->num_regs)
 	    {
 	      if (!dr->num_regs)
 		as_bad ("No current frame");
--- /home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/ia64.exp	2005-02-02 08:33:18.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/ia64.exp	2005-02-08 11:43:19.000000000 +0100
@@ -44,7 +44,8 @@ if [istarget "ia64-*"] then {
     run_dump_test "ldxmov-1"
     run_list_test "ldxmov-2" ""
     run_dump_test "ltoff22x-1"
-    
+
+    run_dump_test "nostkreg"
     run_list_test "invalid-ar" ""
 
     run_dump_test "dependency-1"
--- /home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/nostkreg.d	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/nostkreg.d	2005-02-04 15:02:33.000000000 +0100
@@ -0,0 +1,16 @@
+#objdump: -dr
+#name: ia64 not stacked registers
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+000 <_start>:
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]I\][[:space:]]+mov[[:space:]]+r5=0
+[[:space:]]+0:[[:space:]]+IMM22[[:space:]]+in00
+[[:space:]]+1:[[:space:]]+IMM22[[:space:]]+loc96
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r6=0
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r7=r32
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+\[M[IM]B\][[:space:]]+mov[[:space:]]+r8=r34
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+mov[[:space:]]+r9=r36
+[[:space:]]*[[:xdigit:]]+:[[:space:][:xdigit:]]+br\.ret\.sptk\.few[[:space:]]+(b0|rp);;
--- /home/jbeulich/src/binutils/mainline/2005-02-08/gas/testsuite/gas/ia64/nostkreg.s	1970-01-01 01:00:00.000000000 +0100
+++ 2005-02-08/gas/testsuite/gas/ia64/nostkreg.s	2005-02-04 14:47:29.000000000 +0100
@@ -0,0 +1,9 @@
+_start:
+	mov		r5 = in00
+	mov		r6 = loc96
+	.regstk 2, 6, 2, 8
+	.rotr in0I[2], loc1L[2], out2O[2]
+	mov		r7 = in0I[0]
+	mov		r8 = loc1L[0]
+	mov		r9 = out2O[0]
+	br.ret.sptk	rp

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

end of thread, other threads:[~2005-02-17  7:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-11 15:54 [PATCH] ia64: certain symbol names were unusable Jan Beulich
2005-02-17  3:22 ` James E Wilson
  -- strict thread matches above, loose matches on Subject: below --
2005-02-17 15:37 Jan Beulich
     [not found] <s20c8f76.004@emea1-mh.id2.novell.com>
2005-02-11 20:41 ` James E Wilson
2005-02-08 17:05 Jan Beulich
2005-02-11  3:46 ` 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).