* [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
@ 2014-06-24 18:45 David Edelsohn
2014-06-24 18:53 ` Jan Hubicka
0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2014-06-24 18:45 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
In preparation to fix the alias issues on AIX, this patch changes
ASM_DECLARE_FUNCTION_NAME from a macro to a function.
Bootstrap on powerpc-ibm-aix7.1.0.0 in progress.
* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Remove definition
and call...
* config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New
function.
* config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name):
Declare.
Thanks, David
[-- Attachment #2: xcoff-declare-func.txt --]
[-- Type: text/plain, Size: 6117 bytes --]
* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Remove definition
and call...
* config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New
function.
* config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name):
Declare.
Index: rs6000-protos.h
===================================================================
--- rs6000-protos.h (revision 211938)
+++ rs6000-protos.h (working copy)
@@ -164,6 +164,7 @@
extern rtx rs6000_va_arg (tree, tree);
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_elf_declare_function_name (FILE *, const char *, tree);
extern bool rs6000_elf_in_small_data_p (const_tree);
#ifdef ARGS_SIZE_RTX
Index: rs6000.c
===================================================================
--- rs6000.c (revision 211938)
+++ rs6000.c (working copy)
@@ -29452,6 +29452,71 @@
asm_out_file);
}
+/* This macro produces the initial definition of a function name.
+ On the RS/6000, we need to place an extra '.' in the function name and
+ output the function descriptor.
+ Dollar signs are converted to underscores.
+
+ The csect for the function will have already been created when
+ text_section was selected. We do have to go back to that csect, however.
+
+ The third and fourth parameters to the .function pseudo-op (16 and 044)
+ are placeholders which no longer have any use. */
+
+void
+rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl)
+{
+ char *buffer = (char *) alloca (strlen (name) + 1);
+ char *p;
+ int dollar_inside = 0;
+ strcpy (buffer, name);
+ p = strchr (buffer, '$');
+ while (p) {
+ *p = '_';
+ dollar_inside++;
+ p = strchr (p + 1, '$');
+ }
+ if (TREE_PUBLIC (decl))
+ {
+ if (!RS6000_WEAK || !DECL_WEAK (decl))
+ {
+ if (dollar_inside) {
+ fprintf(file, "\t.rename .%s,\".%s\"\n", buffer, name);
+ fprintf(file, "\t.rename %s,\"%s\"\n", buffer, name);
+ }
+ fputs ("\t.globl .", file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ putc ('\n', file);
+ }
+ }
+ else
+ {
+ if (dollar_inside) {
+ fprintf(file, "\t.rename .%s,\".%s\"\n", buffer, name);
+ fprintf(file, "\t.rename %s,\"%s\"\n", buffer, name);
+ }
+ fputs ("\t.lglobl .", file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ putc ('\n', file);
+ }
+ fputs ("\t.csect ", file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ fputs (":\n", file);
+ fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ fputs (", TOC[tc0], 0\n", file);
+ in_section = NULL;
+ switch_to_section (function_section (decl));
+ putc ('.', file);
+ RS6000_OUTPUT_BASENAME (file, buffer);
+ fputs (":\n", file);
+ if (write_symbols != NO_DEBUG && !DECL_IGNORED_P (decl))
+ xcoffout_declare_function (file, decl, buffer);
+ return;
+}
+
#ifdef HAVE_AS_TLS
static void
rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
Index: xcoff.h
===================================================================
--- xcoff.h (revision 211938)
+++ xcoff.h (working copy)
@@ -134,68 +134,12 @@
#undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
-/* This macro produces the initial definition of a function name.
- On the RS/6000, we need to place an extra '.' in the function name and
- output the function descriptor.
- Dollar signs are converted to underscores.
+/* This macro produces the initial definition of a function name. */
- The csect for the function will have already been created when
- text_section was selected. We do have to go back to that csect, however.
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ rs6000_xcoff_declare_function_name ((FILE), (NAME), (DECL))
- The third and fourth parameters to the .function pseudo-op (16 and 044)
- are placeholders which no longer have any use. */
-
-#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
-{ char *buffer = (char *) alloca (strlen (NAME) + 1); \
- char *p; \
- int dollar_inside = 0; \
- strcpy (buffer, NAME); \
- p = strchr (buffer, '$'); \
- while (p) { \
- *p = '_'; \
- dollar_inside++; \
- p = strchr (p + 1, '$'); \
- } \
- if (TREE_PUBLIC (DECL)) \
- { \
- if (!RS6000_WEAK || !DECL_WEAK (decl)) \
- { \
- if (dollar_inside) { \
- fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \
- fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \
- } \
- fputs ("\t.globl .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- putc ('\n', FILE); \
- } \
- } \
- else \
- { \
- if (dollar_inside) { \
- fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \
- fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \
- } \
- fputs ("\t.lglobl .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- putc ('\n', FILE); \
- } \
- fputs ("\t.csect ", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- fputs (":\n", FILE); \
- fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- fputs (", TOC[tc0], 0\n", FILE); \
- in_section = NULL; \
- switch_to_section (function_section (DECL)); \
- putc ('.', FILE); \
- RS6000_OUTPUT_BASENAME (FILE, buffer); \
- fputs (":\n", FILE); \
- if (write_symbols != NO_DEBUG && !DECL_IGNORED_P (DECL)) \
- xcoffout_declare_function (FILE, DECL, buffer); \
-}
-
/* Output a reference to SYM on FILE. */
#define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
2014-06-24 18:45 [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function David Edelsohn
@ 2014-06-24 18:53 ` Jan Hubicka
2014-06-25 14:58 ` David Edelsohn
0 siblings, 1 reply; 6+ messages in thread
From: Jan Hubicka @ 2014-06-24 18:53 UTC (permalink / raw)
To: David Edelsohn; +Cc: GCC Patches, Jan Hubicka
> In preparation to fix the alias issues on AIX, this patch changes
> ASM_DECLARE_FUNCTION_NAME from a macro to a function.
Thanks, David!
We will also need to introduce ASM_DECLARE_OBJECT_NAME to handle the aliases
of variables. I can look into that probably later this week (it is last week
of my teaching and I need to do the finals)
Honza
>
> Bootstrap on powerpc-ibm-aix7.1.0.0 in progress.
>
> * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Remove definition
> and call...
> * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New
> function.
> * config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name):
> Declare.
>
>
> Thanks, David
> * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Remove definition
> and call...
> * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New
> function.
> * config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name):
> Declare.
>
> Index: rs6000-protos.h
> ===================================================================
> --- rs6000-protos.h (revision 211938)
> +++ rs6000-protos.h (working copy)
> @@ -164,6 +164,7 @@
> extern rtx rs6000_va_arg (tree, tree);
> 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_elf_declare_function_name (FILE *, const char *, tree);
> extern bool rs6000_elf_in_small_data_p (const_tree);
> #ifdef ARGS_SIZE_RTX
> Index: rs6000.c
> ===================================================================
> --- rs6000.c (revision 211938)
> +++ rs6000.c (working copy)
> @@ -29452,6 +29452,71 @@
> asm_out_file);
> }
>
> +/* This macro produces the initial definition of a function name.
> + On the RS/6000, we need to place an extra '.' in the function name and
> + output the function descriptor.
> + Dollar signs are converted to underscores.
> +
> + The csect for the function will have already been created when
> + text_section was selected. We do have to go back to that csect, however.
> +
> + The third and fourth parameters to the .function pseudo-op (16 and 044)
> + are placeholders which no longer have any use. */
> +
> +void
> +rs6000_xcoff_declare_function_name (FILE *file, const char *name, tree decl)
> +{
> + char *buffer = (char *) alloca (strlen (name) + 1);
> + char *p;
> + int dollar_inside = 0;
> + strcpy (buffer, name);
> + p = strchr (buffer, '$');
> + while (p) {
> + *p = '_';
> + dollar_inside++;
> + p = strchr (p + 1, '$');
> + }
> + if (TREE_PUBLIC (decl))
> + {
> + if (!RS6000_WEAK || !DECL_WEAK (decl))
> + {
> + if (dollar_inside) {
> + fprintf(file, "\t.rename .%s,\".%s\"\n", buffer, name);
> + fprintf(file, "\t.rename %s,\"%s\"\n", buffer, name);
> + }
> + fputs ("\t.globl .", file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + putc ('\n', file);
> + }
> + }
> + else
> + {
> + if (dollar_inside) {
> + fprintf(file, "\t.rename .%s,\".%s\"\n", buffer, name);
> + fprintf(file, "\t.rename %s,\"%s\"\n", buffer, name);
> + }
> + fputs ("\t.lglobl .", file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + putc ('\n', file);
> + }
> + fputs ("\t.csect ", file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + fputs (":\n", file);
> + fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + fputs (", TOC[tc0], 0\n", file);
> + in_section = NULL;
> + switch_to_section (function_section (decl));
> + putc ('.', file);
> + RS6000_OUTPUT_BASENAME (file, buffer);
> + fputs (":\n", file);
> + if (write_symbols != NO_DEBUG && !DECL_IGNORED_P (decl))
> + xcoffout_declare_function (file, decl, buffer);
> + return;
> +}
> +
> #ifdef HAVE_AS_TLS
> static void
> rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
> Index: xcoff.h
> ===================================================================
> --- xcoff.h (revision 211938)
> +++ xcoff.h (working copy)
> @@ -134,68 +134,12 @@
> #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE
> #define TARGET_ASM_FILE_START_FILE_DIRECTIVE false
>
> -/* This macro produces the initial definition of a function name.
> - On the RS/6000, we need to place an extra '.' in the function name and
> - output the function descriptor.
> - Dollar signs are converted to underscores.
> +/* This macro produces the initial definition of a function name. */
>
> - The csect for the function will have already been created when
> - text_section was selected. We do have to go back to that csect, however.
> +#undef ASM_DECLARE_FUNCTION_NAME
> +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
> + rs6000_xcoff_declare_function_name ((FILE), (NAME), (DECL))
>
> - The third and fourth parameters to the .function pseudo-op (16 and 044)
> - are placeholders which no longer have any use. */
> -
> -#define ASM_DECLARE_FUNCTION_NAME(FILE,NAME,DECL) \
> -{ char *buffer = (char *) alloca (strlen (NAME) + 1); \
> - char *p; \
> - int dollar_inside = 0; \
> - strcpy (buffer, NAME); \
> - p = strchr (buffer, '$'); \
> - while (p) { \
> - *p = '_'; \
> - dollar_inside++; \
> - p = strchr (p + 1, '$'); \
> - } \
> - if (TREE_PUBLIC (DECL)) \
> - { \
> - if (!RS6000_WEAK || !DECL_WEAK (decl)) \
> - { \
> - if (dollar_inside) { \
> - fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \
> - fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \
> - } \
> - fputs ("\t.globl .", FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - putc ('\n', FILE); \
> - } \
> - } \
> - else \
> - { \
> - if (dollar_inside) { \
> - fprintf(FILE, "\t.rename .%s,\".%s\"\n", buffer, NAME); \
> - fprintf(FILE, "\t.rename %s,\"%s\"\n", buffer, NAME); \
> - } \
> - fputs ("\t.lglobl .", FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - putc ('\n', FILE); \
> - } \
> - fputs ("\t.csect ", FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - fputs (TARGET_32BIT ? "[DS]\n" : "[DS],3\n", FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - fputs (":\n", FILE); \
> - fputs (TARGET_32BIT ? "\t.long ." : "\t.llong .", FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - fputs (", TOC[tc0], 0\n", FILE); \
> - in_section = NULL; \
> - switch_to_section (function_section (DECL)); \
> - putc ('.', FILE); \
> - RS6000_OUTPUT_BASENAME (FILE, buffer); \
> - fputs (":\n", FILE); \
> - if (write_symbols != NO_DEBUG && !DECL_IGNORED_P (DECL)) \
> - xcoffout_declare_function (FILE, DECL, buffer); \
> -}
> -
> /* Output a reference to SYM on FILE. */
>
> #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
2014-06-24 18:53 ` Jan Hubicka
@ 2014-06-25 14:58 ` David Edelsohn
2014-06-25 22:23 ` Jan Hubicka
0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2014-06-25 14:58 UTC (permalink / raw)
To: Jan Hubicka; +Cc: GCC Patches
On Tue, Jun 24, 2014 at 2:53 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> We will also need to introduce ASM_DECLARE_OBJECT_NAME to handle the aliases
> of variables. I can look into that probably later this week (it is last week
> of my teaching and I need to do the finals)
varasm.c defaults to ASM_OUTPUT_LABEL if ASM_DECLARE_OBJECT_NAME is
not defined. An alias would be another label. Or does this need to
emit another TOC reference also?
Thanks, David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
2014-06-25 14:58 ` David Edelsohn
@ 2014-06-25 22:23 ` Jan Hubicka
2014-06-26 2:44 ` David Edelsohn
0 siblings, 1 reply; 6+ messages in thread
From: Jan Hubicka @ 2014-06-25 22:23 UTC (permalink / raw)
To: David Edelsohn; +Cc: Jan Hubicka, GCC Patches
> On Tue, Jun 24, 2014 at 2:53 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>
> > We will also need to introduce ASM_DECLARE_OBJECT_NAME to handle the aliases
> > of variables. I can look into that probably later this week (it is last week
> > of my teaching and I need to do the finals)
>
> varasm.c defaults to ASM_OUTPUT_LABEL if ASM_DECLARE_OBJECT_NAME is
> not defined. An alias would be another label. Or does this need to
> emit another TOC reference also?
We do not need TOC references, but we need to output aliases there and for that
we need to know the declaratoin, so I need to introduce DECLARE_OBJECT_NAME.
I will look into it either tonight or later this week.
Thanks for the patch :)
Honza
>
> Thanks, David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
2014-06-25 22:23 ` Jan Hubicka
@ 2014-06-26 2:44 ` David Edelsohn
2014-06-29 2:58 ` David Edelsohn
0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2014-06-26 2:44 UTC (permalink / raw)
To: Jan Hubicka; +Cc: GCC Patches
On Wed, Jun 25, 2014 at 6:23 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> We do not need TOC references, but we need to output aliases there and for that
> we need to know the declaratoin, so I need to introduce DECLARE_OBJECT_NAME.
> I will look into it either tonight or later this week.
> Thanks for the patch :)
All uses in varasm.c are
#ifdef ASM_DECLARE_OBJECT_NAME
last_assemble_variable_decl = decl;
ASM_DECLARE_OBJECT_NAME (file, name, decl);
#else
/* Standard thing is just output label for the object. */
ASM_OUTPUT_LABEL (file, name);
#endif /* ASM_DECLARE_OBJECT_NAME */
A simple LABEL should be correct for AIX assembler; there is no
additional decoration. Are you planning a new use of
ASM_DECLARE_OBJECT_NAME that requires a definition instead of the
above logic?
Thanks, David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function
2014-06-26 2:44 ` David Edelsohn
@ 2014-06-29 2:58 ` David Edelsohn
0 siblings, 0 replies; 6+ messages in thread
From: David Edelsohn @ 2014-06-29 2:58 UTC (permalink / raw)
To: Jan Hubicka; +Cc: GCC Patches
BTW, if I enable MAKE_DECL_ONE_ONLY for XCOFF, the endless loop does
not occur, so it clearly has some effect on AIX. Maybe it can
function well-enough on AIX.
- David
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-29 2:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 18:45 [PATCH] Convert XCOFF ASM_DECLARE_FUNCTION_NAME to function David Edelsohn
2014-06-24 18:53 ` Jan Hubicka
2014-06-25 14:58 ` David Edelsohn
2014-06-25 22:23 ` Jan Hubicka
2014-06-26 2:44 ` David Edelsohn
2014-06-29 2:58 ` David Edelsohn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).