diff options
| author | Andrea Corallo | 2020-08-26 21:40:00 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-08-26 21:40:00 +0200 |
| commit | aa526c9470d679e9144af55d9e56928a111d2ceb (patch) | |
| tree | d40d2dca911a2e01402fea03f21ec8bc3a94fd57 /src | |
| parent | 337367a733e107df1ecb89955f0a249491bc62d9 (diff) | |
| parent | 51acfeef6a5cf4dce2c80f56fbe0d8b0aa3d660c (diff) | |
| download | emacs-aa526c9470d679e9144af55d9e56928a111d2ceb.tar.gz emacs-aa526c9470d679e9144af55d9e56928a111d2ceb.zip | |
Merge branch 'add_driver_option' into HEAD
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/comp.c b/src/comp.c index 5f1257f6be1..fa5ffadf311 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -56,6 +56,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 56 | #undef gcc_jit_block_end_with_return | 56 | #undef gcc_jit_block_end_with_return |
| 57 | #undef gcc_jit_block_end_with_void_return | 57 | #undef gcc_jit_block_end_with_void_return |
| 58 | #undef gcc_jit_context_acquire | 58 | #undef gcc_jit_context_acquire |
| 59 | #undef gcc_jit_context_add_driver_option | ||
| 59 | #undef gcc_jit_context_compile_to_file | 60 | #undef gcc_jit_context_compile_to_file |
| 60 | #undef gcc_jit_context_dump_reproducer_to_file | 61 | #undef gcc_jit_context_dump_reproducer_to_file |
| 61 | #undef gcc_jit_context_dump_to_file | 62 | #undef gcc_jit_context_dump_to_file |
| @@ -121,6 +122,8 @@ DEF_DLL_FN (const char *, gcc_jit_context_get_first_error, | |||
| 121 | DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block, | 122 | DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block, |
| 122 | (gcc_jit_function *func, const char *name)); | 123 | (gcc_jit_function *func, const char *name)); |
| 123 | DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void)); | 124 | DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void)); |
| 125 | DEF_DLL_FN (void, gcc_jit_context_add_driver_option, | ||
| 126 | (gcc_jit_context *ctxt, const char *optname)); | ||
| 124 | DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field, | 127 | DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field, |
| 125 | (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type, | 128 | (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type, |
| 126 | const char *name)); | 129 | const char *name)); |
| @@ -303,6 +306,7 @@ init_gccjit_functions (void) | |||
| 303 | LOAD_DLL_FN (library, gcc_jit_struct_as_type); | 306 | LOAD_DLL_FN (library, gcc_jit_struct_as_type); |
| 304 | LOAD_DLL_FN (library, gcc_jit_struct_set_fields); | 307 | LOAD_DLL_FN (library, gcc_jit_struct_set_fields); |
| 305 | LOAD_DLL_FN (library, gcc_jit_type_get_pointer); | 308 | LOAD_DLL_FN (library, gcc_jit_type_get_pointer); |
| 309 | LOAD_DLL_FN_OPT (library, gcc_jit_context_add_driver_option); | ||
| 306 | LOAD_DLL_FN_OPT (library, gcc_jit_version_major); | 310 | LOAD_DLL_FN_OPT (library, gcc_jit_version_major); |
| 307 | LOAD_DLL_FN_OPT (library, gcc_jit_version_minor); | 311 | LOAD_DLL_FN_OPT (library, gcc_jit_version_minor); |
| 308 | LOAD_DLL_FN_OPT (library, gcc_jit_version_patchlevel); | 312 | LOAD_DLL_FN_OPT (library, gcc_jit_version_patchlevel); |
| @@ -319,6 +323,7 @@ init_gccjit_functions (void) | |||
| 319 | #define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return | 323 | #define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return |
| 320 | #define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return | 324 | #define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return |
| 321 | #define gcc_jit_context_acquire fn_gcc_jit_context_acquire | 325 | #define gcc_jit_context_acquire fn_gcc_jit_context_acquire |
| 326 | #define gcc_jit_context_add_driver_option fn_gcc_jit_context_add_driver_option | ||
| 322 | #define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file | 327 | #define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file |
| 323 | #define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file | 328 | #define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file |
| 324 | #define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file | 329 | #define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file |
| @@ -4231,6 +4236,47 @@ DEFUN ("comp--release-ctxt", Fcomp__release_ctxt, Scomp__release_ctxt, | |||
| 4231 | return Qt; | 4236 | return Qt; |
| 4232 | } | 4237 | } |
| 4233 | 4238 | ||
| 4239 | DEFUN ("comp-native-driver-options-effective-p", | ||
| 4240 | Fcomp_native_driver_options_effective_p, | ||
| 4241 | Scomp_native_driver_options_effective_p, | ||
| 4242 | 0, 0, 0, | ||
| 4243 | doc: /* Return t if `comp-native-driver-options' is | ||
| 4244 | effective nil otherwise. */) | ||
| 4245 | (void) | ||
| 4246 | { | ||
| 4247 | #if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ | ||
| 4248 | || defined (WINDOWSNT) | ||
| 4249 | #pragma GCC diagnostic ignored "-Waddress" | ||
| 4250 | if (gcc_jit_context_add_driver_option) | ||
| 4251 | return Qt; | ||
| 4252 | #pragma GCC diagnostic pop | ||
| 4253 | #endif | ||
| 4254 | return Qnil; | ||
| 4255 | } | ||
| 4256 | |||
| 4257 | |||
| 4258 | static void | ||
| 4259 | add_driver_options (void) | ||
| 4260 | { | ||
| 4261 | Lisp_Object options = Fsymbol_value (Qcomp_native_driver_options); | ||
| 4262 | |||
| 4263 | #if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \ | ||
| 4264 | || defined (WINDOWSNT) | ||
| 4265 | load_gccjit_if_necessary (true); | ||
| 4266 | if (!NILP (Fcomp_native_driver_options_effective_p ())) | ||
| 4267 | FOR_EACH_TAIL (options) | ||
| 4268 | gcc_jit_context_add_driver_option (comp.ctxt, | ||
| 4269 | SSDATA (XCAR (options))); | ||
| 4270 | return; | ||
| 4271 | #endif | ||
| 4272 | if (CONSP (options)) | ||
| 4273 | xsignal1 (Qnative_compiler_error, | ||
| 4274 | build_string ("Customizing native compiler options" | ||
| 4275 | " via `comp-native-driver-options' is" | ||
| 4276 | " only available on libgccjit version 9" | ||
| 4277 | " and above.")); | ||
| 4278 | } | ||
| 4279 | |||
| 4234 | static void | 4280 | static void |
| 4235 | restore_sigmask (void) | 4281 | restore_sigmask (void) |
| 4236 | { | 4282 | { |
| @@ -4300,6 +4346,8 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file, | |||
| 4300 | for (ptrdiff_t i = 0; i < func_h->count; i++) | 4346 | for (ptrdiff_t i = 0; i < func_h->count; i++) |
| 4301 | compile_function (HASH_VALUE (func_h, i)); | 4347 | compile_function (HASH_VALUE (func_h, i)); |
| 4302 | 4348 | ||
| 4349 | add_driver_options (); | ||
| 4350 | |||
| 4303 | if (COMP_DEBUG) | 4351 | if (COMP_DEBUG) |
| 4304 | gcc_jit_context_dump_to_file (comp.ctxt, | 4352 | gcc_jit_context_dump_to_file (comp.ctxt, |
| 4305 | format_string ("%s.c", SSDATA (base_name)), | 4353 | format_string ("%s.c", SSDATA (base_name)), |
| @@ -5106,6 +5154,7 @@ native compiled one. */); | |||
| 5106 | 5154 | ||
| 5107 | DEFSYM (Qcomp_speed, "comp-speed"); | 5155 | DEFSYM (Qcomp_speed, "comp-speed"); |
| 5108 | DEFSYM (Qcomp_debug, "comp-debug"); | 5156 | DEFSYM (Qcomp_debug, "comp-debug"); |
| 5157 | DEFSYM (Qcomp_native_driver_options, "comp-native-driver-options"); | ||
| 5109 | 5158 | ||
| 5110 | /* Limple instruction set. */ | 5159 | /* Limple instruction set. */ |
| 5111 | DEFSYM (Qcomment, "comment"); | 5160 | DEFSYM (Qcomment, "comment"); |
| @@ -5206,6 +5255,7 @@ native compiled one. */); | |||
| 5206 | "configuration, please recompile")); | 5255 | "configuration, please recompile")); |
| 5207 | 5256 | ||
| 5208 | defsubr (&Scomp_el_to_eln_filename); | 5257 | defsubr (&Scomp_el_to_eln_filename); |
| 5258 | defsubr (&Scomp_native_driver_options_effective_p); | ||
| 5209 | defsubr (&Scomp__init_ctxt); | 5259 | defsubr (&Scomp__init_ctxt); |
| 5210 | defsubr (&Scomp__release_ctxt); | 5260 | defsubr (&Scomp__release_ctxt); |
| 5211 | defsubr (&Scomp__compile_ctxt_to_file); | 5261 | defsubr (&Scomp__compile_ctxt_to_file); |