Commit 1adaa117 by Geoffrey Keating Committed by Geoffrey Keating

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
parent fb5c67a7
2004-09-10 Geoffrey Keating <geoffk@apple.com> 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 * gcc/config/rs6000/rs6000.c (print_operand): Use fputs instead
of fprintf for register names. of fprintf for register names.
......
...@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA. */
#include "function.h" #include "function.h"
#include "ggc.h" #include "ggc.h"
#include "langhooks.h" #include "langhooks.h"
#include "target.h"
#include "tm_p.h" #include "tm_p.h"
#include "errors.h" #include "errors.h"
#include "hashtab.h" #include "hashtab.h"
...@@ -245,9 +246,8 @@ typedef struct machopic_indirection GTY (()) ...@@ -245,9 +246,8 @@ typedef struct machopic_indirection GTY (())
{ {
/* The SYMBOL_REF for the entity referenced. */ /* The SYMBOL_REF for the entity referenced. */
rtx symbol; rtx symbol;
/* The IDENTIFIER_NODE giving the name of the stub or non-lazy /* The name of the stub or non-lazy pointer. */
pointer. */ const char * ptr_name;
tree ptr_name;
/* True iff this entry is for a stub (as opposed to a non-lazy /* True iff this entry is for a stub (as opposed to a non-lazy
pointer). */ pointer). */
bool stub_p; bool stub_p;
...@@ -267,7 +267,7 @@ static hashval_t ...@@ -267,7 +267,7 @@ static hashval_t
machopic_indirection_hash (const void *slot) machopic_indirection_hash (const void *slot)
{ {
const machopic_indirection *p = (const machopic_indirection *) 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 /* Returns true if the KEY is the same as that associated with
...@@ -276,7 +276,7 @@ machopic_indirection_hash (const void *slot) ...@@ -276,7 +276,7 @@ machopic_indirection_hash (const void *slot)
static int static int
machopic_indirection_eq (const void *slot, const void *key) 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 /* 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) ...@@ -287,9 +287,9 @@ machopic_indirection_name (rtx sym_ref, bool stub_p)
{ {
char *buffer; char *buffer;
const char *name = XSTR (sym_ref, 0); const char *name = XSTR (sym_ref, 0);
int namelen = strlen (name); size_t namelen = strlen (name);
tree ptr_name;
machopic_indirection *p; machopic_indirection *p;
void ** slot;
/* Construct the name of the non-lazy pointer or stub. */ /* Construct the name of the non-lazy pointer or stub. */
if (stub_p) if (stub_p)
...@@ -328,32 +328,29 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) ...@@ -328,32 +328,29 @@ machopic_indirection_name (rtx sym_ref, bool stub_p)
user_label_prefix, name); user_label_prefix, name);
} }
/* See if we already have it. */ if (!machopic_indirections)
ptr_name = maybe_get_identifier (buffer); machopic_indirections = htab_create_ggc (37,
/* If not, create a mapping from the non-lazy pointer to the machopic_indirection_hash,
SYMBOL_REF. */ machopic_indirection_eq,
if (!ptr_name) /*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 = (machopic_indirection *) ggc_alloc (sizeof (machopic_indirection));
p->symbol = sym_ref; p->symbol = sym_ref;
p->ptr_name = ptr_name; p->ptr_name = xstrdup (buffer);
p->stub_p = stub_p; p->stub_p = stub_p;
p->used = 0; p->used = false;
if (!machopic_indirections) *slot = p;
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;
} }
return IDENTIFIER_POINTER (ptr_name); return p->ptr_name;
} }
/* Return the name of the stub for the mcount function. */ /* Return the name of the stub for the mcount function. */
...@@ -373,18 +370,24 @@ machopic_mcount_stub_name (void) ...@@ -373,18 +370,24 @@ machopic_mcount_stub_name (void)
void void
machopic_validate_stub_or_non_lazy_ptr (const char *name) machopic_validate_stub_or_non_lazy_ptr (const char *name)
{ {
tree ident = get_identifier (name);
machopic_indirection *p; machopic_indirection *p;
p = ((machopic_indirection *) p = ((machopic_indirection *)
(htab_find_with_hash (machopic_indirections, ident, (htab_find_with_hash (machopic_indirections, name,
IDENTIFIER_HASH_VALUE (ident)))); htab_hash_string (name))));
if (p) if (p && ! p->used)
{ {
p->used = 1; const char *real_name;
mark_referenced (ident); tree id;
mark_referenced (get_identifier (XSTR (p->symbol, 0)));
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) ...@@ -850,7 +853,7 @@ machopic_output_indirection (void **slot, void *data)
symbol = p->symbol; symbol = p->symbol;
sym_name = XSTR (symbol, 0); sym_name = XSTR (symbol, 0);
ptr_name = IDENTIFIER_POINTER (p->ptr_name); ptr_name = p->ptr_name;
if (p->stub_p) if (p->stub_p)
{ {
......
darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ 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 \ $(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 \ 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 $(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 \ darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment