Skip to content

Commit 13789ac

Browse files
committed
Make compatible_types a public function
1 parent 014202a commit 13789ac

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

gcc/jit/libgccjit.c

+17-17
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ jit_error (gcc::jit::recording::context *ctxt,
345345
gcc::jit::recording::type::accepts_writes_from virtual function on
346346
LTYPE. */
347347

348-
static bool
349-
compatible_types (gcc::jit::recording::type *ltype,
350-
gcc::jit::recording::type *rtype)
348+
bool
349+
gcc_jit_compatible_types (gcc_jit_type *ltype,
350+
gcc_jit_type *rtype)
351351
{
352352
return ltype->accepts_writes_from (rtype);
353353
}
@@ -2119,7 +2119,7 @@ gcc_jit_context_new_binary_op (gcc_jit_context *ctxt,
21192119
RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a");
21202120
RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b");
21212121
RETURN_NULL_IF_FAIL_PRINTF4 (
2122-
a->get_type ()->unqualified () == b->get_type ()->unqualified (),
2122+
gcc_jit_compatible_types ((gcc_jit_type*) a->get_type (), (gcc_jit_type*) b->get_type ()),
21232123
ctxt, loc,
21242124
"mismatching types for binary op:"
21252125
" a: %s (type: %s) b: %s (type: %s)",
@@ -2228,8 +2228,8 @@ gcc_jit_context_new_call (gcc_jit_context *ctxt,
22282228
param->get_type ()->get_debug_string ());
22292229

22302230
RETURN_NULL_IF_FAIL_PRINTF6 (
2231-
compatible_types (param->get_type (),
2232-
arg->get_type ()),
2231+
gcc_jit_compatible_types ((gcc_jit_type*) param->get_type (),
2232+
(gcc_jit_type*) arg->get_type ()),
22332233
ctxt, loc,
22342234
"mismatching types for argument %d of function \"%s\":"
22352235
" assignment to param %s (type: %s) from %s (type: %s)",
@@ -2317,8 +2317,8 @@ gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt,
23172317
param_type->get_debug_string ());
23182318

23192319
RETURN_NULL_IF_FAIL_PRINTF6 (
2320-
compatible_types (param_type,
2321-
arg->get_type ()),
2320+
gcc_jit_compatible_types ((gcc_jit_type*) param_type,
2321+
(gcc_jit_type*) arg->get_type ()),
23222322
ctxt, loc,
23232323
"mismatching types for argument %d of fn_ptr: %s:"
23242324
" assignment to param %d (type: %s) from %s (type: %s)",
@@ -2770,8 +2770,8 @@ gcc_jit_block_add_assignment (gcc_jit_block *block,
27702770
RETURN_IF_FAIL (lvalue, ctxt, loc, "NULL lvalue");
27712771
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
27722772
RETURN_IF_FAIL_PRINTF4 (
2773-
compatible_types (lvalue->get_type (),
2774-
rvalue->get_type ()),
2773+
gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
2774+
(gcc_jit_type*) rvalue->get_type ()),
27752775
ctxt, loc,
27762776
"mismatching types:"
27772777
" assignment to %s (type: %s) from %s (type: %s)",
@@ -2816,8 +2816,8 @@ gcc_jit_block_add_assignment_op (gcc_jit_block *block,
28162816
op);
28172817
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
28182818
RETURN_IF_FAIL_PRINTF4 (
2819-
compatible_types (lvalue->get_type (),
2820-
rvalue->get_type ()),
2819+
gcc_jit_compatible_types ((gcc_jit_type*) lvalue->get_type (),
2820+
(gcc_jit_type*) rvalue->get_type ()),
28212821
ctxt, loc,
28222822
"mismatching types:"
28232823
" assignment to %s (type: %s) involving %s (type: %s)",
@@ -2973,9 +2973,9 @@ gcc_jit_block_end_with_return (gcc_jit_block *block,
29732973
gcc::jit::recording::function *func = block->get_function ();
29742974
RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue");
29752975
RETURN_IF_FAIL_PRINTF4 (
2976-
compatible_types (
2977-
func->get_return_type (),
2978-
rvalue->get_type ()),
2976+
gcc_jit_compatible_types (
2977+
(gcc_jit_type*) func->get_return_type (),
2978+
(gcc_jit_type*) rvalue->get_type ()),
29792979
ctxt, loc,
29802980
"mismatching types:"
29812981
" return of %s (type: %s) in function %s (return type: %s)",
@@ -3973,8 +3973,8 @@ gcc_jit_context_new_rvalue_from_vector (gcc_jit_context *ctxt,
39733973
RETURN_NULL_IF_FAIL_PRINTF1 (
39743974
elements[i], ctxt, loc, "NULL elements[%zi]", i);
39753975
RETURN_NULL_IF_FAIL_PRINTF4 (
3976-
compatible_types (element_type,
3977-
elements[i]->get_type ()),
3976+
gcc_jit_compatible_types ((gcc_jit_type*) element_type,
3977+
(gcc_jit_type*) elements[i]->get_type ()),
39783978
ctxt, loc,
39793979
"mismatching type for element[%zi] (expected type: %s): %s (type: %s)",
39803980
i,

gcc/jit/libgccjit.h

+5
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,11 @@ gcc_jit_type_get_const (gcc_jit_type *type);
615615
extern gcc_jit_type *
616616
gcc_jit_type_get_volatile (gcc_jit_type *type);
617617

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

gcc/jit/libgccjit.map

+5
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,8 @@ LIBGCCJIT_ABI_21 {
254254
global:
255255
gcc_jit_lvalue_set_register_name;
256256
} LIBGCCJIT_ABI_20;
257+
258+
LIBGCCJIT_ABI_22 {
259+
global:
260+
gcc_jit_compatible_types;
261+
} LIBGCCJIT_ABI_21;

0 commit comments

Comments
 (0)