aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.cc
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2022-04-12 17:17:50 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2022-04-12 17:17:50 -0400
commit30f7c83e9cfe7c015448d72f63c4c39d14bc6de6 (patch)
tree9cb2b8d0acf1b0a5e779e85c1cd53ce8d17a270f /gcc/tree.cc
parentaf80ea97b61847d91da0d303e85faed437059092 (diff)
downloadgcc-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/tree.cc')
-rw-r--r--gcc/tree.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 609f0b4..4f99757 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -6985,6 +6985,15 @@ build_reference_type (tree to_type)
(HOST_BITS_PER_WIDE_INT > 64 ? HOST_BITS_PER_WIDE_INT : 64)
static GTY(()) tree nonstandard_integer_type_cache[2 * MAX_INT_CACHED_PREC + 2];
+static void
+clear_nonstandard_integer_type_cache (void)
+{
+ for (size_t i = 0 ; i < 2 * MAX_INT_CACHED_PREC + 2 ; i++)
+ {
+ nonstandard_integer_type_cache[i] = NULL;
+ }
+}
+
/* Builds a signed or unsigned integer type of precision PRECISION.
Used for C bitfields whose precision does not match that of
built-in target types. */
@@ -14675,6 +14684,12 @@ get_target_clone_attr_len (tree arglist)
return str_len_sum;
}
+void
+tree_cc_finalize (void)
+{
+ clear_nonstandard_integer_type_cache ();
+}
+
#if CHECKING_P
namespace selftest {