diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc index ded67fdd58377..d4c1073d31553 100644 --- a/gcc/jit/libgccjit.cc +++ b/gcc/jit/libgccjit.cc @@ -699,6 +699,20 @@ gcc_jit_vector_type_get_num_units (gcc_jit_vector_type *vector_type) return vector_type->get_num_units (); } +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, this calls the trivial + gcc::jit::recording::memento::as_object method (a type is a + memento), in jit-recording.h. */ + +gcc_jit_object * +gcc_jit_vector_type_as_object (gcc_jit_vector_type *vector_type) +{ + RETURN_NULL_IF_FAIL (vector_type, NULL, NULL, "NULL vector_type"); + + return static_cast (vector_type->as_object ()); +} + /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the @@ -824,6 +838,20 @@ gcc_jit_function_type_get_param_type (gcc_jit_function_type *function_type, return (gcc_jit_type *)function_type->get_param_types ()[index]; } +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, this calls the trivial + gcc::jit::recording::memento::as_object method (a type is a + memento), in jit-recording.h. */ + +gcc_jit_object * +gcc_jit_function_type_as_object (gcc_jit_function_type *function_type) +{ + RETURN_NULL_IF_FAIL (function_type, NULL, NULL, "NULL function_type"); + + return static_cast (function_type->as_object ()); +} + /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the @@ -3229,6 +3257,20 @@ gcc_jit_region_add_block (gcc_jit_region *region, gcc_jit_block *block) region->add_block (block); } +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, this calls the trivial + gcc::jit::recording::memento::as_object method (a region is a + memento), in jit-recording.h. */ + +gcc_jit_object * +gcc_jit_region_as_object (gcc_jit_region *region) +{ + RETURN_NULL_IF_FAIL (region, NULL, NULL, "NULL region"); + + return static_cast (region->as_object ()); +} + /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index 404b3bd28807e..88bbff7373870 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -1610,6 +1610,14 @@ extern void gcc_jit_region_add_block (gcc_jit_region *region, gcc_jit_block *block); +/* Upcasting from gcc_jit_region to object. + + This API entrypoint was added in LIBGCCJIT_ABI_55. +*/ + +extern gcc_jit_object * +gcc_jit_region_as_object (gcc_jit_region *region); + #define LIBGCCJIT_HAVE_REGION /* Clone blocks into out_clones. @@ -2248,6 +2256,14 @@ extern gcc_jit_type * gcc_jit_function_type_get_param_type (gcc_jit_function_type *function_type, size_t index); +/* Upcasting from gcc_jit_function_type to object. + + This API entrypoint was added in LIBGCCJIT_ABI_55. +*/ + +extern gcc_jit_object * +gcc_jit_function_type_as_object (gcc_jit_function_type *function_type); + /* Return non-zero if the type is an integral. */ extern int gcc_jit_type_is_integral (gcc_jit_type *type); @@ -2279,6 +2295,14 @@ gcc_jit_vector_type_get_num_units (gcc_jit_vector_type *vector_type); extern gcc_jit_type * gcc_jit_vector_type_get_element_type (gcc_jit_vector_type *vector_type); +/* Upcasting from gcc_jit_vector_type to object. + + This API entrypoint was added in LIBGCCJIT_ABI_55. +*/ + +extern gcc_jit_object * +gcc_jit_vector_type_as_object (gcc_jit_vector_type *vector_type); + /* Given a type, return the unqualified type, removing "const", "volatile" * and alignment qualifiers. */ extern gcc_jit_type * diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map index ae383d92b8a5a..847de3ae499e6 100644 --- a/gcc/jit/libgccjit.map +++ b/gcc/jit/libgccjit.map @@ -445,4 +445,7 @@ LIBGCCJIT_ABI_55 { global: gcc_jit_block_get_successor_count; gcc_jit_block_get_successor; + gcc_jit_function_type_as_object; + gcc_jit_vector_type_as_object; + gcc_jit_region_as_object; } LIBGCCJIT_ABI_54;