diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-12-09 15:35:39 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-12-09 15:35:39 +0000 |
commit | 66b6927546f23c9a35bb414552ed96a1ecdcb720 (patch) | |
tree | 9eab3d6e19824a1c4a3da5c613e0e4dfc2d313ad /gcc/jit/libgccjit.h | |
parent | f9e004fe19c8ac9642270ba95559a7cdebe72727 (diff) | |
download | gcc-66b6927546f23c9a35bb414552ed96a1ecdcb720.tar.gz |
PR jit/64166: Add API entrypoint gcc_jit_context_enable_dump
gcc/jit/ChangeLog:
PR jit/64166
* docs/topics/contexts.rst (Debugging): Add description of
gcc_jit_context_enable_dump.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-playback.c: Include context.h.
(class auto_argvec): New class.
(auto_argvec::~auto_argvec): New function.
(gcc::jit::playback::context::compile): Convert fake_args to be
an auto_argvec, so that it can contain dynamically-allocated
strings. Construct a vec of all requested dumps, and pass it to
make_fake_args. Extract requested dumps between the calls to
toplev::main and toplev::finalize.
(gcc::jit::playback::context::make_fake_args): Convert param
"argvec" to be a vec <char *>, and gain a "requested_dumps"
param. Convert to dynamically-allocated arg strings by converting
ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
for args that are already a copy. Add args for all requested dumps.
(gcc::jit::playback::context::extract_any_requested_dumps): New
function.
(gcc::jit::playback::context::read_dump_file): New function.
* jit-playback.h (gcc::jit::playback::context::make_fake_args):
Convert param "argvec" to be a vec <char *>, and gain a
"requested_dumps" param.
(gcc::jit::playback::context::extract_any_requested_dumps): New
function.
(gcc::jit::playback::context::read_dump_file): New function.
* jit-recording.c (gcc::jit::recording::context::enable_dump): New
function.
(gcc::jit::recording::context::get_all_requested_dumps): New
function.
* jit-recording.h (gcc::jit::recording::requested_dump): New
struct.
(gcc::jit::recording::context::enable_dump): New function.
(gcc::jit::recording::context::get_all_requested_dumps): New
function.
(gcc::jit::recording::context::m_requested_dumps): New field.
* libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
* libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
* libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.
gcc/testsuite/ChangeLog:
PR jit/64166
PR jit/64020
* jit.dg/harness.h (CHECK_STRING_CONTAINS): New macro.
(check_string_contains): New function.
* jit.dg/test-error-unrecognized-dump.c: New file.
* jit.dg/test-functions.c (trig_sincos_dump): New variable.
(trig_statistics_dump): New variable.
(create_test_of_builtin_trig): Enable dumping of "sincos" and
"statistics" into "trig_sincos_dump" and "trig_statistics_dump".
(verify_test_of_builtin_trig): Verify the sincos and statistics
dumps.
* jit.dg/test-sum-of-squares.c (dump_vrp1): New variable.
(create_code): Enable dumping of "tree-vrp1" into dump_vrp1.
(verify_code): Verify the tree-vrp1 dump.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jit/libgccjit.h')
-rw-r--r-- | gcc/jit/libgccjit.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index ed6390e6408..71628e03121 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -985,6 +985,40 @@ gcc_jit_block_end_with_void_return (gcc_jit_block *block, extern gcc_jit_context * gcc_jit_context_new_child_context (gcc_jit_context *parent_ctxt); +/********************************************************************** + Implementation support. + **********************************************************************/ + +/* Enable the dumping of a specific set of internal state from the + compilation, capturing the result in-memory as a buffer. + + Parameter "dumpname" corresponds to the equivalent gcc command-line + option, without the "-fdump-" prefix. + For example, to get the equivalent of "-fdump-tree-vrp1", supply + "tree-vrp1". + The context directly stores the dumpname as a (const char *), so the + passed string must outlive the context. + + gcc_jit_context_compile will capture the dump as a + dynamically-allocated buffer, writing it to ``*out_ptr``. + + The caller becomes responsible for calling + free (*out_ptr) + each time that gcc_jit_context_compile is called. *out_ptr will be + written to, either with the address of a buffer, or with NULL if an + error occurred. + + This API entrypoint is likely to be less stable than the others. + In particular, both the precise dumpnames, and the format and content + of the dumps are subject to change. + + It exists primarily for writing the library's own test suite. */ + +extern void +gcc_jit_context_enable_dump (gcc_jit_context *ctxt, + const char *dumpname, + char **out_ptr); + #ifdef __cplusplus } #endif /* __cplusplus */ |