diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-12-09 15:25:11 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-12-09 15:25:11 +0000 |
commit | 799505ae0c8aa82a1557b882b495b303f24e3be3 (patch) | |
tree | 75873bc57a5cbae6acc0aaa790e968676b78c423 /gcc | |
parent | 0cc67c94cf105774d67b6b647c044073d3f497d9 (diff) | |
download | gcc-799505ae0c8aa82a1557b882b495b303f24e3be3.zip gcc-799505ae0c8aa82a1557b882b495b303f24e3be3.tar.gz gcc-799505ae0c8aa82a1557b882b495b303f24e3be3.tar.bz2 |
PR jit/64166: Add methods to gcc::dump_manager needed by JIT testing
gcc/ChangeLog:
PR jit/64166
* dumpfile.c (gcc::dump_manager::get_dump_file_info_by_switch):
New function.
(gcc::dump_manager::get_dump_file_name): Split out bulk of
implementation into a new overloaded variant taking a
dump_file_info *.
* dumpfile.h (gcc::dump_manager::get_dump_file_info_by_switch):
New function.
(gcc::dump_manager::get_dump_file_name): New overloaded variant of
this function, taking a dump_file_info *.
From-SVN: r218520
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/dumpfile.c | 35 | ||||
-rw-r--r-- | gcc/dumpfile.h | 6 |
3 files changed, 53 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c38a072..eb1878f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2014-12-09 David Malcolm <dmalcolm@redhat.com> + + PR jit/64166 + * dumpfile.c (gcc::dump_manager::get_dump_file_info_by_switch): + New function. + (gcc::dump_manager::get_dump_file_name): Split out bulk of + implementation into a new overloaded variant taking a + dump_file_info *. + * dumpfile.h (gcc::dump_manager::get_dump_file_info_by_switch): + New function. + (gcc::dump_manager::get_dump_file_name): New overloaded variant of + this function, taking a dump_file_info *. + 2014-12-09 Uros Bizjak <ubizjak@gmail.com> PR bootstrap/64213 diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index c2cd89b..eb178fe 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -217,21 +217,54 @@ get_dump_file_info (int phase) const return m_extra_dump_files + (phase - TDI_end); } +/* Locate the dump_file_info with swtch equal to SWTCH, + or return NULL if no such dump_file_info exists. */ + +struct dump_file_info * +gcc::dump_manager:: +get_dump_file_info_by_switch (const char *swtch) const +{ + for (unsigned i = 0; i < m_extra_dump_files_in_use; i++) + if (0 == strcmp (m_extra_dump_files[i].swtch, swtch)) + return &m_extra_dump_files[i]; + + /* Not found. */ + return NULL; +} + /* Return the name of the dump file for the given phase. + The caller is responsible for calling free on the returned + buffer. If the dump is not enabled, returns NULL. */ char * gcc::dump_manager:: get_dump_file_name (int phase) const { - char dump_id[10]; struct dump_file_info *dfi; if (phase == TDI_none) return NULL; dfi = get_dump_file_info (phase); + + return get_dump_file_name (dfi); +} + +/* Return the name of the dump file for the given dump_file_info. + The caller is responsible for calling free on the returned + buffer. + If the dump is not enabled, returns NULL. */ + +char * +gcc::dump_manager:: +get_dump_file_name (struct dump_file_info *dfi) const +{ + char dump_id[10]; + + gcc_assert (dfi); + if (dfi->pstate == 0) return NULL; diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index d650174..93aea67f 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -182,11 +182,17 @@ public: struct dump_file_info * get_dump_file_info (int phase) const; + struct dump_file_info * + get_dump_file_info_by_switch (const char *swtch) const; + /* Return the name of the dump file for the given phase. If the dump is not enabled, returns NULL. */ char * get_dump_file_name (int phase) const; + char * + get_dump_file_name (struct dump_file_info *dfi) const; + int dump_switch_p (const char *arg); |