Commit 1c952460 by Richard Sandiford Committed by Richard Sandiford

mips.c (mips16_flip_traits): Use it.

gcc/
	* config/mips/mips.c (mips16_flip_traits): Use it.
	(local_alias_traits, mips16_local_aliases): Convert from a map of
	rtxes to a map of symbol names.
	(mips16_local_alias): Update accordingly.

From-SVN: r224972
parent 20d2c372
2015-06-25 Richard Sandiford <richard.sandiford@arm.com> 2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
* config/mips/mips.c (mips16_flip_traits): Use it.
(local_alias_traits, mips16_local_aliases): Convert from a map of
rtxes to a map of symbol names.
(mips16_local_alias): Update accordingly.
2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
* hash-traits.h (string_hash, nofree_string_hash): New classes. * hash-traits.h (string_hash, nofree_string_hash): New classes.
* genmatch.c (capture_id_map_hasher): Use nofree_string_hash. * genmatch.c (capture_id_map_hasher): Use nofree_string_hash.
* passes.c (pass_registry_hasher): Likewise. * passes.c (pass_registry_hasher): Likewise.
......
...@@ -1263,15 +1263,7 @@ static int mips_register_move_cost (machine_mode, reg_class_t, ...@@ -1263,15 +1263,7 @@ static int mips_register_move_cost (machine_mode, reg_class_t,
static unsigned int mips_function_arg_boundary (machine_mode, const_tree); static unsigned int mips_function_arg_boundary (machine_mode, const_tree);
static machine_mode mips_get_reg_raw_mode (int regno); static machine_mode mips_get_reg_raw_mode (int regno);
struct mips16_flip_traits : default_hashmap_traits struct mips16_flip_traits : simple_hashmap_traits <nofree_string_hash> {};
{
static hashval_t hash (const char *s) { return htab_hash_string (s); }
static bool
equal_keys (const char *a, const char *b)
{
return !strcmp (a, b);
}
};
/* This hash table keeps track of implicit "mips16" and "nomips16" attributes /* This hash table keeps track of implicit "mips16" and "nomips16" attributes
for -mflip_mips16. It maps decl names onto a boolean mode setting. */ for -mflip_mips16. It maps decl names onto a boolean mode setting. */
...@@ -6597,30 +6589,13 @@ mips_load_call_address (enum mips_call_type type, rtx dest, rtx addr) ...@@ -6597,30 +6589,13 @@ mips_load_call_address (enum mips_call_type type, rtx dest, rtx addr)
} }
} }
struct local_alias_traits : default_hashmap_traits struct local_alias_traits : simple_hashmap_traits <nofree_string_hash> {};
{
static hashval_t hash (rtx);
static bool equal_keys (rtx, rtx);
};
/* Each locally-defined hard-float MIPS16 function has a local symbol /* Each locally-defined hard-float MIPS16 function has a local symbol
associated with it. This hash table maps the function symbol (FUNC) associated with it. This hash table maps the function symbol (FUNC)
to the local symbol (LOCAL). */ to the local symbol (LOCAL). */
static GTY (()) hash_map<rtx, rtx, local_alias_traits> *mips16_local_aliases; static GTY (()) hash_map<const char *, rtx, local_alias_traits>
*mips16_local_aliases;
/* Hash table callbacks for mips16_local_aliases. */
hashval_t
local_alias_traits::hash (rtx func)
{
return htab_hash_string (XSTR (func, 0));
}
bool
local_alias_traits::equal_keys (rtx func1, rtx func2)
{
return rtx_equal_p (func1, func2);
}
/* FUNC is the symbol for a locally-defined hard-float MIPS16 function. /* FUNC is the symbol for a locally-defined hard-float MIPS16 function.
Return a local alias for it, creating a new one if necessary. */ Return a local alias for it, creating a new one if necessary. */
...@@ -6631,23 +6606,23 @@ mips16_local_alias (rtx func) ...@@ -6631,23 +6606,23 @@ mips16_local_alias (rtx func)
/* Create the hash table if this is the first call. */ /* Create the hash table if this is the first call. */
if (mips16_local_aliases == NULL) if (mips16_local_aliases == NULL)
mips16_local_aliases mips16_local_aliases
= hash_map<rtx, rtx, local_alias_traits>::create_ggc (37); = hash_map<const char *, rtx, local_alias_traits>::create_ggc (37);
/* Look up the function symbol, creating a new entry if need be. */ /* Look up the function symbol, creating a new entry if need be. */
bool existed; bool existed;
rtx *slot = &mips16_local_aliases->get_or_insert (func, &existed); const char *func_name = XSTR (func, 0);
rtx *slot = &mips16_local_aliases->get_or_insert (func_name, &existed);
gcc_assert (slot != NULL); gcc_assert (slot != NULL);
if (!existed) if (!existed)
{ {
const char *func_name, *local_name;
rtx local; rtx local;
/* Create a new SYMBOL_REF for the local symbol. The choice of /* Create a new SYMBOL_REF for the local symbol. The choice of
__fn_local_* is based on the __fn_stub_* names that we've __fn_local_* is based on the __fn_stub_* names that we've
traditionally used for the non-MIPS16 stub. */ traditionally used for the non-MIPS16 stub. */
func_name = targetm.strip_name_encoding (XSTR (func, 0)); func_name = targetm.strip_name_encoding (XSTR (func, 0));
local_name = ACONCAT (("__fn_local_", func_name, NULL)); const char *local_name = ACONCAT (("__fn_local_", func_name, NULL));
local = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (local_name)); local = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (local_name));
SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL; SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL;
......
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