From e6c4532a6d0f79b94f327d4f9a067faf3988a852 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 25 Jul 2017 14:16:10 +0000 Subject: 2017-07-07 Torsten Duwe c-family/ * c-attribs.c (c_common_attribute_table): Add entry for "patchable_function_entry". lto/ * lto-lang.c (lto_attribute_table): Add entry for "patchable_function_entry". * common.opt: Introduce -fpatchable-function-entry command line option, and its variables function_entry_patch_area_size and function_entry_patch_area_start. * opts.c (common_handle_option): Add -fpatchable_function_entry_ case, including a two-value parser. * target.def (print_patchable_function_entry): New target hook. * targhooks.h (default_print_patchable_function_entry): New function. * targhooks.c (default_print_patchable_function_entry): Likewise. * toplev.c (process_options): Switch off IPA-RA if patchable function entries are being generated. * varasm.c (assemble_start_function): Look at the patchable-function-entry command line switch and current function attributes and maybe generate NOP instructions by calling the print_patchable_function_entry hook. * doc/extend.texi: Document patchable_function_entry attribute. * doc/invoke.texi: Document -fpatchable_function_entry command line option. * doc/tm.texi.in (TARGET_ASM_PRINT_PATCHABLE_FUNCTION_ENTRY): New target hook. * doc/tm.texi: Re-generate. * c-c++-common/patchable_function_entry-default.c: New test. * c-c++-common/patchable_function_entry-decl.c: Likewise. * c-c++-common/patchable_function_entry-definition.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250521 138bc75d-0d04-0410-961f-82ee72b054a4 --- .../c-c++-common/patchable_function_entry-definition.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/patchable_function_entry-definition.c (limited to 'gcc/testsuite/c-c++-common/patchable_function_entry-definition.c') diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c new file mode 100644 index 00000000000..a007867dcb0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */ +/* { dg-final { scan-assembler-times "nop" 1 } } */ + +extern int a; + +int f3 (void); + +/* F3 should now get 1 NOP. */ +int +__attribute__((noinline)) +__attribute__((patchable_function_entry(1))) +f3 (void) +{ + return 5*a; +} -- cgit v1.2.1