diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc index 6badbaf0d6f66..78479b17acf02 100644 --- a/gcc/jit/jit-playback.cc +++ b/gcc/jit/jit-playback.cc @@ -454,7 +454,8 @@ playback::context:: new_compound_type (location *loc, const char *name, bool is_struct, /* else is union */ - bool is_packed) + bool is_packed, + bool is_tree_addressable) { gcc_assert (name); @@ -466,7 +467,7 @@ new_compound_type (location *loc, if (is_packed) TYPE_PACKED (t) = 1; - + if (is_tree_addressable) TREE_ADDRESSABLE(t) = 1; if (loc) set_tree_location (t, loc); diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h index 64169863b010d..f38374d20d861 100644 --- a/gcc/jit/jit-playback.h +++ b/gcc/jit/jit-playback.h @@ -101,7 +101,8 @@ class context : public log_user new_compound_type (location *loc, const char *name, bool is_struct, /* else is union */ - bool is_packed); + bool is_packed, + bool is_tree_addressable); type * new_function_type (type *return_type, diff --git a/gcc/jit/jit-recording.cc b/gcc/jit/jit-recording.cc index 4eaa6478beddb..3084f01c68dfd 100644 --- a/gcc/jit/jit-recording.cc +++ b/gcc/jit/jit-recording.cc @@ -2593,6 +2593,12 @@ recording::type::set_packed () m_packed = true; } +void +recording::type::set_tree_addressable () +{ + m_tree_addressable = true; +} + /* Given a type, get a vector version of the type. Implements the post-error-checking part of @@ -3901,7 +3907,8 @@ recording::struct_::replay_into (replayer *r) r->new_compound_type (playback_location (r, get_loc ()), get_name ()->c_str (), true, /* is_struct */ - m_packed)); + m_packed, + m_tree_addressable)); } const char * @@ -3956,7 +3963,8 @@ recording::union_::replay_into (replayer *r) r->new_compound_type (playback_location (r, get_loc ()), get_name ()->c_str (), false, /* is_struct */ - m_packed)); + m_packed, + m_tree_addressable)); } /* Implementation of recording::memento::make_debug_string for diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h index 436434360cf15..4e069a8f6fb66 100644 --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -605,7 +605,7 @@ class type : public memento type *get_vector (size_t num_units); void set_packed (); - + void set_tree_addressable(); /* Get the type obtained when dereferencing this type. This will return NULL if it's not valid to dereference this type. @@ -687,12 +687,13 @@ class type : public memento type (context *ctxt) : memento (ctxt), m_packed (false), + m_tree_addressable (false), m_pointer_to_this_type (NULL) {} public: bool m_packed; - + bool m_tree_addressable; private: type *m_pointer_to_this_type; }; diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc index 6c3ff9dbaaf51..84a88b276f681 100644 --- a/gcc/jit/libgccjit.cc +++ b/gcc/jit/libgccjit.cc @@ -4431,6 +4431,13 @@ gcc_jit_type_set_packed (gcc_jit_type *type) type->set_packed (); } +void +gcc_jit_type_set_tree_addressable(gcc_jit_type *type) +{ + RETURN_IF_FAIL (type, NULL, NULL, "NULL type"); + type->set_tree_addressable(); +} + /* Public entrypoint. See description in libgccjit.h. After error-checking, the real work is done by the diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index b9b036f444acf..4a4ebe3a6df15 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -2267,6 +2267,11 @@ gcc_jit_target_info_supports_target_dependent_type(gcc_jit_target_info *info, en extern void gcc_jit_type_set_packed (gcc_jit_type *type); +/* Sets TREE_ADDRESSABLE on a given type, forcing it to be + passed indirectly and not in registers*/ +extern void + gcc_jit_type_set_tree_addressable(gcc_jit_type *type); + extern void gcc_jit_field_set_location (gcc_jit_field *field, gcc_jit_location *loc); diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map index f14c2017ac648..ad9dc1ccad109 100644 --- a/gcc/jit/libgccjit.map +++ b/gcc/jit/libgccjit.map @@ -373,3 +373,8 @@ LIBGCCJIT_ABI_42 { global: gcc_jit_lvalue_add_attribute; } LIBGCCJIT_ABI_41; + +LIBGCCJIT_ABI_43{ + global: + gcc_jit_type_set_tree_addressable; +} LIBGCCJIT_ABI_42; \ No newline at end of file