diff options
author | Michael Hayes <m.hayes@elec.canterbury.ac.nz> | 2000-02-11 04:55:07 +0000 |
---|---|---|
committer | Michael Hayes <m.hayes@gcc.gnu.org> | 2000-02-11 04:55:07 +0000 |
commit | eff784fe63920fdf425e73ae1b88aa677b2cddab (patch) | |
tree | 377f3f8aab615f92687ebb1a416424330dc5a7bc /gcc | |
parent | cf4ed945eab57de7fe5b2f736cc773659a966a0c (diff) | |
download | gcc-eff784fe63920fdf425e73ae1b88aa677b2cddab.zip gcc-eff784fe63920fdf425e73ae1b88aa677b2cddab.tar.gz gcc-eff784fe63920fdf425e73ae1b88aa677b2cddab.tar.bz2 |
c4x.h (ASM_GLOBALIZE_LABEL): Use c4x_global_label.
* config/c4x/c4x.h (ASM_GLOBALIZE_LABEL): Use c4x_global_label.
(ASM_OUTPUT_EXTERNAL): Use c4x_external_ref.
(ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise.
(ASM_FILE_END): Use c4x_file_end.
* config/c4x/c4x.c (c4x_global_label): New function.
(c4x_external_ref, c4x_file_end): Likewise.
* config/c4x/c4x-protos.h (c4x_global_label): Add prototype.
(c4x_external_ref, c4x_end_file): Likewise.
From-SVN: r31909
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/c4x/c4x-protos.h | 6 | ||||
-rw-r--r-- | gcc/config/c4x/c4x.c | 109 | ||||
-rw-r--r-- | gcc/config/c4x/c4x.h | 22 |
4 files changed, 132 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 255ab22..cfbed1d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2000-02-11 Michael Hayes <m.hayes@elec.canterbury.ac.nz> + + * config/c4x/c4x.h (ASM_GLOBALIZE_LABEL): Use c4x_global_label. + (ASM_OUTPUT_EXTERNAL): Use c4x_external_ref. + (ASM_OUTPUT_EXTERNAL_LIBCALL): Likewise. + (ASM_FILE_END): Use c4x_file_end. + * config/c4x/c4x.c (c4x_global_label): New function. + (c4x_external_ref, c4x_file_end): Likewise. + * config/c4x/c4x-protos.h (c4x_global_label): Add prototype. + (c4x_external_ref, c4x_end_file): Likewise. + + 2000-02-10 Zack Weinberg <zack@wolery.cumb.org> * cppexp.c: Don't include cpphash.h. diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 3e4439b..8c5806b 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -37,6 +37,12 @@ extern int c4x_handle_pragma PARAMS ((int (* p_getc) (void), void (* p_ungetc) (int), char *)); +extern void c4x_global_label (char *); + +extern void c4x_external_ref (char *); + +extern void c4x_file_end (FILE *); + #ifdef TREE_CODE extern void c4x_set_default_attributes PARAMS ((tree, tree *)); diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index e0051ea..07b8b51 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -4396,19 +4396,122 @@ c4x_handle_pragma (p_getc, p_ungetc, pname) } +struct name_list +{ + struct name_list *next; + char *name; +}; + +static struct name_list *global_head; +static struct name_list *extern_head; + + +/* Add NAME to list of global symbols and remove from external list if + present on external list. */ + +void +c4x_global_label (name) + char *name; +{ + struct name_list *p, *last; + + /* Do not insert duplicate names, so linearly search through list of + existing names. */ + p = global_head; + while (p) + { + if (strcmp (p->name, name) == 0) + return; + p = p->next; + } + p = (struct name_list *) permalloc (sizeof *p); + p->next = global_head; + p->name = name; + global_head = p; + + /* Remove this name from ref list if present. */ + last = NULL; + p = extern_head; + while (p) + { + if (strcmp (p->name, name) == 0) + { + if (last) + last->next = p->next; + else + extern_head = p->next; + break; + } + last = p; + p = p->next; + } +} + + +/* Add NAME to list of external symbols. */ + +void +c4x_external_ref (name) + char *name; +{ + struct name_list *p; + + /* Do not insert duplicate names. */ + p = extern_head; + while (p) + { + if (strcmp (p->name, name) == 0) + return; + p = p->next; + } + + /* Do not insert ref if global found. */ + p = global_head; + while (p) + { + if (strcmp (p->name, name) == 0) + return; + p = p->next; + } + p = (struct name_list *) permalloc (sizeof *p); + p->next = extern_head; + p->name = name; + extern_head = p; +} + + +void +c4x_file_end (fp) + FILE *fp; +{ + struct name_list *p; + + /* Output all external names that are not global. */ + p = extern_head; + while (p) + { + fprintf (fp, "\t.ref\t"); + assemble_name (fp, p->name); + fprintf (fp, "\n"); + p = p->next; + } + fprintf (fp, "\t.end\n"); +} + + static void -c4x_check_attribute(attrib, list, decl, attributes) +c4x_check_attribute (attrib, list, decl, attributes) char *attrib; tree list, decl, *attributes; { while (list != NULL_TREE && IDENTIFIER_POINTER (TREE_PURPOSE (list)) != IDENTIFIER_POINTER (DECL_NAME (decl))) - list = TREE_CHAIN(list); + list = TREE_CHAIN (list); if (list) *attributes = chainon (*attributes, build_tree_list (get_identifier (attrib), - TREE_VALUE(list))); + TREE_VALUE (list))); } diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 9de9735..27abc4b 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -2127,8 +2127,6 @@ dtors_section () \ fprintf (FILE, "\n"); \ } -#define ASM_FILE_END(FILE) fprintf (FILE, "\t.end\n") - /* We need to have a data section we can identify so that we can set the DP register back to a data pointer in the small memory model. This is only required for ISRs if we are paranoid that someone @@ -2211,25 +2209,21 @@ do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0); fprintf (FILE, "\t.global\t"); \ assemble_name (FILE, NAME); \ fputs ("\n", FILE); \ + c4x_global_label (NAME); \ } while (0); -#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ - do { \ - fprintf (FILE, "\t.ref\t"); \ - assemble_name (FILE, NAME); \ - fputc ('\n', FILE); \ - } while (0); +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ +c4x_external_ref (NAME) /* A C statement to output on FILE an assembler pseudo-op to declare a library function named external. (Only needed to keep asm30 happy for ___divqf3 etc.) */ -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - do { \ - fprintf (FILE, "\t.ref\t"); \ - assemble_name (FILE, XSTR (FUN, 0)); \ - fprintf (FILE, "\n"); \ - } while (0); +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ +c4x_external_ref (XSTR (FUN, 0)) + +#define ASM_FILE_END(FILE) \ +c4x_file_end (FILE) /* The prefix to add to user-visible assembler symbols. */ |