Skip to content

Commit 08969d5

Browse files
FractalFirantoyo
authored andcommitted
Added support for setting TREE_ADDRESSABLE (#76)
1 parent 71c7660 commit 08969d5

File tree

7 files changed

+35
-7
lines changed

7 files changed

+35
-7
lines changed

gcc/jit/jit-playback.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ playback::context::
454454
new_compound_type (location *loc,
455455
const char *name,
456456
bool is_struct, /* else is union */
457-
bool is_packed)
457+
bool is_packed,
458+
bool is_tree_addressable)
458459
{
459460
gcc_assert (name);
460461

@@ -466,7 +467,7 @@ new_compound_type (location *loc,
466467

467468
if (is_packed)
468469
TYPE_PACKED (t) = 1;
469-
470+
if (is_tree_addressable) TREE_ADDRESSABLE(t) = 1;
470471
if (loc)
471472
set_tree_location (t, loc);
472473

gcc/jit/jit-playback.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ class context : public log_user
105105
new_compound_type (location *loc,
106106
const char *name,
107107
bool is_struct, /* else is union */
108-
bool is_packed);
108+
bool is_packed,
109+
bool is_tree_addressable);
109110

110111
type *
111112
new_function_type (type *return_type,

gcc/jit/jit-recording.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,6 +2602,12 @@ recording::type::set_packed ()
26022602
m_packed = true;
26032603
}
26042604

2605+
void
2606+
recording::type::set_tree_addressable ()
2607+
{
2608+
m_tree_addressable = true;
2609+
}
2610+
26052611
/* Given a type, get a vector version of the type.
26062612
26072613
Implements the post-error-checking part of
@@ -3910,7 +3916,8 @@ recording::struct_::replay_into (replayer *r)
39103916
r->new_compound_type (playback_location (r, get_loc ()),
39113917
get_name ()->c_str (),
39123918
true, /* is_struct */
3913-
m_packed));
3919+
m_packed,
3920+
m_tree_addressable));
39143921
}
39153922

39163923
const char *
@@ -3965,7 +3972,8 @@ recording::union_::replay_into (replayer *r)
39653972
r->new_compound_type (playback_location (r, get_loc ()),
39663973
get_name ()->c_str (),
39673974
false, /* is_struct */
3968-
m_packed));
3975+
m_packed,
3976+
m_tree_addressable));
39693977
}
39703978

39713979
/* Implementation of recording::memento::make_debug_string for

gcc/jit/jit-recording.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ class type : public memento
617617
type *get_vector (size_t num_units);
618618

619619
void set_packed ();
620-
620+
void set_tree_addressable();
621621
/* Get the type obtained when dereferencing this type.
622622
623623
This will return NULL if it's not valid to dereference this type.
@@ -699,12 +699,13 @@ class type : public memento
699699
type (context *ctxt)
700700
: memento (ctxt),
701701
m_packed (false),
702+
m_tree_addressable (false),
702703
m_pointer_to_this_type (NULL)
703704
{}
704705

705706
public:
706707
bool m_packed;
707-
708+
bool m_tree_addressable;
708709
private:
709710
type *m_pointer_to_this_type;
710711
};

gcc/jit/libgccjit.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4438,6 +4438,13 @@ gcc_jit_type_set_packed (gcc_jit_type *type)
44384438
type->set_packed ();
44394439
}
44404440

4441+
void
4442+
gcc_jit_type_set_tree_addressable(gcc_jit_type *type)
4443+
{
4444+
RETURN_IF_FAIL (type, NULL, NULL, "NULL type");
4445+
type->set_tree_addressable();
4446+
}
4447+
44414448
/* Public entrypoint. See description in libgccjit.h.
44424449
44434450
After error-checking, the real work is done by the

gcc/jit/libgccjit.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,6 +2305,11 @@ gcc_jit_lvalue_add_attribute (gcc_jit_lvalue *variable,
23052305
extern void
23062306
gcc_jit_type_set_packed (gcc_jit_type *type);
23072307

2308+
/* Sets TREE_ADDRESSABLE on a given type, forcing it to be
2309+
passed indirectly and not in registers*/
2310+
extern void
2311+
gcc_jit_type_set_tree_addressable(gcc_jit_type *type);
2312+
23082313
extern void
23092314
gcc_jit_field_set_location (gcc_jit_field *field,
23102315
gcc_jit_location *loc);

gcc/jit/libgccjit.map

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,8 @@ LIBGCCJIT_ABI_42 {
373373
global:
374374
gcc_jit_lvalue_add_attribute;
375375
} LIBGCCJIT_ABI_41;
376+
377+
LIBGCCJIT_ABI_43{
378+
global:
379+
gcc_jit_type_set_tree_addressable;
380+
} LIBGCCJIT_ABI_42;

0 commit comments

Comments
 (0)