diff options
author | Antoni Boucher <bouanto@zoho.com> | 2022-04-12 17:17:50 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2022-04-12 17:17:50 -0400 |
commit | 30f7c83e9cfe7c015448d72f63c4c39d14bc6de6 (patch) | |
tree | 9cb2b8d0acf1b0a5e779e85c1cd53ce8d17a270f /gcc/jit/libgccjit.cc | |
parent | af80ea97b61847d91da0d303e85faed437059092 (diff) | |
download | gcc-30f7c83e9cfe7c015448d72f63c4c39d14bc6de6.zip gcc-30f7c83e9cfe7c015448d72f63c4c39d14bc6de6.tar.gz gcc-30f7c83e9cfe7c015448d72f63c4c39d14bc6de6.tar.bz2 |
libgccjit: Add support for bitcasts [PR104071]
gcc/jit/
PR jit/104071
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* docs/topics/compatibility.rst (LIBGCCJIT_ABI_21): New ABI tag.
* docs/topics/expressions.rst: Add documentation for the
function gcc_jit_context_new_bitcast.
* jit-playback.cc: New function (new_bitcast).
* jit-playback.h: New function (new_bitcast).
* jit-recording.cc: New functions (new_bitcast,
bitcast::replay_into, bitcast::visit_children,
bitcast::make_debug_string, bitcast::write_reproducer).
* jit-recording.h: New class (bitcast) and new function
(new_bitcast, bitcast::replay_into, bitcast::visit_children,
bitcast::make_debug_string, bitcast::write_reproducer,
bitcast::get_precedence).
* libgccjit.cc: New function (gcc_jit_context_new_bitcast)
* libgccjit.h: New function (gcc_jit_context_new_bitcast)
* libgccjit.map (LIBGCCJIT_ABI_21): New ABI tag.
gcc/testsuite/
PR jit/104071
* jit.dg/all-non-failing-tests.h: Add new test-bitcast.
* jit.dg/test-bitcast.c: New test.
* jit.dg/test-error-bad-bitcast.c: New test.
* jit.dg/test-error-bad-bitcast2.c: New test.
gcc/
PR jit/104071
* toplev.cc: Call the new function tree_cc_finalize in
toplev::finalize.
* tree.cc: New functions (clear_nonstandard_integer_type_cache
and tree_cc_finalize) to clear the cache of non-standard integer
types to avoid having issues with some optimizations of
bitcast where the SSA_NAME will have a size of a cached
integer type that should have been invalidated, causing a
comparison of integer constant to fail.
* tree.h: New function (tree_cc_finalize).
Diffstat (limited to 'gcc/jit/libgccjit.cc')
-rw-r--r-- | gcc/jit/libgccjit.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc index 44395d7..142f60b 100644 --- a/gcc/jit/libgccjit.cc +++ b/gcc/jit/libgccjit.cc @@ -2436,6 +2436,28 @@ gcc_jit_context_new_cast (gcc_jit_context *ctxt, /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the + gcc::jit::recording::context::new_bitcast method in jit-recording.c. */ + +gcc_jit_rvalue * +gcc_jit_context_new_bitcast (gcc_jit_context *ctxt, + gcc_jit_location *loc, + gcc_jit_rvalue *rvalue, + gcc_jit_type *type) +{ + RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); + JIT_LOG_FUNC (ctxt->get_logger ()); + /* LOC can be NULL. */ + RETURN_NULL_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); + RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); + /* We cannot check if the size of rvalue matches the size of type here, so + we'll do it at playback. */ + + return static_cast <gcc_jit_rvalue *> (ctxt->new_bitcast (loc, rvalue, type)); +} + +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, the real work is done by the gcc::jit::recording::context::new_array_access method in jit-recording.cc. */ |