From 1adaa117728eb44d11776c676448d84b0a5c3111 Mon Sep 17 00:00:00 2001 From: Geoffrey Keating Date: Fri, 10 Sep 2004 18:57:43 +0000 Subject: [PATCH] darwin.c: Include target.h. * config/darwin.c: Include target.h. (struct machopic_indirection): Make ptr_name a string. (machopic_indirection_hash): Update for ptr_name a string. (machopic_indirection_eq): Likewise. (machopic_indirection_name): Likewise. (machopic_output_indirection): Likewise. (machopic_validate_stub_or_non_lazy_ptr): Update for ptr_name a string. Don't expect stub names to be in the identifier hash table. Do call strip_name_encoding before looking up entry in ID hash table. * config/t-darwin (darwin.o): Add target.h to dependencies. From-SVN: r87315 --- gcc/ChangeLog | 11 +++++++ gcc/config/darwin.c | 75 +++++++++++++++++++++++---------------------- gcc/config/t-darwin | 2 +- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e0a2cae8a21..a0178c3414f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2004-09-10 Geoffrey Keating + * config/darwin.c: Include target.h. + (struct machopic_indirection): Make ptr_name a string. + (machopic_indirection_hash): Update for ptr_name a string. + (machopic_indirection_eq): Likewise. + (machopic_indirection_name): Likewise. + (machopic_output_indirection): Likewise. + (machopic_validate_stub_or_non_lazy_ptr): Update for ptr_name a + string. Don't expect stub names to be in the identifier hash table. + Do call strip_name_encoding before looking up entry in ID hash table. + * config/t-darwin (darwin.o): Add target.h to dependencies. + * gcc/config/rs6000/rs6000.c (print_operand): Use fputs instead of fprintf for register names. diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 429bddb8fe5..a5d7ac9b6b2 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "ggc.h" #include "langhooks.h" +#include "target.h" #include "tm_p.h" #include "errors.h" #include "hashtab.h" @@ -245,9 +246,8 @@ typedef struct machopic_indirection GTY (()) { /* The SYMBOL_REF for the entity referenced. */ rtx symbol; - /* The IDENTIFIER_NODE giving the name of the stub or non-lazy - pointer. */ - tree ptr_name; + /* The name of the stub or non-lazy pointer. */ + const char * ptr_name; /* True iff this entry is for a stub (as opposed to a non-lazy pointer). */ bool stub_p; @@ -267,7 +267,7 @@ static hashval_t machopic_indirection_hash (const void *slot) { const machopic_indirection *p = (const machopic_indirection *) slot; - return IDENTIFIER_HASH_VALUE (p->ptr_name); + return htab_hash_string (p->ptr_name); } /* Returns true if the KEY is the same as that associated with @@ -276,7 +276,7 @@ machopic_indirection_hash (const void *slot) static int machopic_indirection_eq (const void *slot, const void *key) { - return ((const machopic_indirection *) slot)->ptr_name == (tree) key; + return strcmp (((const machopic_indirection *) slot)->ptr_name, key) == 0; } /* Return the name of the non-lazy pointer (if STUB_P is false) or @@ -287,9 +287,9 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) { char *buffer; const char *name = XSTR (sym_ref, 0); - int namelen = strlen (name); - tree ptr_name; + size_t namelen = strlen (name); machopic_indirection *p; + void ** slot; /* Construct the name of the non-lazy pointer or stub. */ if (stub_p) @@ -328,32 +328,29 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) user_label_prefix, name); } - /* See if we already have it. */ - ptr_name = maybe_get_identifier (buffer); - /* If not, create a mapping from the non-lazy pointer to the - SYMBOL_REF. */ - if (!ptr_name) + if (!machopic_indirections) + machopic_indirections = htab_create_ggc (37, + machopic_indirection_hash, + machopic_indirection_eq, + /*htab_del=*/NULL); + + slot = htab_find_slot_with_hash (machopic_indirections, buffer, + htab_hash_string (buffer), INSERT); + if (*slot) + { + p = (machopic_indirection *) *slot; + } + else { - void **slot; - ptr_name = get_identifier (buffer); p = (machopic_indirection *) ggc_alloc (sizeof (machopic_indirection)); p->symbol = sym_ref; - p->ptr_name = ptr_name; + p->ptr_name = xstrdup (buffer); p->stub_p = stub_p; - p->used = 0; - if (!machopic_indirections) - machopic_indirections - = htab_create_ggc (37, - machopic_indirection_hash, - machopic_indirection_eq, - /*htab_del=*/NULL); - slot = htab_find_slot_with_hash (machopic_indirections, ptr_name, - IDENTIFIER_HASH_VALUE (ptr_name), - INSERT); - *((machopic_indirection **) slot) = p; + p->used = false; + *slot = p; } - return IDENTIFIER_POINTER (ptr_name); + return p->ptr_name; } /* Return the name of the stub for the mcount function. */ @@ -373,18 +370,24 @@ machopic_mcount_stub_name (void) void machopic_validate_stub_or_non_lazy_ptr (const char *name) { - tree ident = get_identifier (name); - machopic_indirection *p; p = ((machopic_indirection *) - (htab_find_with_hash (machopic_indirections, ident, - IDENTIFIER_HASH_VALUE (ident)))); - if (p) + (htab_find_with_hash (machopic_indirections, name, + htab_hash_string (name)))); + if (p && ! p->used) { - p->used = 1; - mark_referenced (ident); - mark_referenced (get_identifier (XSTR (p->symbol, 0))); + const char *real_name; + tree id; + + p->used = true; + + /* Do exactly what assemble_name will do when we actually call it. */ + real_name = targetm.strip_name_encoding (name); + + id = maybe_get_identifier (real_name); + if (id) + mark_referenced (id); } } @@ -850,7 +853,7 @@ machopic_output_indirection (void **slot, void *data) symbol = p->symbol; sym_name = XSTR (symbol, 0); - ptr_name = IDENTIFIER_POINTER (p->ptr_name); + ptr_name = p->ptr_name; if (p->stub_p) { diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin index f5af52eb2e4..fcc81edd14a 100644 --- a/gcc/config/t-darwin +++ b/gcc/config/t-darwin @@ -1,7 +1,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(REAL_H) insn-config.h \ conditions.h insn-flags.h output.h insn-attr.h flags.h $(TREE_H) expr.h \ - reload.h function.h $(GGC_H) langhooks.h $(TM_P_H) gt-darwin.h + reload.h function.h $(GGC_H) langhooks.h $(TARGET_H) $(TM_P_H) gt-darwin.h $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/darwin.c darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ -- 2.30.2