* :func:`gcc_jit_target_info_cpu_supports`
* :func:`gcc_jit_target_info_arch`
* :func:`gcc_jit_target_info_supports_target_dependent_type`
+
+.. _LIBGCCJIT_ABI_36:
+
+``LIBGCCJIT_ABI_36``
+--------------------
+``LIBGCCJIT_ABI_36`` covers the addition of
+
+ * :func:`gcc_jit_context_set_abort_on_unsupported_target_builtin`
#ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_bool_print_errors_to_stderr
+.. function:: void \
+ gcc_jit_context_set_abort_on_unsupported_target_builtin (gcc_jit_context *ctxt)
+
+ By default, libgccjit will silently ignore when a target builtin has an
+ unsupported type.
+
+ This entrypoint can be used to make it abort when the specified context
+ encounters such a target builtin.
+
+ This entrypoint was added in :ref:`LIBGCCJIT_ABI_36`; you can test for
+ its presence using
+
+ .. code-block:: c
+
+ #ifdef LIBGCCJIT_HAVE_gcc_jit_context_set_abort_on_unsupported_target_builtin
+
Integer options
***************
recording::type* tree_type_to_jit_type (tree type)
{
+ gcc_assert (gcc::jit::active_playback_ctxt);
+ gcc::jit::playback::context* ctxt = gcc::jit::active_playback_ctxt;
+
if (TREE_CODE (type) == VECTOR_TYPE)
{
tree inner_type = TREE_TYPE (type);
return nullptr;
return element_type->get_pointer ();
}
+ else if (type == unsigned_intTI_type_node)
+ return new recording::memento_of_get_type (&target_builtins_ctxt,
+ GCC_JIT_TYPE_UINT128_T);
+ else if (INTEGRAL_TYPE_P (type))
+ {
+ unsigned int size = tree_to_uhwi (TYPE_SIZE_UNIT (type));
+ return target_builtins_ctxt.get_int_type (size, TYPE_UNSIGNED (type));
+ }
+ else if (SCALAR_FLOAT_TYPE_P (type))
+ {
+ unsigned int size = tree_to_uhwi (TYPE_SIZE_UNIT (type));
+ enum gcc_jit_types type;
+ switch (size)
+ {
+ case 2:
+ type = GCC_JIT_TYPE_BFLOAT16;
+ break;
+ case 4:
+ type = GCC_JIT_TYPE_FLOAT;
+ break;
+ case 8:
+ type = GCC_JIT_TYPE_DOUBLE;
+ break;
+ default:
+ if (ctxt->get_abort_on_unsupported_target_builtin ())
+ {
+ fprintf (stderr, "Unexpected float size: %d\n", size);
+ abort ();
+ }
+ return NULL;
+ }
+ return new recording::memento_of_get_type (&target_builtins_ctxt, type);
+ }
else
{
// Attempt to find an unqualified type when the current type has qualifiers.
}
}
}
+
+ if (ctxt->get_abort_on_unsupported_target_builtin ())
+ {
+ fprintf (stderr, "Unknown type:\n");
+ debug_tree (type);
+ abort ();
+ }
}
return NULL;
return info;
}
+ bool get_abort_on_unsupported_target_builtin () const
+ {
+ return m_recording_ctxt->get_abort_on_unsupported_target_builtin ();
+ }
+
private:
void dump_generated_code ();
record (memento);
}
+bool
+recording::context::get_abort_on_unsupported_target_builtin ()
+{
+ return m_abort_on_unsupported_target_builtin;
+}
+
+void
+recording::context::set_abort_on_unsupported_target_builtin ()
+{
+ m_abort_on_unsupported_target_builtin = true;
+}
+
/* Set the given integer option for this context, or add an error if
it's not recognized.
void
set_output_ident (const char *output_ident);
+ bool
+ get_abort_on_unsupported_target_builtin ();
+
+ void
+ set_abort_on_unsupported_target_builtin ();
+
void
set_int_option (enum gcc_jit_int_option opt,
int value);
type *m_FILE_type;
bool m_populated_target_info = false;
+ bool m_abort_on_unsupported_target_builtin = false;
builtins_manager *m_builtins_manager; // lazily created
!= info->m_supported_target_dependent_types.end ();
}
+void
+gcc_jit_context_set_abort_on_unsupported_target_builtin (gcc_jit_context *ctxt)
+{
+ RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+
+ ctxt->set_abort_on_unsupported_target_builtin ();
+}
+
/* Public entrypoint. See description in libgccjit.h.
After error-checking, the real work is done by the
# LIBGCCJIT_ABI_30
_gcc_jit_context_convert_vector
-# LIBGCCJIT_ABI_31
+# LIBGCCJIT_ABI_31
_gcc_jit_context_new_vector_access
_gcc_jit_context_new_rvalue_vector_perm
-# LIBGCCJIT_ABI_32
+# LIBGCCJIT_ABI_32
_gcc_jit_context_get_target_builtin_function
-# LIBGCCJIT_ABI_33
+# LIBGCCJIT_ABI_33
_gcc_jit_function_new_temp
-# LIBGCCJIT_ABI_34
+# LIBGCCJIT_ABI_34
_gcc_jit_context_set_output_ident
+# LIBGCCJIT_ABI_35
+_gcc_jit_context_get_target_info
+_gcc_jit_target_info_release
+_gcc_jit_target_info_cpu_supports
+_gcc_jit_target_info_arch
+_gcc_jit_target_info_supports_target_dependent_type
+
+# LIBGCCJIT_ABI_36
+_gcc_jit_context_set_abort_on_unsupported_target_builtin
#define LIBGCCJIT_HAVE_gcc_jit_context_set_output_ident
+extern void
+gcc_jit_context_set_abort_on_unsupported_target_builtin (gcc_jit_context *ctxt);
+
+#define LIBGCCJIT_HAVE_gcc_jit_context_set_abort_on_unsupported_target_builtin
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
gcc_jit_target_info_arch;
gcc_jit_target_info_supports_target_dependent_type;
} LIBGCCJIT_ABI_34;
+
+LIBGCCJIT_ABI_36 {
+ global:
+ gcc_jit_context_set_abort_on_unsupported_target_builtin;
+} LIBGCCJIT_ABI_35;