On Mon, Jul 27, 2015 at 11:06:58AM +0200, Richard Biener wrote: > On Sat, Jul 25, 2015 at 4:37 AM, <tbsaunde+...@tbsaunde.org> wrote: > > From: Trevor Saunders <tbsaunde+...@tbsaunde.org> > > > > * config/arc/arc.h, config/bfin/bfin.h, config/frv/frv.h, > > config/ia64/ia64-protos.h, config/ia64/ia64.c, config/ia64/ia64.h, > > config/lm32/lm32.h, config/mep/mep.h, config/mmix/mmix.h, > > config/rs6000/rs6000.c, config/rs6000/xcoff.h, config/spu/spu.h, > > config/visium/visium.h, defaults.h: Define ASM_OUTPUT_LABEL to > > the name of a function. > > * output.h (default_output_label): New prototype. > > * varasm.c (default_output_label): New function. > > * vmsdbgout.c: Include tm_p.h. > > * xcoffout.c: Likewise. > > Just a general remark - the GCC output machinery is known to be slow, > adding indirect calls might be not the very best idea without refactoring > some of it.
ah, I wasn't aware of that. On the other hand some of these hooks seem to generally be big so the call over head might not matter that much. I suppose if this is something we really care about we might want to consider pushing the libgas project farther so we can avoid all this text formatting all together. > Did you do any performance measurements for artificial testcases > exercising the specific bits you change? no since I wasn't aware it was a concern. I can try to do that in the next couple days. thanks! Trev > > Richard. > > > --- > > gcc/config/arc/arc.h | 3 +-- > > gcc/config/bfin/bfin.h | 5 +---- > > gcc/config/frv/frv.h | 6 +----- > > gcc/config/ia64/ia64-protos.h | 1 + > > gcc/config/ia64/ia64.c | 11 +++++++++++ > > gcc/config/ia64/ia64.h | 8 +------- > > gcc/config/lm32/lm32.h | 3 +-- > > gcc/config/mep/mep.h | 8 +------- > > gcc/config/mmix/mmix.h | 3 +-- > > gcc/config/pa/pa-protos.h | 1 + > > gcc/config/pa/pa.c | 12 ++++++++++++ > > gcc/config/pa/pa.h | 9 +-------- > > gcc/config/rs6000/rs6000-protos.h | 1 + > > gcc/config/rs6000/rs6000.c | 8 ++++++++ > > gcc/config/rs6000/xcoff.h | 3 +-- > > gcc/config/spu/spu.h | 3 +-- > > gcc/config/visium/visium.h | 3 +-- > > gcc/defaults.h | 6 +----- > > gcc/output.h | 3 +++ > > gcc/varasm.c | 9 +++++++++ > > gcc/vmsdbgout.c | 1 + > > gcc/xcoffout.c | 1 + > > 22 files changed, 60 insertions(+), 48 deletions(-) > > > > diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h > > index d98cce1..d3747b9 100644 > > --- a/gcc/config/arc/arc.h > > +++ b/gcc/config/arc/arc.h > > @@ -1245,8 +1245,7 @@ do { > > \ > > > > /* This is how to output the definition of a user-level label named NAME, > > such as the label on a static function or variable NAME. */ > > -#define ASM_OUTPUT_LABEL(FILE, NAME) \ > > -do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > #define ASM_NAME_P(NAME) ( NAME[0]=='*') > > > > diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h > > index 26ba7c2..08906aa 100644 > > --- a/gcc/config/bfin/bfin.h > > +++ b/gcc/config/bfin/bfin.h > > @@ -1044,10 +1044,7 @@ typedef enum directives { > > ASM_OUTPUT_LABEL(FILE, NAME); \ > > } while (0) > > > > -#define ASM_OUTPUT_LABEL(FILE, NAME) \ > > - do { assemble_name (FILE, NAME); \ > > - fputs (":\n",FILE); \ > > - } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > #define ASM_OUTPUT_LABELREF(FILE,NAME) \ > > do { fprintf (FILE, "_%s", NAME); \ > > diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h > > index b0d66fd..1d25974 100644 > > --- a/gcc/config/frv/frv.h > > +++ b/gcc/config/frv/frv.h > > @@ -1668,11 +1668,7 @@ do { > > \ > > `assemble_name (STREAM, NAME)' to output the name itself; before and > > after > > that, output the additional assembler syntax for defining the name, and > > a > > newline. */ > > -#define ASM_OUTPUT_LABEL(STREAM, NAME) \ > > -do { \ > > - assemble_name (STREAM, NAME); > > \ > > - fputs (":\n", STREAM); \ > > -} while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > /* Globalizing directive for a label. */ > > #define GLOBAL_ASM_OP "\t.globl " > > diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h > > index 29fc714..8e540e4 100644 > > --- a/gcc/config/ia64/ia64-protos.h > > +++ b/gcc/config/ia64/ia64-protos.h > > @@ -72,6 +72,7 @@ extern rtx ia64_expand_builtin (tree, rtx, rtx, > > machine_mode, int); > > extern rtx ia64_va_arg (tree, tree); > > #endif /* RTX_CODE */ > > > > +extern void ia64_output_label (FILE *f, const char *label); > > extern void ia64_asm_output_external (FILE *, tree, const char *); > > extern void ia64_vms_output_aligned_decl_common (FILE *, tree, const char > > *, > > unsigned HOST_WIDE_INT, > > diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c > > index 779fc58..e07ebb5 100644 > > --- a/gcc/config/ia64/ia64.c > > +++ b/gcc/config/ia64/ia64.c > > @@ -10522,6 +10522,17 @@ ia64_hpux_function_arg_padding (machine_mode mode, > > const_tree type) > > return DEFAULT_FUNCTION_ARG_PADDING (mode, type); > > } > > > > +/* Assemble a label. */ > > + > > +void > > +ia64_output_label (FILE *f, const char *label) > > +{ > > + ia64_asm_output_label = 1; > > + assemble_name (f, label); > > + fputs (":\n", f); > > + ia64_asm_output_label = 0; > > +} > > + > > /* Emit text to declare externally defined variables and functions, because > > the Intel assembler does not support undefined externals. */ > > > > diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h > > index 4b62423..1afa7b7 100644 > > --- a/gcc/config/ia64/ia64.h > > +++ b/gcc/config/ia64/ia64.h > > @@ -1246,13 +1246,7 @@ do { > > \ > > why ia64_asm_output_label exists. */ > > > > extern int ia64_asm_output_label; > > -#define ASM_OUTPUT_LABEL(STREAM, NAME) \ > > -do { \ > > - ia64_asm_output_label = 1; \ > > - assemble_name (STREAM, NAME); > > \ > > - fputs (":\n", STREAM); \ > > - ia64_asm_output_label = 0; \ > > -} while (0) > > +#define ASM_OUTPUT_LABEL ia64_output_label > > > > /* Globalizing directive for a label. */ > > #define GLOBAL_ASM_OP "\t.global " > > diff --git a/gcc/config/lm32/lm32.h b/gcc/config/lm32/lm32.h > > index 986383f..9e8c667 100644 > > --- a/gcc/config/lm32/lm32.h > > +++ b/gcc/config/lm32/lm32.h > > @@ -443,8 +443,7 @@ do > > \ > > } \ > > while (0) > > > > -#define ASM_OUTPUT_LABEL(FILE, NAME) \ > > - do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > #define ASM_OUTPUT_LABELREF(FILE,NAME) \ > > do { \ > > diff --git a/gcc/config/mep/mep.h b/gcc/config/mep/mep.h > > index f7322cb7..8a9d447 100644 > > --- a/gcc/config/mep/mep.h > > +++ b/gcc/config/mep/mep.h > > @@ -625,13 +625,7 @@ typedef struct > > #define ASM_OUTPUT_ALIGNED_DECL_LOCAL(STREAM, DECL, NAME, SIZE, ALIGNMENT) > > \ > > mep_output_aligned_common (STREAM, DECL, NAME, SIZE, ALIGNMENT, 0) > > > > -#define ASM_OUTPUT_LABEL(STREAM, NAME) \ > > - do \ > > - { \ > > - assemble_name (STREAM, NAME); \ > > - fputs (":\n", STREAM); \ > > - } \ > > - while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > /* Globalizing directive for a label. */ > > #define GLOBAL_ASM_OP "\t.globl " > > diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h > > index 29d39bc..aac5aa0 100644 > > --- a/gcc/config/mmix/mmix.h > > +++ b/gcc/config/mmix/mmix.h > > @@ -647,8 +647,7 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; > > > > /* Node: Label Output */ > > > > -#define ASM_OUTPUT_LABEL(STREAM, NAME) \ > > - mmix_asm_output_label (STREAM, NAME) > > +#define ASM_OUTPUT_LABEL mmix_asm_output_label > > > > #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, NAME) \ > > mmix_asm_output_internal_label (STREAM, NAME) > > diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h > > index 0e13cd5..46a3e3b 100644 > > --- a/gcc/config/pa/pa-protos.h > > +++ b/gcc/config/pa/pa-protos.h > > @@ -110,6 +110,7 @@ extern void pa_asm_output_aligned_common (FILE *, const > > char *, > > extern void pa_asm_output_aligned_local (FILE *, const char *, > > unsigned HOST_WIDE_INT, > > unsigned int); > > +extern void pa_output_label (FILE *f, const char *label); > > extern void pa_hpux_asm_output_external (FILE *, tree, const char *); > > extern bool pa_cannot_change_mode_class (machine_mode, machine_mode, > > enum reg_class); > > diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c > > index b24413a..2bcaa7e 100644 > > --- a/gcc/config/pa/pa.c > > +++ b/gcc/config/pa/pa.c > > @@ -9761,6 +9761,18 @@ pa_reloc_rw_mask (void) > > return 3; > > } > > > > +/* Assemble a lable. */ > > + > > +void > > +pa_output_label (FILE *f, const char *label) > > +{ > > + assemble_name (f, label); > > + if (TARGET_GAS) > > + fputs (":\n", f); > > + else > > + fputc ('\n', (f)); > > +} > > + > > static void > > pa_globalize_label (FILE *stream, const char *name) > > { > > diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h > > index bdfbb16..595a10b 100644 > > --- a/gcc/config/pa/pa.h > > +++ b/gcc/config/pa/pa.h > > @@ -1107,14 +1107,7 @@ do { > > \ > > /* This is how to output the definition of a user-level label named NAME, > > such as the label on a static function or variable NAME. */ > > > > -#define ASM_OUTPUT_LABEL(FILE,NAME) \ > > - do { \ > > - assemble_name ((FILE), (NAME)); \ > > - if (TARGET_GAS) \ > > - fputs (":\n", (FILE)); \ > > - else \ > > - fputc ('\n', (FILE)); \ > > - } while (0) > > +#define ASM_OUTPUT_LABEL pa_output_label > > > > /* This is how to output a reference to a user-level label named NAME. > > `assemble_name' uses this. */ > > diff --git a/gcc/config/rs6000/rs6000-protos.h > > b/gcc/config/rs6000/rs6000-protos.h > > index 560a825..031614f 100644 > > --- a/gcc/config/rs6000/rs6000-protos.h > > +++ b/gcc/config/rs6000/rs6000-protos.h > > @@ -169,6 +169,7 @@ extern int function_ok_for_sibcall (tree); > > extern int rs6000_reg_parm_stack_space (tree, bool); > > extern void rs6000_xcoff_declare_function_name (FILE *, const char *, > > tree); > > extern void rs6000_xcoff_declare_object_name (FILE *, const char *, tree); > > +extern void rs6000_xcoff_output_label (FILE *f, const char *label); > > extern void rs6000_elf_declare_function_name (FILE *, const char *, tree); > > extern bool rs6000_elf_in_small_data_p (const_tree); > > #ifdef ARGS_SIZE_RTX > > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c > > index c8794b4..a214010 100644 > > --- a/gcc/config/rs6000/rs6000.c > > +++ b/gcc/config/rs6000/rs6000.c > > @@ -30364,6 +30364,14 @@ rs6000_xcoff_asm_output_anchor (rtx symbol) > > fprintf (asm_out_file, "\n"); > > } > > > > +/* Assemble the given label. */ > > +void > > +rs6000_xcoff_output_label (FILE *f, const char *label) > > +{ > > + RS6000_OUTPUT_BASENAME (f, label); > > + fputs (":\n", f); > > +} > > + > > static void > > rs6000_xcoff_asm_globalize_label (FILE *stream, const char *name) > > { > > diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h > > index 8b0cb27..263e239 100644 > > --- a/gcc/config/rs6000/xcoff.h > > +++ b/gcc/config/rs6000/xcoff.h > > @@ -119,8 +119,7 @@ > > /* This is how to output the definition of a user-level label named NAME, > > such as the label on a static function or variable NAME. */ > > > > -#define ASM_OUTPUT_LABEL(FILE,NAME) \ > > - do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while > > (0) > > +#define ASM_OUTPUT_LABEL rs6000_xcoff_output_label > > > > /* This is how to output a command to make the user-level label named NAME > > defined for reference from other files. */ > > diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h > > index 25fa435..f35b55e 100644 > > --- a/gcc/config/spu/spu.h > > +++ b/gcc/config/spu/spu.h > > @@ -443,8 +443,7 @@ do { > > \ > > > > > > /* Label Output */ > > -#define ASM_OUTPUT_LABEL(FILE,NAME) \ > > - do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > #define ASM_OUTPUT_LABELREF(FILE, NAME) \ > > asm_fprintf (FILE, "%U%s", default_strip_name_encoding (NAME)) > > diff --git a/gcc/config/visium/visium.h b/gcc/config/visium/visium.h > > index a2ab61c..6457c55 100644 > > --- a/gcc/config/visium/visium.h > > +++ b/gcc/config/visium/visium.h > > @@ -1440,8 +1440,7 @@ do > > \ > > `assemble_name (STREAM, NAME)' to output the name itself; before > > and after that, output the additional assembler syntax for defining > > the name, and a newline. */ > > -#define ASM_OUTPUT_LABEL(STREAM,NAME) \ > > - do { assemble_name (STREAM, NAME); fputs (":\n", STREAM); } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > > > /* Globalizing directive for a label */ > > #define GLOBAL_ASM_OP "\t.global " > > diff --git a/gcc/defaults.h b/gcc/defaults.h > > index 3ecf9fd..b1465de 100644 > > --- a/gcc/defaults.h > > +++ b/gcc/defaults.h > > @@ -89,11 +89,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. > > If not, see > > NAME, such as the label on variable NAME. */ > > > > #ifndef ASM_OUTPUT_LABEL > > -#define ASM_OUTPUT_LABEL(FILE,NAME) \ > > - do { \ > > - assemble_name ((FILE), (NAME)); \ > > - fputs (":\n", (FILE)); \ > > - } while (0) > > +#define ASM_OUTPUT_LABEL default_output_label > > #endif > > > > /* This is how to output the definition of a user-level label named > > diff --git a/gcc/output.h b/gcc/output.h > > index 8aa648a..07172d5 100644 > > --- a/gcc/output.h > > +++ b/gcc/output.h > > @@ -246,6 +246,9 @@ extern void assemble_name_raw (FILE *, const char *); > > be marked as referenced. */ > > extern void assemble_name (FILE *, const char *); > > > > +/* Assemble a label. */ > > +extern void default_output_label (FILE *f, const char *label); > > + > > /* Return the assembler directive for creating a given kind of integer > > object. SIZE is the number of bytes in the object and ALIGNED_P > > indicates whether it is known to be aligned. Return NULL if the > > diff --git a/gcc/varasm.c b/gcc/varasm.c > > index c2bfbf0..9c5f12d 100644 > > --- a/gcc/varasm.c > > +++ b/gcc/varasm.c > > @@ -2580,6 +2580,15 @@ assemble_name (FILE *file, const char *name) > > assemble_name_raw (file, name); > > } > > > > +/* Assemble a label. */ > > + > > +void > > +default_output_label (FILE *f, const char *label) > > +{ > > + assemble_name (f, label); > > + fputs (":\n", f); > > +} > > + > > /* Allocate SIZE bytes writable static space with a gensym name > > and return an RTX to refer to its address. */ > > > > diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c > > index 0204740..d04b8fb 100644 > > --- a/gcc/vmsdbgout.c > > +++ b/gcc/vmsdbgout.c > > @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see > > #include "langhooks.h" > > #include "function.h" > > #include "target.h" > > +#include "tm_p.h" > > > > /* Difference in seconds between the VMS Epoch and the Unix Epoch */ > > static const long long vms_epoch_offset = 3506716800ll; > > diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c > > index 0f11115..83959c8 100644 > > --- a/gcc/xcoffout.c > > +++ b/gcc/xcoffout.c > > @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see > > #include "output.h" > > #include "target.h" > > #include "debug.h" > > +#include "tm_p.h" > > > > #ifdef XCOFF_DEBUGGING_INFO > > > > -- > > 2.4.0 > >