diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-04-24 20:33:04 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-04-24 20:33:04 +0000 |
commit | 0ebd1f00b84a09e9dd0e7e2600daaa33ab5cfdec (patch) | |
tree | c90c5e9ff712be24739a3fe0b5fec18deb517683 /gcc/jit/libgccjit.c | |
parent | 761ad35c86ae6eb2101259feacc54ce409ca2ff5 (diff) | |
download | gcc-0ebd1f00b84a09e9dd0e7e2600daaa33ab5cfdec.zip gcc-0ebd1f00b84a09e9dd0e7e2600daaa33ab5cfdec.tar.gz gcc-0ebd1f00b84a09e9dd0e7e2600daaa33ab5cfdec.tar.bz2 |
types.rst (gccjit::type::get_const): Remove comment.
gcc_jit_type_get_aligned
gcc/jit/ChangeLog:
* docs/cp/topics/types.rst (gccjit::type::get_const): Remove
comment.
(gccjit::type::get_aligned): Add.
* docs/topics/compatibility.rst: Add LIBGCCJIT_ABI_7.
* docs/topics/types.rst: Add gcc_jit_type_get_aligned.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
* jit-playback.c (gcc::jit::playback::type::get_aligned): New
method.
* jit-playback.h (gcc::jit::playback::type::get_aligned): New
method.
* jit-recording.c: Within namespace gcc::jit::recording...
(type::get_aligned): New method.
(memento_of_get_aligned::replay_into): New method.
(memento_of_get_aligned::make_debug_string): New method.
(memento_of_get_aligned::write_reproducer): New method.
* jit-recording.h: Within namespace gcc::jit::recording...
(type::get_aligned): New method.
(type::accepts_writes_from): Strip off qualifications from
this when comparing pointer equality.
(decorated_type): New subclass of type, subsuming the
commonality between memento_of_get_const and
memento_of_get_volatile.
(memento_of_get_const): Make a subclass of decorated_type,
rather than type.
(memento_of_get_volatile): Likewise.
(memento_of_get_aligned): Likewise.
* libgccjit++.h: Within namespace gccjit...
(type::get_const): New method.
(type::get_aligned): New method.
* libgccjit.c (gcc_jit_type_get_aligned): New function.
* libgccjit.h (gcc_jit_type_get_aligned): New decl.
* libgccjit.map (LIBGCCJIT_ABI_7): New
(gcc_jit_type_get_aligned): Add.
gcc/testsuite/ChangeLog:
* jit.dg/all-non-failing-tests.h: Add test-alignment.c.
* jit.dg/test-alignment.c: New test case.
* jit.dg/test-alignment.cc: New test case.
* jit.dg/test-error-gcc_jit_type_get_aligned-non-power-of-two.c:
New test case.
From-SVN: r247111
Diffstat (limited to 'gcc/jit/libgccjit.c')
-rw-r--r-- | gcc/jit/libgccjit.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c index b5e72f4..9b003e3 100644 --- a/gcc/jit/libgccjit.c +++ b/gcc/jit/libgccjit.c @@ -2970,3 +2970,27 @@ gcc_jit_rvalue_set_bool_require_tail_call (gcc_jit_rvalue *rvalue, call->set_require_tail_call (require_tail_call); } + +/* Public entrypoint. See description in libgccjit.h. + + After error-checking, the real work is done by the + gcc::jit::recording::type::get_aligned method, in + jit-recording.c. */ + +gcc_jit_type * +gcc_jit_type_get_aligned (gcc_jit_type *type, + size_t alignment_in_bytes) +{ + RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); + + gcc::jit::recording::context *ctxt = type->m_ctxt; + + JIT_LOG_FUNC (ctxt->get_logger ()); + + RETURN_NULL_IF_FAIL_PRINTF1 + (pow2_or_zerop (alignment_in_bytes), ctxt, NULL, + "alignment not a power of two: %zi", + alignment_in_bytes); + + return (gcc_jit_type *)type->get_aligned (alignment_in_bytes); +} |