changeset 15347:6bdf379592d9

Remove --enable-jit-debug configure option * configure.ac: Remove --enable-jit-debug option. * pt-jit.cc: REmove OCTAVE_JIT_DEBUG guards.
author Max Brister <max@2bass.com>
date Mon, 10 Sep 2012 17:02:10 -0500
parents bd906ac220b6
children 9ed4fc294f3f
files configure.ac libinterp/interp-core/pt-jit.cc
diffstat 2 files changed, 13 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac
+++ b/configure.ac
@@ -693,13 +693,6 @@
   ## Find llvm-config program from environment variable or by searching
   AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility])
   AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, [])
-  
-  AC_ARG_ENABLE([jit-debug],
-    [AS_HELP_STRING([--enable-jit-debug], [enable debug printing of JIT IRs])])
-
-  if test x$enable_jit_debug = "xyes"; then
-    AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.])
-  fi
 
   if test -z "$LLVM_CONFIG"; then
     warn_llvm="llvm-config utility not found.  JIT compiler is disabled."
--- a/libinterp/interp-core/pt-jit.cc
+++ b/libinterp/interp-core/pt-jit.cc
@@ -43,6 +43,7 @@
 #include <llvm/Analysis/CallGraph.h>
 #include <llvm/Analysis/Passes.h>
 #include <llvm/Analysis/Verifier.h>
+#include <llvm/Bitcode/ReaderWriter.h>
 #include <llvm/LLVMContext.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/ExecutionEngine/JIT.h>
@@ -55,10 +56,6 @@
 #include <llvm/Transforms/IPO.h>
 #include <llvm/Transforms/Scalar.h>
 
-#ifdef OCTAVE_JIT_DEBUG
-#include <llvm/Bitcode/ReaderWriter.h>
-#endif
-
 static llvm::IRBuilder<> builder (llvm::getGlobalContext ());
 
 static llvm::LLVMContext& context = llvm::getGlobalContext ();
@@ -1865,12 +1862,13 @@
   module_pass_manager->run (*module);
   pass_manager->run (*fn);
 
-#ifdef OCTAVE_JIT_DEBUG
-  std::string error;
-  llvm::raw_fd_ostream fout ("test.bc", error,
-                             llvm::raw_fd_ostream::F_Binary);
-  llvm::WriteBitcodeToFile (module, fout);
-#endif
+  if (Venable_jit_debug)
+    {
+      std::string error;
+      llvm::raw_fd_ostream fout ("test.bc", error,
+                                 llvm::raw_fd_ostream::F_Binary);
+      llvm::WriteBitcodeToFile (module, fout);
+    }
 }
 
 // -------------------- jit_function_info --------------------
@@ -1890,7 +1888,6 @@
                        conv.get_variable_map ());
       infer.infer ();
 
-#if OCTAVE_JIT_DEBUG
       if (Venable_jit_debug)
         {
           jit_block_list& blocks = infer.get_blocks ();
@@ -1905,7 +1902,6 @@
           tpc.visit_octave_user_function_trailer (fcn);
           blocks.print (std::cout, "octave jit ir");
         }
-#endif
 
       jit_factory& factory = conv.get_factory ();
       llvm::Module *module = tjit.get_module ();
@@ -1915,7 +1911,6 @@
                                                       factory.constants (),
                                                       fcn, argument_types);
 
-#ifdef OCTAVE_JIT_DEBUG
       if (Venable_jit_debug)
         {
           std::cout << "-------------------- raw function ";
@@ -1923,7 +1918,6 @@
           std::cout << *raw_fn.to_llvm () << std::endl;
           llvm::verifyFunction (*raw_fn.to_llvm ());
         }
-#endif
 
       std::string wrapper_name = fcn.name () + "_wrapper";
       jit_type *any_t = jit_typeinfo::get_any ();
@@ -1964,7 +1958,6 @@
       llvm::Function *llvm_function = wrapper.to_llvm ();
       tjit.optimize (llvm_function);
 
-#ifdef OCTAVE_JIT_DEBUG
       if (Venable_jit_debug)
         {
           std::cout << "-------------------- optimized and wrapped ";
@@ -1972,7 +1965,6 @@
           std::cout << *llvm_function << std::endl;
           llvm::verifyFunction (*llvm_function);
         }
-#endif
 
       llvm::ExecutionEngine* engine = tjit.get_engine ();
       void *void_fn = engine->getPointerToFunction (llvm_function);
@@ -1981,13 +1973,12 @@
   catch (const jit_fail_exception& e)
     {
       argument_types.clear ();
-#ifdef OCTAVE_JIT_DEBUG
+
       if (Venable_jit_debug)
         {
           if (e.known ())
             std::cout << "jit fail: " << e.what () << std::endl;
         }
-#endif
     }
 }
 
@@ -2113,7 +2104,7 @@
                        conv.get_variable_map ());
 
       infer.infer ();
-#ifdef OCTAVE_JIT_DEBUG
+
       if (Venable_jit_debug)
         {
           jit_block_list& blocks = infer.get_blocks ();
@@ -2123,7 +2114,6 @@
           std::cout << tee.str_print_code () << std::endl;
           blocks.print (std::cout, "octave jit ir");
         }
-#endif
 
       jit_factory& factory = conv.get_factory ();
       jit_convert_llvm to_llvm;
@@ -2135,41 +2125,30 @@
     }
   catch (const jit_fail_exception& e)
     {
-#ifdef OCTAVE_JIT_DEBUG
       if (Venable_jit_debug)
         {
           if (e.known ())
             std::cout << "jit fail: " << e.what () << std::endl;
         }
-#endif
     }
 
   if (llvm_function)
     {
-#ifdef OCTAVE_JIT_DEBUG
-      llvm::raw_os_ostream llvm_cout (std::cout);
-
       if (Venable_jit_debug)
         {
           std::cout << "-------------------- llvm ir --------------------";
-          llvm_function->print (llvm_cout);
-          std::cout << std::endl;
+          std::cout << *llvm_function << std::endl;
           llvm::verifyFunction (*llvm_function);
         }
-#endif
 
       tjit.optimize (llvm_function);
 
-#ifdef OCTAVE_JIT_DEBUG
       if (Venable_jit_debug)
         {
           std::cout << "-------------------- optimized llvm ir "
                     << "--------------------\n";
-          llvm_function->print (llvm_cout);
-          llvm_cout.flush ();
-          std::cout << std::endl;
+          std::cout << *llvm_function << std::endl;
         }
-#endif
 
       void *void_fn = engine->getPointerToFunction (llvm_function);
       function = reinterpret_cast<jited_function> (void_fn);
@@ -2193,7 +2172,7 @@
 debugging/tracing is enabled for Octave's JIT compiler.\n\
 @end deftypefn")
 {
-#if defined (HAVE_LLVM) && defined (OCTAVE_JIT_DEBUG)
+#if defined (HAVE_LLVM)
   return SET_INTERNAL_VARIABLE (enable_jit_debug);
 #else
   warning ("enable_jit_debug: JIT compiling not available in this version of Octave");