Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
cross-hppa-gcc48-icecream-backend.31962
gcc48-s390x-keep-leaf-when-profiled.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gcc48-s390x-keep-leaf-when-profiled.diff of Package cross-hppa-gcc48-icecream-backend.31962
For bnc #899871 commit 25e584cc74c33915a4539de63548408b4d6dc775 Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com> Date: Tue Sep 23 14:13:16 2014 +0000 Keep leaf when profiled. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 4fcefd7..fb8ff54 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10031,6 +10031,14 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, return const0_rtx; } +/* We call mcount before the function prologue. So a profiled leaf + function should stay a leaf function. */ + +static bool +s390_keep_leaf_when_profiled () +{ + return true; +} /* Output assembly code for the trampoline template to stdio stream FILE. @@ -11754,6 +11762,9 @@ s390_loop_unroll_adjust (unsigned nunroll, struct loop *loop) #undef TARGET_LIBCALL_VALUE #define TARGET_LIBCALL_VALUE s390_libcall_value +#undef TARGET_KEEP_LEAF_WHEN_PROFILED +#define TARGET_KEEP_LEAF_WHEN_PROFILED s390_keep_leaf_when_profiled + #undef TARGET_FIXED_CONDITION_CODE_REGS #define TARGET_FIXED_CONDITION_CODE_REGS s390_fixed_condition_code_regs diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 53b2a7a..3a81989 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4943,6 +4943,10 @@ Define this macro if the code for function profiling should come before the function prologue. Normally, the profiling code comes after. @end defmac +@deftypefn {Target Hook} bool TARGET_KEEP_LEAF_WHEN_PROFILED (void) +This target hook returns true if the target wants the leaf flag for the current function to stay true even if it calls mcount. This might make sense for targets using the leaf flag only to determine whether a stack frame needs to be generated or not and for which the call to mcount is generated before the function prologue. +@end deftypefn + @node Tail Calls @subsection Permitting tail calls @cindex tail calls diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index f2e7ab8..998fd32 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4872,6 +4872,8 @@ Define this macro if the code for function profiling should come before the function prologue. Normally, the profiling code comes after. @end defmac +@hook TARGET_KEEP_LEAF_WHEN_PROFILED + @node Tail Calls @subsection Permitting tail calls @cindex tail calls diff --git a/gcc/final.c b/gcc/final.c index d25b8e0..f43e866 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4155,7 +4155,9 @@ leaf_function_p (void) { rtx insn; - if (crtl->profile || profile_arc_flag) + /* Some back-ends (e.g. s390) want leaf functions to stay leaf + functions even if they call mcount. */ + if (crtl->profile && !targetm.keep_leaf_when_profiled ()) return 0; for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) diff --git a/gcc/target.def b/gcc/target.def index 831cad8..dece9b3 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1559,6 +1559,18 @@ The default version of this hook use the target macro\n\ bool, (void), default_profile_before_prologue) +/* Return true if a leaf function should stay leaf even with profiling + enabled. */ +DEFHOOK +(keep_leaf_when_profiled, + "This target hook returns true if the target wants the leaf flag for\ + the current function to stay true even if it calls mcount. This might\ + make sense for targets using the leaf flag only to determine whether a\ + stack frame needs to be generated or not and for which the call to\ + mcount is generated before the function prologue.", + bool, (void), + default_keep_leaf_when_profiled) + /* Modify and return the identifier of a DECL's external name, originally identified by ID, as required by the target, (eg, append @nn to windows32 stdcall function names). diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 6c12a4a..11043b8 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1420,6 +1420,15 @@ default_get_reg_raw_mode(int regno) return reg_raw_mode[regno]; } +/* Return true if a leaf function should stay leaf even with profiling + enabled. */ + +bool +default_keep_leaf_when_profiled () +{ + return false; +} + /* Return true if the state of option OPTION should be stored in PCH files and checked by default_pch_valid_p. Store the option's current state in STATE if so. */ diff --git a/gcc/targhooks.h b/gcc/targhooks.h index d23b352..c1df96a 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -187,6 +187,7 @@ extern int default_jump_align_max_skip (rtx); extern section * default_function_section(tree decl, enum node_frequency freq, bool startup, bool exit); extern enum machine_mode default_get_reg_raw_mode(int); +extern bool default_keep_leaf_when_profiled (); extern void *default_get_pch_validity (size_t *); extern const char *default_pch_valid_p (const void *, size_t);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor