mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge branch 'add_driver_option' into HEAD
This commit is contained in:
commit
aa526c9470
2 changed files with 62 additions and 0 deletions
|
|
@ -134,6 +134,16 @@ before compilation. Usable to modify the compiler environment."
|
||||||
:type 'list
|
:type 'list
|
||||||
:group 'comp)
|
:group 'comp)
|
||||||
|
|
||||||
|
(defcustom comp-native-driver-options nil
|
||||||
|
"Options passed verbatim to the native compiler's backend driver.
|
||||||
|
Note that not all options are meaningful; typically only the options
|
||||||
|
affecting the assembler and linker are likely to be useful.
|
||||||
|
|
||||||
|
Passing these options is only available in libgccjit version 9
|
||||||
|
and above."
|
||||||
|
:type 'list
|
||||||
|
:group 'comp)
|
||||||
|
|
||||||
(defvar comp-dry-run nil
|
(defvar comp-dry-run nil
|
||||||
"When non nil run everything but the C back-end.")
|
"When non nil run everything but the C back-end.")
|
||||||
|
|
||||||
|
|
@ -2581,6 +2591,8 @@ display a message."
|
||||||
comp-debug ,comp-debug
|
comp-debug ,comp-debug
|
||||||
comp-verbose ,comp-verbose
|
comp-verbose ,comp-verbose
|
||||||
comp-eln-load-path ',comp-eln-load-path
|
comp-eln-load-path ',comp-eln-load-path
|
||||||
|
comp-native-driver-options
|
||||||
|
',comp-native-driver-options
|
||||||
load-path ',load-path)
|
load-path ',load-path)
|
||||||
,comp-async-env-modifier-form
|
,comp-async-env-modifier-form
|
||||||
(message "Compiling %s..." ,source-file)
|
(message "Compiling %s..." ,source-file)
|
||||||
|
|
|
||||||
50
src/comp.c
50
src/comp.c
|
|
@ -56,6 +56,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||||
#undef gcc_jit_block_end_with_return
|
#undef gcc_jit_block_end_with_return
|
||||||
#undef gcc_jit_block_end_with_void_return
|
#undef gcc_jit_block_end_with_void_return
|
||||||
#undef gcc_jit_context_acquire
|
#undef gcc_jit_context_acquire
|
||||||
|
#undef gcc_jit_context_add_driver_option
|
||||||
#undef gcc_jit_context_compile_to_file
|
#undef gcc_jit_context_compile_to_file
|
||||||
#undef gcc_jit_context_dump_reproducer_to_file
|
#undef gcc_jit_context_dump_reproducer_to_file
|
||||||
#undef gcc_jit_context_dump_to_file
|
#undef gcc_jit_context_dump_to_file
|
||||||
|
|
@ -121,6 +122,8 @@ DEF_DLL_FN (const char *, gcc_jit_context_get_first_error,
|
||||||
DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block,
|
DEF_DLL_FN (gcc_jit_block *, gcc_jit_function_new_block,
|
||||||
(gcc_jit_function *func, const char *name));
|
(gcc_jit_function *func, const char *name));
|
||||||
DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void));
|
DEF_DLL_FN (gcc_jit_context *, gcc_jit_context_acquire, (void));
|
||||||
|
DEF_DLL_FN (void, gcc_jit_context_add_driver_option,
|
||||||
|
(gcc_jit_context *ctxt, const char *optname));
|
||||||
DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field,
|
DEF_DLL_FN (gcc_jit_field *, gcc_jit_context_new_field,
|
||||||
(gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type,
|
(gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_type *type,
|
||||||
const char *name));
|
const char *name));
|
||||||
|
|
@ -303,6 +306,7 @@ init_gccjit_functions (void)
|
||||||
LOAD_DLL_FN (library, gcc_jit_struct_as_type);
|
LOAD_DLL_FN (library, gcc_jit_struct_as_type);
|
||||||
LOAD_DLL_FN (library, gcc_jit_struct_set_fields);
|
LOAD_DLL_FN (library, gcc_jit_struct_set_fields);
|
||||||
LOAD_DLL_FN (library, gcc_jit_type_get_pointer);
|
LOAD_DLL_FN (library, gcc_jit_type_get_pointer);
|
||||||
|
LOAD_DLL_FN_OPT (library, gcc_jit_context_add_driver_option);
|
||||||
LOAD_DLL_FN_OPT (library, gcc_jit_version_major);
|
LOAD_DLL_FN_OPT (library, gcc_jit_version_major);
|
||||||
LOAD_DLL_FN_OPT (library, gcc_jit_version_minor);
|
LOAD_DLL_FN_OPT (library, gcc_jit_version_minor);
|
||||||
LOAD_DLL_FN_OPT (library, gcc_jit_version_patchlevel);
|
LOAD_DLL_FN_OPT (library, gcc_jit_version_patchlevel);
|
||||||
|
|
@ -319,6 +323,7 @@ init_gccjit_functions (void)
|
||||||
#define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return
|
#define gcc_jit_block_end_with_return fn_gcc_jit_block_end_with_return
|
||||||
#define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return
|
#define gcc_jit_block_end_with_void_return fn_gcc_jit_block_end_with_void_return
|
||||||
#define gcc_jit_context_acquire fn_gcc_jit_context_acquire
|
#define gcc_jit_context_acquire fn_gcc_jit_context_acquire
|
||||||
|
#define gcc_jit_context_add_driver_option fn_gcc_jit_context_add_driver_option
|
||||||
#define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file
|
#define gcc_jit_context_compile_to_file fn_gcc_jit_context_compile_to_file
|
||||||
#define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file
|
#define gcc_jit_context_dump_reproducer_to_file fn_gcc_jit_context_dump_reproducer_to_file
|
||||||
#define gcc_jit_context_dump_to_file fn_gcc_jit_context_dump_to_file
|
#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,
|
||||||
return Qt;
|
return Qt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN ("comp-native-driver-options-effective-p",
|
||||||
|
Fcomp_native_driver_options_effective_p,
|
||||||
|
Scomp_native_driver_options_effective_p,
|
||||||
|
0, 0, 0,
|
||||||
|
doc: /* Return t if `comp-native-driver-options' is
|
||||||
|
effective nil otherwise. */)
|
||||||
|
(void)
|
||||||
|
{
|
||||||
|
#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
|
||||||
|
|| defined (WINDOWSNT)
|
||||||
|
#pragma GCC diagnostic ignored "-Waddress"
|
||||||
|
if (gcc_jit_context_add_driver_option)
|
||||||
|
return Qt;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_driver_options (void)
|
||||||
|
{
|
||||||
|
Lisp_Object options = Fsymbol_value (Qcomp_native_driver_options);
|
||||||
|
|
||||||
|
#if defined (LIBGCCJIT_HAVE_gcc_jit_context_add_driver_option) \
|
||||||
|
|| defined (WINDOWSNT)
|
||||||
|
load_gccjit_if_necessary (true);
|
||||||
|
if (!NILP (Fcomp_native_driver_options_effective_p ()))
|
||||||
|
FOR_EACH_TAIL (options)
|
||||||
|
gcc_jit_context_add_driver_option (comp.ctxt,
|
||||||
|
SSDATA (XCAR (options)));
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
if (CONSP (options))
|
||||||
|
xsignal1 (Qnative_compiler_error,
|
||||||
|
build_string ("Customizing native compiler options"
|
||||||
|
" via `comp-native-driver-options' is"
|
||||||
|
" only available on libgccjit version 9"
|
||||||
|
" and above."));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
restore_sigmask (void)
|
restore_sigmask (void)
|
||||||
{
|
{
|
||||||
|
|
@ -4300,6 +4346,8 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
|
||||||
for (ptrdiff_t i = 0; i < func_h->count; i++)
|
for (ptrdiff_t i = 0; i < func_h->count; i++)
|
||||||
compile_function (HASH_VALUE (func_h, i));
|
compile_function (HASH_VALUE (func_h, i));
|
||||||
|
|
||||||
|
add_driver_options ();
|
||||||
|
|
||||||
if (COMP_DEBUG)
|
if (COMP_DEBUG)
|
||||||
gcc_jit_context_dump_to_file (comp.ctxt,
|
gcc_jit_context_dump_to_file (comp.ctxt,
|
||||||
format_string ("%s.c", SSDATA (base_name)),
|
format_string ("%s.c", SSDATA (base_name)),
|
||||||
|
|
@ -5106,6 +5154,7 @@ native compiled one. */);
|
||||||
|
|
||||||
DEFSYM (Qcomp_speed, "comp-speed");
|
DEFSYM (Qcomp_speed, "comp-speed");
|
||||||
DEFSYM (Qcomp_debug, "comp-debug");
|
DEFSYM (Qcomp_debug, "comp-debug");
|
||||||
|
DEFSYM (Qcomp_native_driver_options, "comp-native-driver-options");
|
||||||
|
|
||||||
/* Limple instruction set. */
|
/* Limple instruction set. */
|
||||||
DEFSYM (Qcomment, "comment");
|
DEFSYM (Qcomment, "comment");
|
||||||
|
|
@ -5206,6 +5255,7 @@ native compiled one. */);
|
||||||
"configuration, please recompile"));
|
"configuration, please recompile"));
|
||||||
|
|
||||||
defsubr (&Scomp_el_to_eln_filename);
|
defsubr (&Scomp_el_to_eln_filename);
|
||||||
|
defsubr (&Scomp_native_driver_options_effective_p);
|
||||||
defsubr (&Scomp__init_ctxt);
|
defsubr (&Scomp__init_ctxt);
|
||||||
defsubr (&Scomp__release_ctxt);
|
defsubr (&Scomp__release_ctxt);
|
||||||
defsubr (&Scomp__compile_ctxt_to_file);
|
defsubr (&Scomp__compile_ctxt_to_file);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue