[PATCH] ia64: register symbol generation

Jan Beulich JBeulich@novell.com
Fri Oct 21 09:53:00 GMT 2005


This patch adjusts the generation of O_register symbols for all
architectural registers and their aliases by
- using symbol_create instead of symbol_new, so these symbols don't
get
  needlessly inserted into the global symbol chain
- making it independent of the ordering of the register enumeration
- not corrupting md.regsym entries during alias generation
- allowing 'tp' to be used instead of 'r13'
A resulting question is whether it is really needed to store the
symbols
for all registers (rather than just the general ones) in md.regsym,
and
whether this array (due to its size and the potential of generating
better
code for some cross-build hosts) shouldn't be moved to the end of md.

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

Jan

gas/
2005-10-21  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (declare_register): Call symbol_create.
	(md_begin): Remove local variables total, ar_base, and cr_base.
	Start loops for registers at their respective first one. Don't
	update md.regsym for alias names. Generate alias name tp for
r13.

gas/testsuite/
2005-10-21  Jan Beulich  <jbeulich@novell.com>

	* gas/ia64/regs.pl: Also check tp alias of r13.
	* gas/ia64/regs.s: Regenerate.
	* gas/ia64/regs.d: Adjust.

---
/home/jbeulich/src/binutils/mainline/2005-10-20/gas/config/tc-ia64.c	2005-10-12
09:50:45.000000000 +0200
+++ 2005-10-20/gas/config/tc-ia64.c	2005-10-21 10:12:24.959939954
+0200
@@ -5599,7 +5599,7 @@ declare_register (name, regnum)
   const char *err;
   symbolS *sym;
 
-  sym = symbol_new (name, reg_section, regnum, &zero_address_frag);
+  sym = symbol_create (name, reg_section, regnum,
&zero_address_frag);
 
   err = hash_insert (md.reg_hash, S_GET_NAME (sym), (PTR) sym);
   if (err)
@@ -7366,7 +7366,7 @@ extra_goodness (int templ, int slot)
 void
 md_begin ()
 {
-  int i, j, k, t, total, ar_base, cr_base, goodness, best, regnum,
ok;
+  int i, j, k, t, goodness, best, regnum, ok;
   const char *err;
   char name[8];
 
@@ -7541,51 +7541,42 @@ md_begin ()
   md.entry_hash = hash_new ();
 
   /* general registers:  */
-
-  total = 128;
-  for (i = 0; i < total; ++i)
+  for (i = REG_GR; i < REG_GR + 128; ++i)
     {
       sprintf (name, "r%d", i - REG_GR);
       md.regsym[i] = declare_register (name, i);
     }
 
   /* floating point registers:  */
-  total += 128;
-  for (; i < total; ++i)
+  for (i = REG_FR; i < REG_FR + 128; ++i)
     {
       sprintf (name, "f%d", i - REG_FR);
       md.regsym[i] = declare_register (name, i);
     }
 
   /* application registers:  */
-  total += 128;
-  ar_base = i;
-  for (; i < total; ++i)
+  for (i = REG_AR; i < REG_AR + 128; ++i)
     {
       sprintf (name, "ar%d", i - REG_AR);
       md.regsym[i] = declare_register (name, i);
     }
 
   /* control registers:  */
-  total += 128;
-  cr_base = i;
-  for (; i < total; ++i)
+  for (i = REG_CR; i < REG_CR + 128; ++i)
     {
       sprintf (name, "cr%d", i - REG_CR);
       md.regsym[i] = declare_register (name, i);
     }
 
   /* predicate registers:  */
-  total += 64;
-  for (; i < total; ++i)
+  for (i = REG_P; i < REG_P + 64; ++i)
     {
       sprintf (name, "p%d", i - REG_P);
       md.regsym[i] = declare_register (name, i);
     }
 
   /* branch registers:  */
-  total += 8;
-  for (; i < total; ++i)
+  for (i = REG_BR; i < REG_BR + 8; ++i)
     {
       sprintf (name, "b%d", i - REG_BR);
       md.regsym[i] = declare_register (name, i);
@@ -7606,17 +7597,16 @@ md_begin ()
     }
 
   /* define synonyms for application registers:  */
-  for (i = REG_AR; i < REG_AR + NELEMS (ar); ++i)
-    md.regsym[i] = declare_register (ar[i - REG_AR].name,
-				     REG_AR + ar[i - REG_AR].regnum);
+  for (i = 0; i < NELEMS (ar); ++i)
+    declare_register (ar[i].name, REG_AR + ar[i].regnum);
 
   /* define synonyms for control registers:  */
-  for (i = REG_CR; i < REG_CR + NELEMS (cr); ++i)
-    md.regsym[i] = declare_register (cr[i - REG_CR].name,
-				     REG_CR + cr[i - REG_CR].regnum);
+  for (i = 0; i < NELEMS (cr); ++i)
+    declare_register (cr[i].name, REG_CR + cr[i].regnum);
 
   declare_register ("gp", REG_GR +  1);
   declare_register ("sp", REG_GR + 12);
+  declare_register ("tp", REG_GR + 13);
   declare_register ("rp", REG_BR +  0);
 
   /* pseudo-registers used to specify unwind info:  */
---
/home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/regs.d	2005-02-08
10:32:11.000000000 +0100
+++ 2005-10-20/gas/testsuite/gas/ia64/regs.d	2005-10-21
10:12:24.962869641 +0200
@@ -1265,8 +1265,8 @@ Disassembly of section \.text:
     1a26:	00 00 00 02 00 00 	            nop\.i 0x0
     1a2c:	00 00 04 00       	            nop\.i 0x0;;
     1a30:	01 08 00 00 00 21 	\[MII\]       mov r1=r0
-    1a36:	c0 00 00 00 42 00 	            mov r12=r0
-    1a3c:	00 00 04 00       	            nop\.i 0x0;;
+    1a36:	c0 00 00 00 42 a0 	            mov r12=r0
+    1a3c:	01 00 00 84       	            mov r13=r0;;
     1a40:	0d 00 00 00 01 00 	\[MFI\]       nop\.m 0x0
     1a46:	20 00 00 20 00 00 	            mov f2=f0
     1a4c:	00 00 04 00       	            nop\.i 0x0;;
---
/home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/regs.pl	2000-04-21
22:22:22.000000000 +0200
+++ 2005-10-20/gas/testsuite/gas/ia64/regs.pl	2005-10-17
12:44:16.000000000 +0200
@@ -38,7 +38,7 @@ print "\n";
 print "\t{ .mii;\n";
 print "\tmov gp = r0\n";
 print "\tmov sp = r0\n";
-print "\tnop.i 0;; }\n\n";
+print "\tmov tp = r0;; }\n\n";
 
 print "// Floating point registers\n";
 for ($i = 2; $i < 128; ++$i) {
---
/home/jbeulich/src/binutils/mainline/2005-10-20/gas/testsuite/gas/ia64/regs.s	2000-04-21
22:22:22.000000000 +0200
+++ 2005-10-20/gas/testsuite/gas/ia64/regs.s	2005-10-17
12:44:34.000000000 +0200
@@ -437,7 +437,7 @@ _start:
 	{ .mii;
 	mov gp = r0
 	mov sp = r0
-	nop.i 0;; }
+	mov tp = r0;; }
 
 // Floating point registers
 	{ .mfi; mov f2 = f0 ;; }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils-mainline-ia64-regsym.patch
Type: application/octet-stream
Size: 5859 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20051021/fa2b4f5c/attachment.obj>


More information about the Binutils mailing list