From 417ca0117a1a9a8aaf5bc5ca530adfd68cb00399 Mon Sep 17 00:00:00 2001 From: Torsten Duwe Date: Tue, 25 Jul 2017 14:16:10 +0000 Subject: c-attribs.c (c_common_attribute_table): Add entry for "patchable_function_entry". 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. From-SVN: r250521 --- gcc/opts.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gcc/opts.c') diff --git a/gcc/opts.c b/gcc/opts.c index 3182bc9..ec45a0f 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2207,6 +2207,33 @@ common_handle_option (struct gcc_options *opts, opts->x_flag_ipa_reference = false; break; + case OPT_fpatchable_function_entry_: + { + char *patch_area_arg = xstrdup (arg); + char *comma = strchr (patch_area_arg, ','); + if (comma) + { + *comma = '\0'; + function_entry_patch_area_size = + integral_argument (patch_area_arg); + function_entry_patch_area_start = + integral_argument (comma + 1); + } + else + { + function_entry_patch_area_size = + integral_argument (patch_area_arg); + function_entry_patch_area_start = 0; + } + if (function_entry_patch_area_size < 0 + || function_entry_patch_area_start < 0 + || function_entry_patch_area_size + < function_entry_patch_area_start) + error ("invalid arguments for %<-fpatchable_function_entry%>"); + free (patch_area_arg); + } + break; + case OPT_ftree_vectorize: if (!opts_set->x_flag_tree_loop_vectorize) opts->x_flag_tree_loop_vectorize = value; -- cgit v1.1