aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>2014-06-25 14:46:08 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2014-06-25 10:46:08 -0400
commitb36e833f1a28c18f801c299e8d103cf983b2932d (patch)
tree836513d643afff7df9110755631657b226fe66fb
parentc69c28351f82d95e4c75bf40acdf7ff50c7639a0 (diff)
downloadgcc-b36e833f1a28c18f801c299e8d103cf983b2932d.zip
gcc-b36e833f1a28c18f801c299e8d103cf983b2932d.tar.gz
gcc-b36e833f1a28c18f801c299e8d103cf983b2932d.tar.bz2
xcoff.h (ASM_DECLARE_FUNCTION_NAME): Replace implementation with call to...
* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Replace implementation with call to... * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New function. * config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name): Declare. From-SVN: r211982
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c65
-rw-r--r--gcc/config/rs6000/xcoff.h66
4 files changed, 80 insertions, 61 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 45d1df4..c518c0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2014-06-25 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Replace
+ implementation with call to...
+ * config/rs6000/rs6000.c (rs6000_xcoff_declare_function_name): New
+ function.
+ * config/rs6000/rs6000-protos.h (rs6000_xcoff_declare_function_name):
+ Declare.
+
2014-06-25 Marc Glisse <marc.glisse@inria.fr>
PR tree-optimization/57742
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index 07d84db..6a2a930 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -164,6 +164,7 @@ extern rtx rs6000_libcall_value (enum machine_mode);
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
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 5711a03..fc7d766 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -29452,6 +29452,71 @@ rs6000_xcoff_file_end (void)
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)
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index f2b7bd0..847edc9 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -134,67 +134,11 @@
#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.
-
- 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. */
-
-#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); \
-}
+/* This macro produces the initial definition of a function name. */
+
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ rs6000_xcoff_declare_function_name ((FILE), (NAME), (DECL))
/* Output a reference to SYM on FILE. */