[PATCH] IBM Z: Define NO_PROFILE_COUNTERS

Ilya Leoshkevich iii@linux.ibm.com
Mon Jun 21 22:20:26 GMT 2021


Bootstrapped and regtested on s390x-redhat-linux.  Ok for master?



s390 glibc does not need counters in the .data section, since it stores
edge hits in its own data structure.  Therefore counters only waste
space and confuse diffing tools (e.g. kpatch), so don't generate them.

gcc/ChangeLog:

	* config/s390/s390.c (s390_function_profiler): Ignore labelno
	parameter.
	* config/s390/s390.h (NO_PROFILE_COUNTERS): Define.
---
 gcc/config/s390/s390.c | 14 ++------------
 gcc/config/s390/s390.h |  2 ++
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 6bbeb640e1f..96c9a9db53b 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -13110,17 +13110,13 @@ output_asm_nops (const char *user, int hw)
     }
 }
 
-/* Output assembler code to FILE to increment profiler label # LABELNO
-   for profiling a function entry.  */
+/* Output assembler code to FILE to call a profiler hook.  */
 
 void
-s390_function_profiler (FILE *file, int labelno)
+s390_function_profiler (FILE *file, int /* labelno */)
 {
   rtx op[8];
 
-  char label[128];
-  ASM_GENERATE_INTERNAL_LABEL (label, "LP", labelno);
-
   fprintf (file, "# function profiler \n");
 
   op[0] = gen_rtx_REG (Pmode, RETURN_REGNUM);
@@ -13128,10 +13124,6 @@ s390_function_profiler (FILE *file, int labelno)
   op[1] = gen_rtx_MEM (Pmode, plus_constant (Pmode, op[1], UNITS_PER_LONG));
   op[7] = GEN_INT (UNITS_PER_LONG);
 
-  op[2] = gen_rtx_REG (Pmode, 1);
-  op[3] = gen_rtx_SYMBOL_REF (Pmode, label);
-  SYMBOL_REF_FLAGS (op[3]) = SYMBOL_FLAG_LOCAL;
-
   op[4] = gen_rtx_SYMBOL_REF (Pmode, flag_fentry ? "__fentry__" : "_mcount");
   if (flag_pic)
     {
@@ -13162,7 +13154,6 @@ s390_function_profiler (FILE *file, int labelno)
 	  output_asm_insn ("stg\t%0,%1", op);
 	  if (flag_dwarf2_cfi_asm)
 	    output_asm_insn (".cfi_rel_offset\t%0,%7", op);
-	  output_asm_insn ("larl\t%2,%3", op);
 	  output_asm_insn ("brasl\t%0,%4", op);
 	  output_asm_insn ("lg\t%0,%1", op);
 	  if (flag_dwarf2_cfi_asm)
@@ -13179,7 +13170,6 @@ s390_function_profiler (FILE *file, int labelno)
 	  output_asm_insn ("st\t%0,%1", op);
 	  if (flag_dwarf2_cfi_asm)
 	    output_asm_insn (".cfi_rel_offset\t%0,%7", op);
-	  output_asm_insn ("larl\t%2,%3", op);
 	  output_asm_insn ("brasl\t%0,%4", op);
 	  output_asm_insn ("l\t%0,%1", op);
 	  if (flag_dwarf2_cfi_asm)
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 3b876160420..fb16a455a03 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -787,6 +787,8 @@ CUMULATIVE_ARGS;
 
 #define PROFILE_BEFORE_PROLOGUE 1
 
+#define NO_PROFILE_COUNTERS 1
+
 
 /* Trampolines for nested functions.  */
 
-- 
2.31.1



More information about the Gcc-patches mailing list