diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 9b23b6b8c33f1..dacfe74917606 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1110,6 +1110,8 @@ aarch64_init_simd_builtin_types (void) if (aarch64_simd_types[i].itype == NULL) { + // FIXME: problem happens when we execute this a second time. + // Currently fixed by not initializing builtins more than once in dummy-frontend.cc. tree type = build_vector_type (eltype, GET_MODE_NUNITS (mode)); type = build_distinct_type_copy (type); SET_TYPE_STRUCTURAL_EQUALITY (type); diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index e9e20a08ae878..c5e54fe9dabd8 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -1035,6 +1035,8 @@ jit_end_diagnostic (diagnostic_context *context, gcc::jit::active_playback_ctxt->add_diagnostic (context, *diagnostic); } +static bool builtins_initialized = false; + /* Language hooks. */ static bool @@ -1073,7 +1075,12 @@ jit_langhook_init (void) eventually be controllable by a command line option. */ mpfr_set_default_prec (256); - targetm.init_builtins (); + // TODO: check if this is a good fix. + if (!builtins_initialized) + { + targetm.init_builtins (); + builtins_initialized = true; + } return true; } @@ -1291,6 +1298,39 @@ recording::type* tree_type_to_jit_type (tree type) recording::type* element_type = tree_type_to_jit_type (inner_type); return element_type->get_pointer(); } + else if (type == unsigned_intTI_type_node) + { + // TODO: check if this is the correct type. + return new recording::memento_of_get_type (&target_builtins_ctxt, GCC_JIT_TYPE_UINT128_T); + } + else if (INTEGRAL_TYPE_P (type)) + { + // TODO: check if this is the correct 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)) + { + // TODO: check if this is the correct type. + unsigned int size = tree_to_uhwi (TYPE_SIZE_UNIT (type)); + enum gcc_jit_types type; + switch (size) { + case 2: + type = GCC_JIT_TYPE_FLOAT16; + break; + case 4: + type = GCC_JIT_TYPE_FLOAT32; + break; + case 8: + type = GCC_JIT_TYPE_FLOAT64; + break; + default: + fprintf (stderr, "Unexpected float size: %d\n", size); + abort (); + break; + } + return new recording::memento_of_get_type (&target_builtins_ctxt, type); + } else { // Attempt to find an unqualified type when the current type has qualifiers. @@ -1380,7 +1420,8 @@ jit_langhook_global_bindings_p (void) static tree jit_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED) { - gcc_unreachable (); + /* Do nothing to avoid crashing on some targets. */ + return NULL_TREE; } static tree