Mercurial > hg > CbC > CbC_gcc
comparison gcc/jit/jit-recording.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* Internals of libgccjit: classes for recording calls made to the JIT API. | 1 /* Internals of libgccjit: classes for recording calls made to the JIT API. |
2 Copyright (C) 2013-2017 Free Software Foundation, Inc. | 2 Copyright (C) 2013-2018 Free Software Foundation, Inc. |
3 Contributed by David Malcolm <dmalcolm@redhat.com>. | 3 Contributed by David Malcolm <dmalcolm@redhat.com>. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify it | 7 GCC is free software; you can redistribute it and/or modify it |
2985 recording::compound_type::set_fields (location *loc, | 2985 recording::compound_type::set_fields (location *loc, |
2986 int num_fields, | 2986 int num_fields, |
2987 field **field_array) | 2987 field **field_array) |
2988 { | 2988 { |
2989 m_loc = loc; | 2989 m_loc = loc; |
2990 gcc_assert (NULL == m_fields); | 2990 gcc_assert (m_fields == NULL); |
2991 | 2991 |
2992 m_fields = new fields (this, num_fields, field_array); | 2992 m_fields = new fields (this, num_fields, field_array); |
2993 m_ctxt->record (m_fields); | 2993 m_ctxt->record (m_fields); |
2994 } | 2994 } |
2995 | 2995 |
3180 | 3180 |
3181 void | 3181 void |
3182 recording::fields::write_reproducer (reproducer &r) | 3182 recording::fields::write_reproducer (reproducer &r) |
3183 { | 3183 { |
3184 if (m_struct_or_union) | 3184 if (m_struct_or_union) |
3185 if (NULL == m_struct_or_union->dyn_cast_struct ()) | 3185 if (m_struct_or_union->dyn_cast_struct () == NULL) |
3186 /* We have a union; the fields have already been written by | 3186 /* We have a union; the fields have already been written by |
3187 union::write_reproducer. */ | 3187 union::write_reproducer. */ |
3188 return; | 3188 return; |
3189 | 3189 |
3190 const char *fields_id = r.make_identifier (this, "fields"); | 3190 const char *fields_id = r.make_identifier (this, "fields"); |
3368 | 3368 |
3369 void | 3369 void |
3370 recording::rvalue::set_scope (function *scope) | 3370 recording::rvalue::set_scope (function *scope) |
3371 { | 3371 { |
3372 gcc_assert (scope); | 3372 gcc_assert (scope); |
3373 gcc_assert (NULL == m_scope); | 3373 gcc_assert (m_scope == NULL); |
3374 m_scope = scope; | 3374 m_scope = scope; |
3375 } | 3375 } |
3376 | 3376 |
3377 | 3377 |
3378 /* Implementation of recording::rvalue::access_as_rvalue for rvalues | 3378 /* Implementation of recording::rvalue::access_as_rvalue for rvalues |
3748 recording::function::validate () | 3748 recording::function::validate () |
3749 { | 3749 { |
3750 /* Complain about empty functions with non-void return type. */ | 3750 /* Complain about empty functions with non-void return type. */ |
3751 if (m_kind != GCC_JIT_FUNCTION_IMPORTED | 3751 if (m_kind != GCC_JIT_FUNCTION_IMPORTED |
3752 && m_return_type != m_ctxt->get_type (GCC_JIT_TYPE_VOID)) | 3752 && m_return_type != m_ctxt->get_type (GCC_JIT_TYPE_VOID)) |
3753 if (0 == m_blocks.length ()) | 3753 if (m_blocks.length () == 0) |
3754 m_ctxt->add_error (m_loc, | 3754 m_ctxt->add_error (m_loc, |
3755 "function %s returns non-void (type: %s)" | 3755 "function %s returns non-void (type: %s)" |
3756 " but has no blocks", | 3756 " but has no blocks", |
3757 get_debug_string (), | 3757 get_debug_string (), |
3758 m_return_type->get_debug_string ()); | 3758 m_return_type->get_debug_string ()); |
3769 } | 3769 } |
3770 | 3770 |
3771 /* Check that all blocks are reachable. */ | 3771 /* Check that all blocks are reachable. */ |
3772 if (!m_ctxt->get_inner_bool_option | 3772 if (!m_ctxt->get_inner_bool_option |
3773 (INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS) | 3773 (INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS) |
3774 && m_blocks.length () > 0 && 0 == num_invalid_blocks) | 3774 && m_blocks.length () > 0 && num_invalid_blocks == 0) |
3775 { | 3775 { |
3776 /* Iteratively walk the graph of blocks, marking their "m_is_reachable" | 3776 /* Iteratively walk the graph of blocks, marking their "m_is_reachable" |
3777 flag, starting at the initial block. */ | 3777 flag, starting at the initial block. */ |
3778 auto_vec<block *> worklist (m_blocks.length ()); | 3778 auto_vec<block *> worklist (m_blocks.length ()); |
3779 worklist.safe_push (m_blocks[0]); | 3779 worklist.safe_push (m_blocks[0]); |
4485 " %s, /* gcc_jit_type *numeric_type */\n" | 4485 " %s, /* gcc_jit_type *numeric_type */\n" |
4486 " %ldL - 1); /* long value */\n", | 4486 " %ldL - 1); /* long value */\n", |
4487 id, | 4487 id, |
4488 r.get_identifier (get_context ()), | 4488 r.get_identifier (get_context ()), |
4489 r.get_identifier_as_type (m_type), | 4489 r.get_identifier_as_type (m_type), |
4490 m_value + 1);; | 4490 m_value + 1); |
4491 return; | 4491 return; |
4492 } | 4492 } |
4493 | 4493 |
4494 r.write (" gcc_jit_rvalue *%s =\n" | 4494 r.write (" gcc_jit_rvalue *%s =\n" |
4495 " gcc_jit_context_new_rvalue_from_long (%s, /* gcc_jit_context *ctxt */\n" | 4495 " gcc_jit_context_new_rvalue_from_long (%s, /* gcc_jit_context *ctxt */\n" |