summaryrefslogtreecommitdiff
path: root/gcc/config/darwin.c
diff options
context:
space:
mode:
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 18:57:43 +0000
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-10 18:57:43 +0000
commit6d3abfc06cb03bc352754f433ba3e45c555bb58a (patch)
treee7172fb12d00176512719fc8e4db24e91cdfa78e /gcc/config/darwin.c
parent3fcf06a53bca6b6f368319c998fb6471055fac81 (diff)
downloadgcc-6d3abfc06cb03bc352754f433ba3e45c555bb58a.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/darwin.c')
-rw-r--r--gcc/config/darwin.c75
1 files changed, 39 insertions, 36 deletions
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)
{