Patchwork [AARCH64] Remove %r from asm_printf

login
register
mail settings
Submitter Hurugalawadi, Naveen
Date Jan. 8, 2013, 5:04 a.m.
Message ID <F3068DEED1A463459E0887A091B1549337F915@BY2PRD0710MB364.namprd07.prod.outlook.com>
Download mbox | patch
Permalink /patch/210289/
State New
Headers show

Comments

Hurugalawadi, Naveen - Jan. 8, 2013, 5:04 a.m.
Hi,

ASM_FPRINTF_EXTENSIONS was copied from the arm back-end and is not
needed. Please find attached the patch that replaces "%r" in asm_fprintf
with reg_names. The definition of "ASM_FPRINTF_EXTENSIONS" is
removed as it is no longer needed. 

Please review the patch and let me know if there should be any
modifications?

Build and tested on aarch64-thunder-elf (using Cavium's internal
simulator). 

Thanks,
Naveen.H.S

2013-01-08   Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

	* config/aarch64/aarch64.c (aarch64_print_operand): Replace %r
	in asm_fprintf with reg_names.
	(aarch64_print_operand_address): Likewise.
	(aarch64_return_addr): Likewise.
	* config/aarch64/aarch64.h (ASM_FPRINTF_EXTENSIONS): Remove.
Marcus Shawcroft - Jan. 8, 2013, 9:19 a.m.
On 8 January 2013 05:04, Hurugalawadi, Naveen
<Naveen.Hurugalawadi@caviumnetworks.com> wrote:
> Hi,
>
> ASM_FPRINTF_EXTENSIONS was copied from the arm back-end and is not
> needed. Please find attached the patch that replaces "%r" in asm_fprintf
> with reg_names. The definition of "ASM_FPRINTF_EXTENSIONS" is
> removed as it is no longer needed.

It appears that ARM and AARCH64 are the only users of this target
macro.  This patch is OK.  It would be much appreciated if you would
handle the back port to ARM/aarch64-4.7-branch

Thanks
/Marcus

>
> Please review the patch and let me know if there should be any
> modifications?
>
> Build and tested on aarch64-thunder-elf (using Cavium's internal
> simulator).
>
> Thanks,
> Naveen.H.S
>
> 2013-01-08   Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>
>
>         * config/aarch64/aarch64.c (aarch64_print_operand): Replace %r
>         in asm_fprintf with reg_names.
>         (aarch64_print_operand_address): Likewise.
>         (aarch64_return_addr): Likewise.
>         * config/aarch64/aarch64.h (ASM_FPRINTF_EXTENSIONS): Remove.

Patch

--- gcc/config/aarch64/aarch64.c	2013-01-07 17:04:51.295005008 +0530
+++ gcc/config/aarch64/aarch64.c	2013-01-08 09:39:10.497028308 +0530
@@ -3278,7 +3278,7 @@  aarch64_print_operand (FILE *f, rtx x, c
 	  return;
 	}
 
-      asm_fprintf (f, "%r", REGNO (x) + 1);
+      asm_fprintf (f, "%s", reg_names [REGNO (x) + 1]);
       break;
 
     case 'Q':
@@ -3288,7 +3288,7 @@  aarch64_print_operand (FILE *f, rtx x, c
 	  output_operand_lossage ("invalid operand for '%%%c'", code);
 	  return;
 	}
-      asm_fprintf (f, "%r", REGNO (x) + (WORDS_BIG_ENDIAN ? 1 : 0));
+      asm_fprintf (f, "%s", reg_names [REGNO (x) + (WORDS_BIG_ENDIAN ? 1 : 0)]);
       break;
 
     case 'R':
@@ -3298,7 +3298,7 @@  aarch64_print_operand (FILE *f, rtx x, c
 	  output_operand_lossage ("invalid operand for '%%%c'", code);
 	  return;
 	}
-      asm_fprintf (f, "%r", REGNO (x) + (WORDS_BIG_ENDIAN ? 0 : 1));
+      asm_fprintf (f, "%s", reg_names [REGNO (x) + (WORDS_BIG_ENDIAN ? 0 : 1)]);
       break;
 
     case 'm':
@@ -3402,7 +3402,7 @@  aarch64_print_operand (FILE *f, rtx x, c
       switch (GET_CODE (x))
 	{
 	case REG:
-	  asm_fprintf (f, "%r", REGNO (x));
+	  asm_fprintf (f, "%s", reg_names [REGNO (x)]);
 	  break;
 
 	case MEM:
@@ -3522,36 +3522,36 @@  aarch64_print_operand_address (FILE *f,
       {
       case ADDRESS_REG_IMM:
 	if (addr.offset == const0_rtx)
-	  asm_fprintf (f, "[%r]", REGNO (addr.base));
+	  asm_fprintf (f, "[%s]", reg_names [REGNO (addr.base)]);
 	else
-	  asm_fprintf (f, "[%r,%wd]", REGNO (addr.base),
+	  asm_fprintf (f, "[%s,%wd]", reg_names [REGNO (addr.base)],
 		       INTVAL (addr.offset));
 	return;
 
       case ADDRESS_REG_REG:
 	if (addr.shift == 0)
-	  asm_fprintf (f, "[%r,%r]", REGNO (addr.base),
-		       REGNO (addr.offset));
+	  asm_fprintf (f, "[%s,%s]", reg_names [REGNO (addr.base)],
+		       reg_names [REGNO (addr.offset)]);
 	else
-	  asm_fprintf (f, "[%r,%r,lsl %u]", REGNO (addr.base),
-		       REGNO (addr.offset), addr.shift);
+	  asm_fprintf (f, "[%s,%s,lsl %u]", reg_names [REGNO (addr.base)],
+		       reg_names [REGNO (addr.offset)], addr.shift);
 	return;
 
       case ADDRESS_REG_UXTW:
 	if (addr.shift == 0)
-	  asm_fprintf (f, "[%r,w%d,uxtw]", REGNO (addr.base),
+	  asm_fprintf (f, "[%s,w%d,uxtw]", reg_names [REGNO (addr.base)],
 		       REGNO (addr.offset) - R0_REGNUM);
 	else
-	  asm_fprintf (f, "[%r,w%d,uxtw %u]", REGNO (addr.base),
+	  asm_fprintf (f, "[%s,w%d,uxtw %u]", reg_names [REGNO (addr.base)],
 		       REGNO (addr.offset) - R0_REGNUM, addr.shift);
 	return;
 
       case ADDRESS_REG_SXTW:
 	if (addr.shift == 0)
-	  asm_fprintf (f, "[%r,w%d,sxtw]", REGNO (addr.base),
+	  asm_fprintf (f, "[%s,w%d,sxtw]", reg_names [REGNO (addr.base)],
 		       REGNO (addr.offset) - R0_REGNUM);
 	else
-	  asm_fprintf (f, "[%r,w%d,sxtw %u]", REGNO (addr.base),
+	  asm_fprintf (f, "[%s,w%d,sxtw %u]", reg_names [REGNO (addr.base)],
 		       REGNO (addr.offset) - R0_REGNUM, addr.shift);
 	return;
 
@@ -3559,27 +3559,27 @@  aarch64_print_operand_address (FILE *f,
 	switch (GET_CODE (x))
 	  {
 	  case PRE_INC:
-	    asm_fprintf (f, "[%r,%d]!", REGNO (addr.base),
+	    asm_fprintf (f, "[%s,%d]!", reg_names [REGNO (addr.base)], 
 			 GET_MODE_SIZE (aarch64_memory_reference_mode));
 	    return;
 	  case POST_INC:
-	    asm_fprintf (f, "[%r],%d", REGNO (addr.base),
+	    asm_fprintf (f, "[%s],%d", reg_names [REGNO (addr.base)],
 			 GET_MODE_SIZE (aarch64_memory_reference_mode));
 	    return;
 	  case PRE_DEC:
-	    asm_fprintf (f, "[%r,-%d]!", REGNO (addr.base),
+	    asm_fprintf (f, "[%s,-%d]!", reg_names [REGNO (addr.base)],
 			 GET_MODE_SIZE (aarch64_memory_reference_mode));
 	    return;
 	  case POST_DEC:
-	    asm_fprintf (f, "[%r],-%d", REGNO (addr.base),
+	    asm_fprintf (f, "[%s],-%d", reg_names [REGNO (addr.base)],
 			 GET_MODE_SIZE (aarch64_memory_reference_mode));
 	    return;
 	  case PRE_MODIFY:
-	    asm_fprintf (f, "[%r,%wd]!", REGNO (addr.base),
+	    asm_fprintf (f, "[%s,%wd]!", reg_names [REGNO (addr.base)],
 			 INTVAL (addr.offset));
 	    return;
 	  case POST_MODIFY:
-	    asm_fprintf (f, "[%r],%wd", REGNO (addr.base),
+	    asm_fprintf (f, "[%s],%wd", reg_names [REGNO (addr.base)],
 			 INTVAL (addr.offset));
 	    return;
 	  default:
@@ -3588,7 +3588,7 @@  aarch64_print_operand_address (FILE *f,
 	break;
 
       case ADDRESS_LO_SUM:
-	asm_fprintf (f, "[%r,#:lo12:", REGNO (addr.base));
+	asm_fprintf (f, "[%s,#:lo12:", reg_names [REGNO (addr.base)]);
 	output_addr_const (f, addr.offset);
 	asm_fprintf (f, "]");
 	return;
@@ -3899,9 +3899,9 @@  aarch64_return_addr (int count, rtx fram
 static void
 aarch64_asm_trampoline_template (FILE *f)
 {
-  asm_fprintf (f, "\tldr\t%r, .+16\n", IP1_REGNUM);
-  asm_fprintf (f, "\tldr\t%r, .+20\n", STATIC_CHAIN_REGNUM);
-  asm_fprintf (f, "\tbr\t%r\n", IP1_REGNUM);
+  asm_fprintf (f, "\tldr\t%s, .+16\n", reg_names [IP1_REGNUM]);
+  asm_fprintf (f, "\tldr\t%s, .+20\n", reg_names [STATIC_CHAIN_REGNUM]);
+  asm_fprintf (f, "\tbr\t%s\n", reg_names [IP1_REGNUM]);
   assemble_aligned_integer (4, const0_rtx);
   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);
   assemble_aligned_integer (UNITS_PER_WORD, const0_rtx);
--- gcc/config/aarch64/aarch64.h	2012-12-14 09:53:42.269262997 +0530
+++ gcc/config/aarch64/aarch64.h	2013-01-08 09:38:33.105027041 +0530
@@ -768,16 +768,6 @@  do {									     \
 #define ASM_APP_ON	"\t" ASM_COMMENT_START " Start of user assembly\n"
 #define ASM_APP_OFF	"\t" ASM_COMMENT_START " End of user assembly\n"
 
-#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P)		\
-  case '@':						\
-    fputs (ASM_COMMENT_START, FILE);			\
-    break;						\
-							\
-  case 'r':						\
-    fputs (REGISTER_PREFIX, FILE);			\
-    fputs (reg_names[va_arg (ARGS, int)], FILE);	\
-    break;
-
 #define CONSTANT_POOL_BEFORE_FUNCTION 0
 
 /* This definition should be relocated to aarch64-elf-raw.h.  This macro