From 61c2546ba0aa0e9b2743f8d64427143aac5af2b0 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Wed, 29 Jul 2015 16:14:23 +0100 Subject: [PATCH] Add new hooks ASM_OUTPUT_START_FUNCTION_HEADER ... and ASM_OUTPUT_END_FUNCTION_FOOTER. These are used by the implementation of __attribute__ ((target(...))) on S390. --- gcc/defaults.h | 10 ++++++++++ gcc/doc/tm.texi | 14 ++++++++++++++ gcc/doc/tm.texi.in | 14 ++++++++++++++ gcc/varasm.c | 2 ++ 4 files changed, 40 insertions(+) diff --git a/gcc/defaults.h b/gcc/defaults.h index d4d3a56..aa9c849 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -135,6 +135,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) false #endif +/* Output additional assemler code at the very start of the function. */ +#ifndef ASM_OUTPUT_START_FUNCTION_HEADER +#define ASM_OUTPUT_START_FUNCTION_HEADER(FILE,DECL) do { } while (0) +#endif + +/* Output additional assemler code at the very end of the function. */ +#ifndef ASM_OUTPUT_END_FUNCTION_FOOTER +#define ASM_OUTPUT_START_FUNCTION_FOOTER(FILE,DECL) do { } while (0) +#endif + /* This is how to output the definition of a user-level label named NAME, such as the label on variable NAME. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index d548d96..7ba00c3 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -7917,6 +7917,20 @@ If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default definition of this macro is provided. @end defmac +@defmac ASM_OUTPUT_START_FUNCTION_HEADER (@var{stream}, @var{decl}) +A C statement (sans semicolon) to output to the stdio stream +@var{stream} additional assembly language code to be placed at the +very start of the current function. The default definition of this +macro does nothing. +@end defmac + +@defmac ASM_OUTPUT_END_FUNCTION_FOOTER (@var{stream}, @var{decl}) +A C statement (sans semicolon) to output to the stdio stream +@var{stream} additional assembly language code at the very end of +the current function. The default definition of this macro does +nothing. +@end defmac + @defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name @var{name} of a diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 9bef4a5..2b2b7e4 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -5546,6 +5546,20 @@ If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default definition of this macro is provided. @end defmac +@defmac ASM_OUTPUT_START_FUNCTION_HEADER (@var{stream}, @var{decl}) +A C statement (sans semicolon) to output to the stdio stream +@var{stream} additional assembly language code to be placed at the +very start of the current function. The default definition of this +macro does nothing. +@end defmac + +@defmac ASM_OUTPUT_END_FUNCTION_FOOTER (@var{stream}, @var{decl}) +A C statement (sans semicolon) to output to the stdio stream +@var{stream} additional assembly language code at the very end of +the current function. The default definition of this macro does +nothing. +@end defmac + @defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl}) A C statement (sans semicolon) to output to the stdio stream @var{stream} any text necessary for declaring the name @var{name} of a diff --git a/gcc/varasm.c b/gcc/varasm.c index 706e652..dcee8f0 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1701,6 +1701,7 @@ assemble_start_function (tree decl, const char *fnname) char tmp_label[100]; bool hot_label_written = false; + ASM_OUTPUT_START_FUNCTION_HEADER (asm_out_file, current_function_decl); if (flag_reorder_blocks_and_partition) { ASM_GENERATE_INTERNAL_LABEL (tmp_label, "LHOTB", const_labelno); @@ -1864,6 +1865,7 @@ assemble_end_function (tree decl, const char *fnname ATTRIBUTE_UNUSED) ASM_OUTPUT_LABEL (asm_out_file, crtl->subsections.hot_section_end_label); switch_to_section (save_text_section); } + ASM_OUTPUT_END_FUNCTION_FOOTER (asm_out_file, current_function_decl); } /* Assemble code to leave SIZE bytes of zeros. */ -- 2.3.0