2004-09-10 Geoffrey Keating <geoffk@apple.com>
+ * 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.
#include "function.h"
#include "ggc.h"
#include "langhooks.h"
+#include "target.h"
#include "tm_p.h"
#include "errors.h"
#include "hashtab.h"
{
/* 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;
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
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
{
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)
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. */
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);
}
}
symbol = p->symbol;
sym_name = XSTR (symbol, 0);
- ptr_name = IDENTIFIER_POINTER (p->ptr_name);
+ ptr_name = p->ptr_name;
if (p->stub_p)
{