diff options
author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-01-10 15:23:37 +0100 |
---|---|---|
committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-01-12 11:12:18 +0100 |
commit | 109985343bcada8936cb83d1fd3cb9cad915fb4a (patch) | |
tree | c36ab5ac651e9bad51e1d466e5acf43018d6d41f /gcc/jit/jit-playback.h | |
parent | d8c1361220ba7617adf4ccc396499f6393ec223e (diff) | |
download | gcc-109985343bcada8936cb83d1fd3cb9cad915fb4a.zip gcc-109985343bcada8936cb83d1fd3cb9cad915fb4a.tar.gz gcc-109985343bcada8936cb83d1fd3cb9cad915fb4a.tar.bz2 |
[PATCH] libgccjit: Add support for function attributes and variable attributes.
gcc/jit/ChangeLog:
* dummy-frontend.cc (handle_alias_attribute): New function.
(handle_always_inline_attribute): New function.
(handle_cold_attribute): New function.
(handle_fnspec_attribute): New function.
(handle_format_arg_attribute): New function.
(handle_format_attribute): New function.
(handle_noinline_attribute): New function.
(handle_target_attribute): New function.
(handle_used_attribute): New function.
(handle_visibility_attribute): New function.
(handle_weak_attribute): New function.
(handle_alias_ifunc_attribute): New function.
* jit-playback.cc (fn_attribute_to_string): New function.
(variable_attribute_to_string): New function.
(global_new_decl): Add attributes support.
(set_variable_attribute): New function.
(new_global): Add attributes support.
(new_global_initialized): Add attributes support.
(new_local): Add attributes support.
* jit-playback.h (fn_attribute_to_string): New function.
(set_variable_attribute): New function.
* jit-recording.cc (recording::lvalue::add_attribute): New function.
(recording::function::function): New function.
(recording::function::write_to_dump): Add attributes support.
(recording::function::add_attribute): New function.
(recording::function::add_string_attribute): New function.
(recording::function::add_integer_array_attribute): New function.
(recording::global::replay_into): Add attributes support.
(recording::local::replay_into): Add attributes support.
* jit-recording.h: Add attributes support.
* libgccjit.cc (gcc_jit_function_add_attribute): New function.
(gcc_jit_function_add_string_attribute): New function.
(gcc_jit_function_add_integer_array_attribute): New function.
(gcc_jit_lvalue_add_attribute): New function.
* libgccjit.h (enum gcc_jit_fn_attribute): New enum.
(gcc_jit_function_add_attribute): New function.
(gcc_jit_function_add_string_attribute): New function.
(gcc_jit_function_add_integer_array_attribute): New function.
(enum gcc_jit_variable_attribute): New function.
(gcc_jit_lvalue_add_string_attribute): New function.
* libgccjit.map: Declare new functions.
gcc/testsuite/ChangeLog:
* jit.dg/all-non-failing-tests.h: Add new attributes tests.
* jit.dg/jit.exp: Add `jit-verify-assembler-output-not` test command.
* jit.dg/test-restrict-attribute.c: New test.
* jit.dg/test-alias-attribute.c: New test.
* jit.dg/test-always_inline-attribute.c: New test.
* jit.dg/test-cold-attribute.c: New test.
* jit.dg/test-const-attribute.c: New test.
* jit.dg/test-noinline-attribute.c: New test.
* jit.dg/test-nonnull-attribute.c: New test.
* jit.dg/test-pure-attribute.c: New test.
* jit.dg/test-used-attribute.c: New test.
* jit.dg/test-variable-attribute.c: New test.
* jit.dg/test-weak-attribute.c: New test.
gcc/jit/ChangeLog:
* docs/topics/compatibility.rst: Add documentation for LIBGCCJIT_ABI_26.
* docs/topics/functions.rst: Add documentation for new functions.
* docs/topics/expressions.rst: Add documentation for new functions.
Co-authored-by: Antoni Boucher <bouanto@zoho.com>
Signed-off-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
Diffstat (limited to 'gcc/jit/jit-playback.h')
-rw-r--r-- | gcc/jit/jit-playback.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h index 9654507..05bafcd 100644 --- a/gcc/jit/jit-playback.h +++ b/gcc/jit/jit-playback.h @@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see #ifndef JIT_PLAYBACK_H #define JIT_PLAYBACK_H +#include <string> #include <utility> // for std::pair +#include <vector> #include "timevar.h" #include "varasm.h" @@ -35,12 +37,21 @@ namespace gcc { namespace jit { +const char* fn_attribute_to_string (gcc_jit_fn_attribute attr); +const char* variable_attribute_to_string (gcc_jit_variable_attribute attr); + /********************************************************************** Playback. **********************************************************************/ namespace playback { +void +set_variable_string_attribute ( + const std::vector<std::pair<gcc_jit_variable_attribute, + std::string>> &attributes, + tree decl); + /* playback::context is an abstract base class. The two concrete subclasses are: @@ -104,14 +115,22 @@ public: const char *name, const auto_vec<param *> *params, int is_variadic, - enum built_in_function builtin_id); + enum built_in_function builtin_id, + const std::vector<gcc_jit_fn_attribute> &attributes, + const std::vector<std::pair<gcc_jit_fn_attribute, + std::string>> &string_attributes, + const std::vector<std::pair<gcc_jit_fn_attribute, + std::vector<int>>> + &int_array_attributes); lvalue * new_global (location *loc, enum gcc_jit_global_kind kind, type *type, const char *name, - enum global_var_flags flags); + enum global_var_flags flags, + const std::vector<std::pair<gcc_jit_variable_attribute, + std::string>> &attributes); lvalue * new_global_initialized (location *loc, @@ -121,7 +140,11 @@ public: size_t initializer_num_elem, const void *initializer, const char *name, - enum global_var_flags flags); + enum global_var_flags flags, + const std::vector<std::pair< + gcc_jit_variable_attribute, + std::string>> + &attributes); rvalue * new_ctor (location *log, @@ -306,7 +329,9 @@ private: enum gcc_jit_global_kind kind, type *type, const char *name, - enum global_var_flags flags); + enum global_var_flags flags, + const std::vector<std::pair<gcc_jit_variable_attribute, + std::string>> &attributes); lvalue * global_finalize_lvalue (tree inner); @@ -500,7 +525,9 @@ public: lvalue * new_local (location *loc, type *type, - const char *name); + const char *name, + const std::vector<std::pair<gcc_jit_variable_attribute, + std::string>> &attributes); block* new_block (const char *name); |