This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] MIPS gas: Use $ra as an alias for $31


Hi All,

this claims '$ra' as a special symbol as an alias for $31.
There are already some register alias names in gas:

$fp, $sp, $at, $kt0, $kt1, which are fixed by ABI conventions;
$gp, which can be modified in NewABI;
$pc, which doesn't even exist as an acessible hardware register.

None of these (besides the last) is hardware special. $ra is hardware
special, so there isn't much reason not to have an alias for it.

$0 AKA $zero is also hardware special, it could also have an alias
(but $0 works better as an mnemnonic for zero).


Thiemo


2002-05-30  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (md_begin): Add $ra as alias name for $31.
	(mips_ip): Likewise.
	(mips16_ip): Likewise.
	(tc_get_register): Likewise.


diff -BurpN source-orig/gas/config/tc-mips.c source/gas/config/tc-mips.c
--- source-orig/gas/config/tc-mips.c	Fri May 31 01:49:55 2002
+++ source/gas/config/tc-mips.c	Fri May 31 00:19:45 2002
@@ -1325,6 +1336,8 @@ md_begin ()
       symbol_table_insert (symbol_new (buf, reg_section, i,
 				       &zero_address_frag));
     }
+  symbol_table_insert (symbol_new ("$ra", reg_section, RA,
+				   &zero_address_frag));
   symbol_table_insert (symbol_new ("$fp", reg_section, FP,
 				   &zero_address_frag));
   symbol_table_insert (symbol_new ("$sp", reg_section, SP,
@@ -8172,7 +8181,12 @@ mips_ip (str, ip)
 		    goto notreg;
 		  else
 		    {
-		      if (s[1] == 'f' && s[2] == 'p')
+		      if (s[1] == 'r' && s[2] == 'a')
+			{
+			  s += 3;
+			  regno = RA;
+			}
+		      else if (s[1] == 'f' && s[2] == 'p')
 			{
 			  s += 3;
 			  regno = FP;
@@ -9044,7 +9072,12 @@ mips16_ip (str, ip)
 		}
 	      else
 		{
-		  if (s[1] == 'f' && s[2] == 'p')
+		  if (s[1] == 'r' && s[2] == 'a')
+		    {
+		      s += 3;
+		      regno = RA;
+		    }
+		  else if (s[1] == 'f' && s[2] == 'p')
 		    {
 		      s += 3;
 		      regno = FP;
@@ -12083,7 +12180,9 @@ tc_get_register (frame)
     }
   else
     {
-      if (strncmp (input_line_pointer, "fp", 2) == 0)
+      if (strncmp (input_line_pointer, "ra", 2) == 0)
+	reg = RA;
+      else if (strncmp (input_line_pointer, "fp", 2) == 0)
 	reg = FP;
       else if (strncmp (input_line_pointer, "sp", 2) == 0)
 	reg = SP;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]