]> git.eshelyaron.com Git - emacs.git/commitdiff
better comp-debug customize
authorAndrea Corallo <akrl@sdf.org>
Sun, 10 Nov 2019 13:51:38 +0000 (14:51 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:38:03 +0000 (11:38 +0100)
lisp/emacs-lisp/comp.el
src/comp.c

index f87d4bc401af45ebe141477036021d537e5cdbd7..cc7a1ba06a017dad17f5cfabb3c1b82a8ddeea0d 100644 (file)
   "Compiler optimization level.  From 0 to 3."
   :type 'number
   :group 'comp)
+
+(defcustom comp-debug 0
+  "Compiler debug level.  From 0 to 3.
+- 0 no debug facility
+- 1 emit debug symbols and dump pseudo C code
+- 2 dump gcc passes and libgccjit log file
+- 3 dump libgccjit reproducer"
+  :type 'number
+  :group 'comp)
+
 (defcustom comp-verbose 0
   "Compiler verbosity.  From 0 to 3.
 - 0 no logging
index 7fa55b12477502036e1436c31046efb0ae32269c..969495eb938ca5ba3d26d314b5ce572ba076db8f 100644 (file)
@@ -34,8 +34,6 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "blockinput.h"
 
-#define COMP_DEBUG 1
-
 /* C symbols emited for the load relocation mechanism.  */
 #define CURRENT_THREAD_RELOC_SYM "current_thread_reloc"
 #define PURE_RELOC_SYM "pure_reloc"
@@ -44,6 +42,9 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #define TEXT_DATA_RELOC_SYM "text_data_reloc"
 #define TEXT_IMPORTED_FUNC_RELOC_SYM "text_imported_funcs"
 
+#define SPEED XFIXNUM (Fsymbol_value (Qcomp_speed))
+#define COMP_DEBUG XFIXNUM (Fsymbol_value (Qcomp_debug))
+
 #define STR_VALUE(s) #s
 #define STR(s) STR_VALUE (s)
 
@@ -3070,7 +3071,7 @@ DEFUN ("comp--compile-ctxt-to-file", Fcomp__compile_ctxt_to_file,
       gcc_jit_context_dump_to_file (comp.ctxt,
                                    format_string ("%s.c", SSDATA (ctxtname)),
                                    1);
-  if (COMP_DEBUG > 1)
+  if (COMP_DEBUG > 2)
     gcc_jit_context_dump_reproducer_to_file (comp.ctxt, "comp_reproducer.c");
 
   AUTO_STRING (dot_so, NATIVE_ELISP_SUFFIX);
@@ -3312,6 +3313,7 @@ syms_of_comp (void)
 {
   /* Compiler control customize.  */
   DEFSYM (Qcomp_speed, "comp-speed");
+  DEFSYM (Qcomp_debug, "comp-debug");
   /* Limple instruction set.  */
   DEFSYM (Qcomment, "comment");
   DEFSYM (Qjump, "jump");