Skip to content

Added support for setting TREE_ADDRESSABLE #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions gcc/jit/jit-playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion gcc/jit/jit-playback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 10 additions & 2 deletions gcc/jit/jit-recording.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions gcc/jit/jit-recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
};
Expand Down
7 changes: 7 additions & 0 deletions gcc/jit/libgccjit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions gcc/jit/libgccjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions gcc/jit/libgccjit.map
Original file line number Diff line number Diff line change
Expand Up @@ -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;