#include "tree.h"
#include "print-tree.h"
#include "varasm.h"
+#include "hashtab.h"
+#include "hash-set.h"
+#include "vec.h"
+#include "machmode.h"
+#include "hard-reg-set.h"
+#include "input.h"
#include "function.h"
#include "emit-rtl.h"
+#include "predict.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple.h"
#include "tree-inline.h"
#include "langhooks.h"
-#include "hashtab.h"
+#include "hash-map.h"
+#include "plugin-api.h"
+#include "ipa-ref.h"
#include "cgraph.h"
#include "diagnostic.h"
#include "timevar.h"
#include "ipa-utils.h"
#include "calls.h"
-static const char *ipa_ref_use_name[] = {"read","write","addr","alias"};
+static const char *ipa_ref_use_name[] = {"read","write","addr","alias","chkp"};
const char * const ld_plugin_symbol_resolution_names[]=
{
}
-/* Returns a hash code for P. */
-
-hashval_t
-symbol_table::hash_node_by_assembler_name (const void *p)
-{
- const symtab_node *n = (const symtab_node *) p;
- return (hashval_t) decl_assembler_name_hash (DECL_ASSEMBLER_NAME (n->decl));
-}
-
/* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */
bool
/* Returns nonzero if P1 and P2 are equal. */
-int
-symbol_table::eq_assembler_name (const void *p1, const void *p2)
-{
- const symtab_node *n1 = (const symtab_node *) p1;
- const_tree name = (const_tree)p2;
- return (decl_assembler_name_equal (n1->decl, name));
-}
-
/* Insert NODE to assembler name hash. */
void
&& !node->next_sharing_asm_name);
if (assembler_name_hash)
{
- void **aslot;
+ symtab_node **aslot;
cgraph_node *cnode;
tree decl = node->decl;
tree name = DECL_ASSEMBLER_NAME (node->decl);
- aslot = htab_find_slot_with_hash (assembler_name_hash, name,
- decl_assembler_name_hash (name),
- INSERT);
+ hashval_t hash = decl_assembler_name_hash (name);
+ aslot = assembler_name_hash->find_slot_with_hash (name, hash, INSERT);
gcc_assert (*aslot != node);
node->next_sharing_asm_name = (symtab_node *)*aslot;
if (*aslot != NULL)
- ((symtab_node *)*aslot)->previous_sharing_asm_name = node;
+ (*aslot)->previous_sharing_asm_name = node;
*aslot = node;
/* Update also possible inline clones sharing a decl. */
else
{
tree name = DECL_ASSEMBLER_NAME (node->decl);
- void **slot;
- slot = htab_find_slot_with_hash (assembler_name_hash, name,
- decl_assembler_name_hash (name),
- NO_INSERT);
+ symtab_node **slot;
+ hashval_t hash = decl_assembler_name_hash (name);
+ slot = assembler_name_hash->find_slot_with_hash (name, hash,
+ NO_INSERT);
gcc_assert (*slot == node);
if (!node->next_sharing_asm_name)
- htab_clear_slot (assembler_name_hash, slot);
+ assembler_name_hash->clear_slot (slot);
else
*slot = node->next_sharing_asm_name;
}
symtab_node *node;
if (!assembler_name_hash)
{
- assembler_name_hash =
- htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name,
- NULL);
+ assembler_name_hash = hash_table<asmname_hasher>::create_ggc (10);
FOR_EACH_SYMBOL (node)
insert_to_assembler_name_hash (node, false);
}
/* Hash sections by their names. */
-static hashval_t
-hash_section_hash_entry (const void *p)
+hashval_t
+section_name_hasher::hash (section_hash_entry *n)
{
- const section_hash_entry *n = (const section_hash_entry *) p;
return htab_hash_string (n->name);
}
/* Return true if section P1 name equals to P2. */
-static int
-eq_sections (const void *p1, const void *p2)
+bool
+section_name_hasher::equal (section_hash_entry *n1, const char *name)
{
- const section_hash_entry *n1 = (const section_hash_entry *) p1;
- const char *name = (const char *)p2;
return n1->name == name || !strcmp (n1->name, name);
}
symtab_node::get_for_asmname (const_tree asmname)
{
symtab_node *node;
- void **slot;
symtab->symtab_initialize_asm_name_hash ();
- slot = htab_find_slot_with_hash (symtab->assembler_name_hash, asmname,
- symtab->decl_assembler_name_hash (asmname),
- NO_INSERT);
+ hashval_t hash = symtab->decl_assembler_name_hash (asmname);
+ symtab_node **slot
+ = symtab->assembler_name_hash->find_slot_with_hash (asmname, hash,
+ NO_INSERT);
if (slot)
{
- node = (symtab_node *) *slot;
+ node = *slot;
return node;
}
return NULL;
symtab_node::set_section_for_node (const char *section)
{
const char *current = get_section ();
- void **slot;
+ section_hash_entry **slot;
if (current == section
|| (current && section
x_section->ref_count--;
if (!x_section->ref_count)
{
- slot = htab_find_slot_with_hash (symtab->section_hash, x_section->name,
- htab_hash_string (x_section->name),
- INSERT);
+ hashval_t hash = htab_hash_string (x_section->name);
+ slot = symtab->section_hash->find_slot_with_hash (x_section->name,
+ hash, INSERT);
ggc_free (x_section);
- htab_clear_slot (symtab->section_hash, slot);
+ symtab->section_hash->clear_slot (slot);
}
x_section = NULL;
}
return;
}
if (!symtab->section_hash)
- symtab->section_hash = htab_create_ggc (10, hash_section_hash_entry,
- eq_sections, NULL);
- slot = htab_find_slot_with_hash (symtab->section_hash, section,
- htab_hash_string (section),
- INSERT);
+ symtab->section_hash = hash_table<section_name_hasher>::create_ggc (10);
+ slot = symtab->section_hash->find_slot_with_hash (section,
+ htab_hash_string (section),
+ INSERT);
if (*slot)
x_section = (section_hash_entry *)*slot;
else