diff options
author | Bill Schmidt <wschmidt@linux.ibm.com> | 2019-05-23 20:33:02 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2019-05-23 20:33:02 +0000 |
commit | 99f8432359851649b749d4c16b91b758820d30c1 (patch) | |
tree | a1ca9a652f39d1c9d7c4f6c1c164a80c0a0a3c0d /gcc | |
parent | 103d91c7cb36eaba7728a3550f77dd1f50fdfc29 (diff) | |
download | gcc-99f8432359851649b749d4c16b91b758820d30c1.zip gcc-99f8432359851649b749d4c16b91b758820d30c1.tar.gz gcc-99f8432359851649b749d4c16b91b758820d30c1.tar.bz2 |
rs6000.c (rs6000_global_entry_point_needed_p): Rename to rs6000_global_entry_point_prologue_needed_p.
[gcc]
2019-05-22 Bill Schmidt <wschmidt@linux.ibm.com>
* config/rs6000/rs6000.c (rs6000_global_entry_point_needed_p):
Rename to rs6000_global_entry_point_prologue_needed_p. Return
false for PC-relative functions.
(rs6000_output_function_prologue): Change called function name to
rs6000_global_entry_point_prologue_needed_p. Emit ".localentry
name,1" for PC-relative functions.
(rs6000_elf_declare_function_name): Change called function name to
rs6000_global_entry_point_prologue_needed_p.
[gcc/testsuite]
2019-05-22 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.target/powerpc/localentry-1.c: New file.
From-SVN: r271577
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/localentry-1.c | 18 |
4 files changed, 54 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4956f15..c9a6e4a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2019-05-23 Bill Schmidt <wschmidt@linux.ibm.com> + + * config/rs6000/rs6000.c (rs6000_global_entry_point_needed_p): + Rename to rs6000_global_entry_point_prologue_needed_p. Return + false for PC-relative functions. + (rs6000_output_function_prologue): Change called function name to + rs6000_global_entry_point_prologue_needed_p. Emit ".localentry + name,1" for PC-relative functions. + (rs6000_elf_declare_function_name): Change called function name to + rs6000_global_entry_point_prologue_needed_p. + 2019-05-23 Uroš Bizjak <ubizjak@gmail.com> PR target/90552 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 7a2e43f..3d5cf9e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -26180,7 +26180,7 @@ split_stack_arg_pointer_used_p (void) /* Return whether we need to emit an ELFv2 global entry point prologue. */ static bool -rs6000_global_entry_point_needed_p (void) +rs6000_global_entry_point_prologue_needed_p (void) { /* Only needed for the ELFv2 ABI. */ if (DEFAULT_ABI != ABI_ELFv2) @@ -26191,6 +26191,10 @@ rs6000_global_entry_point_needed_p (void) if (TARGET_SINGLE_PIC_BASE) return false; + /* PC-relative functions never generate a global entry point prologue. */ + if (rs6000_pcrel_p (cfun)) + return false; + /* Ensure we have a global entry point for thunks. ??? We could avoid that if the target routine doesn't need a global entry point, but we do not know whether this is the case at this point. */ @@ -27547,10 +27551,9 @@ rs6000_output_function_prologue (FILE *file) /* ELFv2 ABI r2 setup code and local entry point. This must follow immediately after the global entry point label. */ - if (rs6000_global_entry_point_needed_p ()) + if (rs6000_global_entry_point_prologue_needed_p ()) { const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); - (*targetm.asm_out.internal_label) (file, "LCF", rs6000_pic_labelno); if (TARGET_CMODEL != CMODEL_LARGE) @@ -27601,6 +27604,19 @@ rs6000_output_function_prologue (FILE *file) fputs ("\n", file); } + else if (rs6000_pcrel_p (cfun)) + { + const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); + /* All functions compiled to use PC-relative addressing will + have a .localentry value of 0 or 1. For now we set it to + 1 all the time, indicating that the function may clobber + the TOC register r2. Later we may optimize this by setting + it to 0 if the function is a leaf and does not clobber r2. */ + fputs ("\t.localentry\t", file); + assemble_name (file, name); + fputs (",1\n", file); + } + /* Output -mprofile-kernel code. This needs to be done here instead of in output_function_profile since it must go after the ELFv2 ABI local entry point. */ @@ -33335,7 +33351,8 @@ rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); ASM_DECLARE_RESULT (file, DECL_RESULT (decl)); - if (TARGET_CMODEL == CMODEL_LARGE && rs6000_global_entry_point_needed_p ()) + if (TARGET_CMODEL == CMODEL_LARGE + && rs6000_global_entry_point_prologue_needed_p ()) { char buf[256]; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e3d9041..f8ab7b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-23 Bill Schmidt <wschmidt@linux.ibm.com> + + * gcc.target/powerpc/localentry-1.c: New file. + 2019-05-23 Uroš Bizjak <ubizjak@gmail.com> PR target/90552 diff --git a/gcc/testsuite/gcc.target/powerpc/localentry-1.c b/gcc/testsuite/gcc.target/powerpc/localentry-1.c new file mode 100644 index 0000000..ce687a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/localentry-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-mdejagnu-cpu=future -O2" } */ +/* { dg-require-effective-target powerpc_elfv2 } */ + +/* Ensure we generate ".localentry fn,1" for both leaf and non-leaf + functions. */ + +extern int y (int); + +int x (void) +{ + return y (5); +} + +void z (void) { }; + +/* { dg-final { scan-assembler {\.localentry\t\mx,1\M} } } */ +/* { dg-final { scan-assembler {\.localentry\t\mz,1\M} } } */ |