[llvm-commits] [gcc-plugin] r79529 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-file-ostream.h

Duncan Sands baldrick at free.fr
Thu Aug 20 07:23:15 PDT 2009


Author: baldrick
Date: Thu Aug 20 09:23:14 2009
New Revision: 79529

URL: http://llvm.org/viewvc/llvm-project?rev=79529&view=rev
Log:
When gcc is dumping RTL for debugging purposes,
output the LLVM IR for each function to the dump
file as soon as it is generated.  This should be
turned on using the -fdump-rtl-all switch.

Added:
    gcc-plugin/trunk/llvm-file-ostream.h
      - copied unchanged from r79523, llvm-gcc-4.2/trunk/gcc/llvm-file-ostream.h
Modified:
    gcc-plugin/trunk/llvm-backend.cpp

Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=79529&r1=79528&r2=79529&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Thu Aug 20 09:23:14 2009
@@ -85,6 +85,7 @@
 // Plugin headers
 #include "llvm-internal.h"
 #include "llvm-debug.h"
+#include "llvm-file-ostream.h"
 #include "llvm-target.h"
 //TODO#include "llvm-file-ostream.h"
 #include "bits_and_bobs.h"
@@ -1901,6 +1902,13 @@
   TREE_ASM_WRITTEN(current_function_decl) = 1;
 
   execute_free_datastructures ();
+
+  // When debugging, append the LLVM IR to the dump file.
+  if (dump_file) {
+    oFILEstream dump_stream(dump_file);
+    Fn->print(dump_stream);
+  }
+
   return 0;
 }
 





More information about the llvm-commits mailing list