Skip to content

Commit e1eece6

Browse files
committed
Add gcc_jit_param_set_tree_addressable
1 parent 2a958ef commit e1eece6

File tree

7 files changed

+34
-4
lines changed

7 files changed

+34
-4
lines changed

gcc/jit/jit-playback.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ playback::param *
542542
playback::context::
543543
new_param (location *loc,
544544
type *type,
545-
const char *name)
545+
const char *name,
546+
bool is_tree_addressable)
546547
{
547548
gcc_assert (type);
548549
gcc_assert (name);
@@ -551,6 +552,8 @@ new_param (location *loc,
551552
if (loc)
552553
set_tree_location (inner, loc);
553554

555+
if (is_tree_addressable) TREE_ADDRESSABLE(inner) = 1;
556+
554557
return new param (this, inner);
555558
}
556559

gcc/jit/jit-playback.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ class context : public log_user
116116
param *
117117
new_param (location *loc,
118118
type *type,
119-
const char *name);
119+
const char *name,
120+
bool is_tree_addressable);
120121

121122
function *
122123
new_function (location *loc,

gcc/jit/jit-recording.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4444,7 +4444,8 @@ recording::param::replay_into (replayer *r)
44444444
{
44454445
set_playback_obj (r->new_param (playback_location (r, m_loc),
44464446
m_type->playback_type (),
4447-
m_name->c_str ()));
4447+
m_name->c_str (),
4448+
m_tree_addressable));
44484449
}
44494450

44504451
/* Implementation of recording::rvalue::access_as_rvalue for params.
@@ -4458,6 +4459,12 @@ recording::param::access_as_rvalue (reproducer &r)
44584459
r.get_identifier (this));
44594460
}
44604461

4462+
void
4463+
recording::param::set_tree_addressable ()
4464+
{
4465+
m_tree_addressable = true;
4466+
}
4467+
44614468
/* Implementation of recording::lvalue::access_as_lvalue for params.
44624469
Instances of param need to be wrapped in a gcc_jit_param_as_lvalue
44634470
upcast call. */

gcc/jit/jit-recording.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,8 @@ class param : public lvalue
15331533
type *type,
15341534
string *name)
15351535
: lvalue (ctxt, loc, type),
1536-
m_name (name) {}
1536+
m_name (name),
1537+
m_tree_addressable (false) {}
15371538

15381539
lvalue *
15391540
as_lvalue () { return this; }
@@ -1558,6 +1559,8 @@ class param : public lvalue
15581559
m_name = m_ctxt->new_string (new_name);
15591560
}
15601561

1562+
void set_tree_addressable();
1563+
15611564
private:
15621565
string * make_debug_string () final override { return m_name; }
15631566
void write_reproducer (reproducer &r) final override;
@@ -1568,6 +1571,7 @@ class param : public lvalue
15681571

15691572
private:
15701573
string *m_name;
1574+
bool m_tree_addressable;
15711575
};
15721576

15731577
class function : public memento

gcc/jit/libgccjit.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,6 +4445,13 @@ gcc_jit_type_set_tree_addressable(gcc_jit_type *type)
44454445
type->set_tree_addressable();
44464446
}
44474447

4448+
void
4449+
gcc_jit_param_set_tree_addressable(gcc_jit_param *param)
4450+
{
4451+
RETURN_IF_FAIL (param, NULL, NULL, "NULL param");
4452+
param->set_tree_addressable();
4453+
}
4454+
44484455
/* Public entrypoint. See description in libgccjit.h.
44494456
44504457
After error-checking, the real work is done by the

gcc/jit/libgccjit.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,6 +2322,9 @@ gcc_jit_type_set_packed (gcc_jit_type *type);
23222322
extern void
23232323
gcc_jit_type_set_tree_addressable(gcc_jit_type *type);
23242324

2325+
extern void
2326+
gcc_jit_param_set_tree_addressable(gcc_jit_param *param);
2327+
23252328
extern void
23262329
gcc_jit_field_set_location (gcc_jit_field *field,
23272330
gcc_jit_location *loc);

gcc/jit/libgccjit.map

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,8 @@ LIBGCCJIT_ABI_46 {
393393
global:
394394
gcc_jit_is_lto_supported;
395395
} LIBGCCJIT_ABI_45;
396+
397+
LIBGCCJIT_ABI_47 {
398+
global:
399+
gcc_jit_param_set_tree_addressable;
400+
} LIBGCCJIT_ABI_46;

0 commit comments

Comments
 (0)