Move name_to_pass_map into class pass_manager
gcc/ChangeLog: * pass_manager.h (pass_manager::register_pass_name): New method. (pass_manager::get_pass_by_name): New method. (pass_manager::create_pass_tab): New method. (pass_manager::m_name_to_pass_map): New field. * passes.c (name_to_pass_map): Delete global in favor of field "m_name_to_pass_map" of pass_manager. (register_pass_name): Rename from a function to... (pass_manager::register_pass_name): ...this method, updating for renaming of global "name_to_pass_map" to field "m_name_to_pass_map". (create_pass_tab): Rename from a function to... (pass_manager::create_pass_tab): ...this method, updating for renaming of global "name_to_pass_map" to field. (get_pass_by_name): Rename from a function to... (pass_manager::get_pass_by_name): ...this method. (enable_disable_pass): Convert use of get_pass_by_name to a method call, locating the pass_manager singleton. From-SVN: r235977
This commit is contained in:
parent
66b0fe8f4e
commit
58d4c8364b
|
@ -1,3 +1,23 @@
|
|||
2016-05-06 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* pass_manager.h (pass_manager::register_pass_name): New method.
|
||||
(pass_manager::get_pass_by_name): New method.
|
||||
(pass_manager::create_pass_tab): New method.
|
||||
(pass_manager::m_name_to_pass_map): New field.
|
||||
* passes.c (name_to_pass_map): Delete global in favor of field
|
||||
"m_name_to_pass_map" of pass_manager.
|
||||
(register_pass_name): Rename from a function to...
|
||||
(pass_manager::register_pass_name): ...this method, updating
|
||||
for renaming of global "name_to_pass_map" to field
|
||||
"m_name_to_pass_map".
|
||||
(create_pass_tab): Rename from a function to...
|
||||
(pass_manager::create_pass_tab): ...this method, updating
|
||||
for renaming of global "name_to_pass_map" to field.
|
||||
(get_pass_by_name): Rename from a function to...
|
||||
(pass_manager::get_pass_by_name): ...this method.
|
||||
(enable_disable_pass): Convert use of get_pass_by_name to
|
||||
a method call, locating the pass_manager singleton.
|
||||
|
||||
2016-05-06 David Malcolm <dmalcolm@redhat.com>
|
||||
|
||||
* genattr-common.c (main): Convert argv from
|
||||
|
|
|
@ -78,6 +78,10 @@ public:
|
|||
opt_pass *get_pass_peephole2 () const { return pass_peephole2_1; }
|
||||
opt_pass *get_pass_profile () const { return pass_profile_1; }
|
||||
|
||||
void register_pass_name (opt_pass *pass, const char *name);
|
||||
|
||||
opt_pass *get_pass_by_name (const char *name);
|
||||
|
||||
public:
|
||||
/* The root of the compilation pass tree, once constructed. */
|
||||
opt_pass *all_passes;
|
||||
|
@ -95,9 +99,11 @@ public:
|
|||
private:
|
||||
void set_pass_for_id (int id, opt_pass *pass);
|
||||
void register_dump_files (opt_pass *pass);
|
||||
void create_pass_tab () const;
|
||||
|
||||
private:
|
||||
context *m_ctxt;
|
||||
hash_map<nofree_string_hash, opt_pass *> *m_name_to_pass_map;
|
||||
|
||||
/* References to all of the individual passes.
|
||||
These fields are generated via macro expansion.
|
||||
|
|
34
gcc/passes.c
34
gcc/passes.c
|
@ -66,8 +66,6 @@ using namespace gcc;
|
|||
The variable current_pass is also used for statistics and plugins. */
|
||||
opt_pass *current_pass;
|
||||
|
||||
static void register_pass_name (opt_pass *, const char *);
|
||||
|
||||
/* Most passes are single-instance (within their context) and thus don't
|
||||
need to implement cloning, but passes that support multiple instances
|
||||
*must* provide their own implementation of the clone method.
|
||||
|
@ -844,21 +842,19 @@ pass_manager::register_dump_files (opt_pass *pass)
|
|||
while (pass);
|
||||
}
|
||||
|
||||
static hash_map<nofree_string_hash, opt_pass *> *name_to_pass_map;
|
||||
|
||||
/* Register PASS with NAME. */
|
||||
|
||||
static void
|
||||
register_pass_name (opt_pass *pass, const char *name)
|
||||
void
|
||||
pass_manager::register_pass_name (opt_pass *pass, const char *name)
|
||||
{
|
||||
if (!name_to_pass_map)
|
||||
name_to_pass_map = new hash_map<nofree_string_hash, opt_pass *> (256);
|
||||
if (!m_name_to_pass_map)
|
||||
m_name_to_pass_map = new hash_map<nofree_string_hash, opt_pass *> (256);
|
||||
|
||||
if (name_to_pass_map->get (name))
|
||||
if (m_name_to_pass_map->get (name))
|
||||
return; /* Ignore plugin passes. */
|
||||
|
||||
const char *unique_name = xstrdup (name);
|
||||
name_to_pass_map->put (unique_name, pass);
|
||||
const char *unique_name = xstrdup (name);
|
||||
m_name_to_pass_map->put (unique_name, pass);
|
||||
}
|
||||
|
||||
/* Map from pass id to canonicalized pass name. */
|
||||
|
@ -882,14 +878,14 @@ passes_pass_traverse (const char *const &name, opt_pass *const &pass, void *)
|
|||
/* The function traverses NAME_TO_PASS_MAP and creates a pass info
|
||||
table for dumping purpose. */
|
||||
|
||||
static void
|
||||
create_pass_tab (void)
|
||||
void
|
||||
pass_manager::create_pass_tab (void) const
|
||||
{
|
||||
if (!flag_dump_passes)
|
||||
return;
|
||||
|
||||
pass_tab.safe_grow_cleared (g->get_passes ()->passes_by_id_size + 1);
|
||||
name_to_pass_map->traverse <void *, passes_pass_traverse> (NULL);
|
||||
pass_tab.safe_grow_cleared (passes_by_id_size + 1);
|
||||
m_name_to_pass_map->traverse <void *, passes_pass_traverse> (NULL);
|
||||
}
|
||||
|
||||
static bool override_gate_status (opt_pass *, tree, bool);
|
||||
|
@ -960,10 +956,10 @@ pass_manager::dump_passes () const
|
|||
|
||||
/* Returns the pass with NAME. */
|
||||
|
||||
static opt_pass *
|
||||
get_pass_by_name (const char *name)
|
||||
opt_pass *
|
||||
pass_manager::get_pass_by_name (const char *name)
|
||||
{
|
||||
opt_pass **p = name_to_pass_map->get (name);
|
||||
opt_pass **p = m_name_to_pass_map->get (name);
|
||||
if (p)
|
||||
return *p;
|
||||
|
||||
|
@ -1025,7 +1021,7 @@ enable_disable_pass (const char *arg, bool is_enable)
|
|||
free (argstr);
|
||||
return;
|
||||
}
|
||||
pass = get_pass_by_name (phase_name);
|
||||
pass = g->get_passes ()->get_pass_by_name (phase_name);
|
||||
if (!pass || pass->static_pass_number == -1)
|
||||
{
|
||||
if (is_enable)
|
||||
|
|
Loading…
Reference in New Issue