Skip to content

Commit 6fc58e0

Browse files
committed
Make compatible_types a public function
1 parent 4c3b8a9 commit 6fc58e0

File tree

3 files changed

+29
-23
lines changed

3 files changed

+29
-23
lines changed

gcc/jit/libgccjit.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ jit_error (gcc::jit::recording::context *ctxt,
356356
gcc::jit::recording::type::accepts_writes_from virtual function on
357357
LTYPE. */
358358

359-
static bool
360-
compatible_types (gcc::jit::recording::type *ltype,
361-
gcc::jit::recording::type *rtype)
359+
bool
360+
gcc_jit_compatible_types (gcc_jit_type *ltype,
361+
gcc_jit_type *rtype)
362362
{
363363
return ltype->accepts_writes_from (rtype);
364364
}
@@ -1461,8 +1461,8 @@ gcc_jit_global_set_initializer_value (gcc_jit_lvalue *global,
14611461
global->get_debug_string ());
14621462

14631463
RETURN_IF_FAIL_PRINTF5 (
1464-
compatible_types (global->get_type (),
1465-
value->get_type ()),
1464+
gcc_jit_compatible_types ((gcc_jit_type*) global->get_type (),
1465+
(gcc_jit_type*) value->get_type ()),
14661466
NULL, NULL,
14671467
"mismatching types for global \"%s\":"
14681468
" assignment to global %s (type: %s) from %s (type: %s)",
@@ -1736,8 +1736,8 @@ gcc_jit_context_new_rvalue_from_struct (gcc_jit_context *ctxt,
17361736
gcc::jit::recording::type *field_type
17371737
= struct_type->get_fields ()->get_field (i)->get_type ();
17381738
RETURN_NULL_IF_FAIL_PRINTF4 (
1739-
compatible_types (field_type,
1740-
fields[i]->get_type ()),
1739+
gcc_jit_compatible_types ((gcc_jit_type*) field_type,
1740+
(gcc_jit_type*) fields[i]->get_type ()),
17411741
ctxt, loc,
17421742
"mismatching type for field[%zi] (expected type: %s): %s (type: %s)",
17431743
i,
@@ -1794,8 +1794,8 @@ gcc_jit_context_new_rvalue_from_array (gcc_jit_context *ctxt,
17941794
RETURN_NULL_IF_FAIL_PRINTF1 (
17951795
elements[i], ctxt, loc, "NULL elements[%zi]", i);
17961796
RETURN_NULL_IF_FAIL_PRINTF4 (
1797-
compatible_types (element_type,
1798-
elements[i]->get_type ()),
1797+
gcc_jit_compatible_types ((gcc_jit_type*) element_type,
1798+
(gcc_jit_type*) elements[i]->get_type ()),
17991799
ctxt, loc,
18001800
"mismatching type for array[%zi] (expected type: %s): %s (type: %s)",
18011801
i,
@@ -1878,7 +1878,7 @@ gcc_jit_context_new_binary_op (gcc_jit_context *ctxt,
18781878
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
18791879
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
18801880
RETURN_NULL_IF_FAIL_PRINTF4 (
1881-
compatible_types (a->get_type (), b->get_type ()),
1881+
gcc_jit_compatible_types ((gcc_jit_type*) a->get_type (), (gcc_jit_type*) b->get_type ()),
18821882
ctxt, loc,
18831883
"mismatching types for binary op:"
18841884
" a: %s (type: %s) b: %s (type: %s)",
@@ -1987,8 +1987,8 @@ gcc_jit_context_new_call (gcc_jit_context *ctxt,
19871987
param->get_type ()->get_debug_string ());
19881988

19891989
RETURN_NULL_IF_FAIL_PRINTF6 (
1990-
compatible_types (param->get_type (),
1991-
arg->get_type ()),
1990+
gcc_jit_compatible_types ((gcc_jit_type*) param->get_type (),
1991+
(gcc_jit_type*) arg->get_type ()),
19921992
ctxt, loc,
19931993
"mismatching types for argument %d of function \"%s\":"
19941994
" assignment to param %s (type: %s) from %s (type: %s)",
@@ -2076,8 +2076,8 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt,
20762076
param_type->get_debug_string ());
20772077

20782078
RETURN_NULL_IF_FAIL_PRINTF6 (
2079-
compatible_types (param_type,
2080-
arg->get_type ()),
2079+
gcc_jit_compatible_types ((gcc_jit_type*) param_type,
2080+
(gcc_jit_type*) arg->get_type ()),
20812081
ctxt, loc,
20822082
"mismatching types for argument %d of fn_ptr: %s:"
20832083
" assignment to param %d (type: %s) from %s (type: %s)",
@@ -2528,8 +2528,8 @@ gcc_jit_block_add_assignment (gcc_jit_block *block,
25282528
RETURN_IF_FAIL (lvalue, ctxt, loc, "NULL lvalue");
25292529
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
25302530
RETURN_IF_FAIL_PRINTF4 (
2531-
compatible_types (lvalue->get_type (),
2532-
rvalue->get_type ()),
2531+
gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
2532+
(gcc_jit_type*) rvalue->get_type ()),
25332533
ctxt, loc,
25342534
"mismatching types:"
25352535
" assignment to %s (type: %s) from %s (type: %s)",
@@ -2574,8 +2574,8 @@ gcc_jit_block_add_assignment_op (gcc_jit_block *block,
25742574
op);
25752575
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
25762576
RETURN_IF_FAIL_PRINTF4 (
2577-
compatible_types (lvalue->get_type (),
2578-
rvalue->get_type ()),
2577+
gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
2578+
(gcc_jit_type*) rvalue->get_type ()),
25792579
ctxt, loc,
25802580
"mismatching types:"
25812581
" assignment to %s (type: %s) involving %s (type: %s)",
@@ -2731,9 +2731,9 @@ gcc_jit_block_end_with_return (gcc_jit_block *block,
27312731
gcc::jit::recording::function *func = block->get_function ();
27322732
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
27332733
RETURN_IF_FAIL_PRINTF4 (
2734-
compatible_types (
2735-
func->get_return_type (),
2736-
rvalue->get_type ()),
2734+
gcc_jit_compatible_types (
2735+
(gcc_jit_type*) func->get_return_type (),
2736+
(gcc_jit_type*) rvalue->get_type ()),
27372737
ctxt, loc,
27382738
"mismatching types:"
27392739
" return of %s (type: %s) in function %s (return type: %s)",
@@ -3731,8 +3731,8 @@ gcc_jit_context_new_rvalue_from_vector (gcc_jit_context *ctxt,
37313731
RETURN_NULL_IF_FAIL_PRINTF1 (
37323732
elements[i], ctxt, loc, "NULL elements[%zi]", i);
37333733
RETURN_NULL_IF_FAIL_PRINTF4 (
3734-
compatible_types (element_type,
3735-
elements[i]->get_type ()),
3734+
gcc_jit_compatible_types ((gcc_jit_type*) element_type,
3735+
(gcc_jit_type*) elements[i]->get_type ()),
37363736
ctxt, loc,
37373737
"mismatching type for element[%zi] (expected type: %s): %s (type: %s)",
37383738
i,

gcc/jit/libgccjit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,11 @@ gcc_jit_type_get_volatile (gcc_jit_type *type);
616616
extern ssize_t
617617
gcc_jit_type_get_size (gcc_jit_type *type);
618618

619+
/* Given types LTYPE and RTYPE, return true if they are compatible. */
620+
extern bool
621+
gcc_jit_compatible_types (gcc_jit_type *ltype,
622+
gcc_jit_type *rtype);
623+
619624
/* Given type "T", get type "T[N]" (for a constant N). */
620625
extern gcc_jit_type *
621626
gcc_jit_context_new_array_type (gcc_jit_context *ctxt,

gcc/jit/libgccjit.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,5 @@ LIBGCCJIT_ABI_21 {
256256
LIBGCCJIT_ABI_22 {
257257
global:
258258
gcc_jit_type_get_size;
259+
gcc_jit_compatible_types;
259260
} LIBGCCJIT_ABI_21;

0 commit comments

Comments
 (0)