diff options
Diffstat (limited to 'gcc/jit/dummy-frontend.cc')
-rw-r--r-- | gcc/jit/dummy-frontend.cc | 83 |
1 files changed, 71 insertions, 12 deletions
diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index 3ffca92..0668d67 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -956,13 +956,15 @@ struct GTY(()) lang_identifier /* The resulting tree type. */ +/* See lang_tree_node in gcc/c/c-decl.cc. */ union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), - chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL"))) -lang_tree_node -{ - union tree_node GTY((tag ("0"), - desc ("tree_node_structure (&%h)"))) generic; - struct lang_identifier GTY((tag ("1"))) identifier; + chain_next ("(union lang_tree_node *) jit_tree_chain_next (&%h.generic)"))) + lang_tree_node + { + union tree_node GTY ((tag ("0"), + desc ("tree_node_structure (&%h)"))) + generic; + struct lang_identifier GTY ((tag ("1"))) identifier; }; /* We don't use language_function. */ @@ -1170,6 +1172,9 @@ jit_langhook_type_for_mode (machine_mode mode, int unsignedp) 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); @@ -1190,12 +1195,6 @@ recording::type* tree_type_to_jit_type (tree type) // FIXME: wrong type. return new recording::memento_of_get_type (&target_builtins_ctxt, GCC_JIT_TYPE_VOID); - /* TODO: Remove when we add support for sized floating-point types. */ - for (int i = 0; i < NUM_FLOATN_NX_TYPES; i++) - if (type == FLOATN_NX_TYPE_NODE (i)) - // FIXME: wrong type. - return new recording::memento_of_get_type (&target_builtins_ctxt, - GCC_JIT_TYPE_VOID); if (type == void_type_node) return new recording::memento_of_get_type (&target_builtins_ctxt, GCC_JIT_TYPE_VOID); @@ -1261,6 +1260,26 @@ recording::type* tree_type_to_jit_type (tree type) else if (type == bfloat16_type_node) return new recording::memento_of_get_type (&target_builtins_ctxt, GCC_JIT_TYPE_BFLOAT16); + else if (type == float16_type_node) + { + return new recording::memento_of_get_type (&target_builtins_ctxt, + GCC_JIT_TYPE_FLOAT16); + } + else if (type == float32_type_node) + { + return new recording::memento_of_get_type (&target_builtins_ctxt, + GCC_JIT_TYPE_FLOAT32); + } + else if (type == float64_type_node) + { + return new recording::memento_of_get_type (&target_builtins_ctxt, + GCC_JIT_TYPE_FLOAT64); + } + else if (type == float128_type_node) + { + return new recording::memento_of_get_type (&target_builtins_ctxt, + GCC_JIT_TYPE_FLOAT128); + } else if (type == dfloat128_type_node) // FIXME: wrong type. return new recording::memento_of_get_type (&target_builtins_ctxt, @@ -1282,6 +1301,39 @@ recording::type* tree_type_to_jit_type (tree 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. @@ -1301,6 +1353,13 @@ recording::type* tree_type_to_jit_type (tree type) } } } + + if (ctxt->get_abort_on_unsupported_target_builtin ()) + { + fprintf (stderr, "Unknown type:\n"); + debug_tree (type); + abort (); + } } return NULL; |