Skip to content

Commit df53431

Browse files
authored
Added support for setting TREE_ADDRESSABLE (#76)
1 parent e9019a2 commit df53431

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
@@ -101,7 +101,8 @@ class context : public log_user
101101
new_compound_type (location *loc,
102102
const char *name,
103103
bool is_struct, /* else is union */
104-
bool is_packed);
104+
bool is_packed,
105+
bool is_tree_addressable);
105106

106107
type *
107108
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
@@ -2593,6 +2593,12 @@ recording::type::set_packed ()
25932593
m_packed = true;
25942594
}
25952595

2596+
void
2597+
recording::type::set_tree_addressable ()
2598+
{
2599+
m_tree_addressable = true;
2600+
}
2601+
25962602
/* Given a type, get a vector version of the type.
25972603
25982604
Implements the post-error-checking part of
@@ -3901,7 +3907,8 @@ recording::struct_::replay_into (replayer *r)
39013907
r->new_compound_type (playback_location (r, get_loc ()),
39023908
get_name ()->c_str (),
39033909
true, /* is_struct */
3904-
m_packed));
3910+
m_packed,
3911+
m_tree_addressable));
39053912
}
39063913

39073914
const char *
@@ -3956,7 +3963,8 @@ recording::union_::replay_into (replayer *r)
39563963
r->new_compound_type (playback_location (r, get_loc ()),
39573964
get_name ()->c_str (),
39583965
false, /* is_struct */
3959-
m_packed));
3966+
m_packed,
3967+
m_tree_addressable));
39603968
}
39613969

39623970
/* 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
@@ -605,7 +605,7 @@ class type : public memento
605605
type *get_vector (size_t num_units);
606606

607607
void set_packed ();
608-
608+
void set_tree_addressable();
609609
/* Get the type obtained when dereferencing this type.
610610
611611
This will return NULL if it's not valid to dereference this type.
@@ -687,12 +687,13 @@ class type : public memento
687687
type (context *ctxt)
688688
: memento (ctxt),
689689
m_packed (false),
690+
m_tree_addressable (false),
690691
m_pointer_to_this_type (NULL)
691692
{}
692693

693694
public:
694695
bool m_packed;
695-
696+
bool m_tree_addressable;
696697
private:
697698
type *m_pointer_to_this_type;
698699
};

gcc/jit/libgccjit.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4431,6 +4431,13 @@ gcc_jit_type_set_packed (gcc_jit_type *type)
44314431
type->set_packed ();
44324432
}
44334433

4434+
void
4435+
gcc_jit_type_set_tree_addressable(gcc_jit_type *type)
4436+
{
4437+
RETURN_IF_FAIL (type, NULL, NULL, "NULL type");
4438+
type->set_tree_addressable();
4439+
}
4440+
44344441
/* Public entrypoint. See description in libgccjit.h.
44354442
44364443
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
@@ -2267,6 +2267,11 @@ gcc_jit_target_info_supports_target_dependent_type(gcc_jit_target_info *info, en
22672267
extern void
22682268
gcc_jit_type_set_packed (gcc_jit_type *type);
22692269

2270+
/* Sets TREE_ADDRESSABLE on a given type, forcing it to be
2271+
passed indirectly and not in registers*/
2272+
extern void
2273+
gcc_jit_type_set_tree_addressable(gcc_jit_type *type);
2274+
22702275
extern void
22712276
gcc_jit_field_set_location (gcc_jit_field *field,
22722277
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)