This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ast-optimizer-branch] Tree simplification and unparsing


Hi, 

I've seen the patch 'c-simplify' just today, and yes it's more clear than what 
I developped, thanks for all Diego. 

However the simplification of for/while/do is not yet in the patch, and
I see that there are some // comments I forgot to supress in the c-pretty-print.c

+// To be declared in another .h file ...
+extern void debug_output_buffer PARAMS ((output_buffer*));

That could be used during the debugging of output_buffers with gdb, 
but don't know exactly where to declare it.  
Maybe in the same file as other output_buffer primitives ? 



Sebastian.


2002-01-23  Sebastian Pop  <s.pop@laposte.net>

        * c-pretty-print.c : Clean c++ comments.
	(debug_output_buffer): Remove declaration and definition.
        * diagnostic.h (debug_output_buffer):
	Add declaration.
	* diagnostic.c (debug_output_buffer):
	Add definition.

Index: ./gcc/c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-pretty-print.c,v
retrieving revision 1.1.2.1
diff -d -u -p -r1.1.2.1 c-pretty-print.c
--- c-pretty-print.c	2002/01/21 01:33:02	1.1.2.1
+++ c-pretty-print.c	2002/01/23 16:33:03
@@ -32,17 +32,6 @@ static void dump_c_tree PARAMS ((output_
 static int dump_c_node PARAMS ((output_buffer*, tree, HOST_WIDE_INT));
 static void dump_c_indirect_ref PARAMS ((output_buffer*, tree, HOST_WIDE_INT));
 
-// To be declared in another .h file ...
-extern void debug_output_buffer PARAMS ((output_buffer*));
-
-
-/* Dump the contents of an output_buffer on stderr.  */
-void 
-debug_output_buffer (buffer)
-     output_buffer *buffer;
-{
-  fprintf (stderr, "%s", output_message_text (buffer));
-}
 
 /* Print the tree T in full, on file FILE.  */
  
@@ -139,8 +128,11 @@ dump_c_node (buffer, node, spc)
     return spc;
 
 #define INDENT_PRINT_C_NODE(SPACE) for (i = 0; i<SPACE; i++) output_add_space (buffer)
-  //#define NIY output_add_string (buffer, "NIY "); break
-#define NIY goto NotImplementedYet
+#define NIY output_add_string (buffer, "NIY "); break
+  /* This could be used for debugging the dump_c_node by gathering all exit NIY edges 
+     at a single point.  A breakpoint can then be inserted after the NotImplementedYet
+     label.  */
+  /* #define NIY goto NotImplementedYet  */
 
   /* Keep the following switch ordered as in 'tree.def' and 'c-common.def'.  */
   switch (TREE_CODE (node))
@@ -1034,7 +1026,7 @@ dump_c_scope_vars (buffer, scope, spc)
 {
   HOST_WIDE_INT i;
   tree iter = BLOCK_VARS (SCOPE_STMT_BLOCK (scope));
-  tree context = NULL_TREE; //BLOCK_SUPERCONTEXT (BLOCK_SUPERCONTEXT (TREE_OPERAND (scope, 0)));
+  tree context = NULL_TREE;
   
   /* Walk through the BLOCK_VARS and print declarations.  */
   while (iter)
Index: ./gcc/diagnostic.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.h,v
retrieving revision 1.32.2.1
diff -d -u -p -r1.32.2.1 diagnostic.h
--- diagnostic.h	2001/12/22 19:55:48	1.32.2.1
+++ diagnostic.h	2002/01/23 16:33:04
@@ -309,6 +309,7 @@ extern void record_last_error_module	PAR
 extern int error_function_changed	PARAMS ((void));
 extern void record_last_error_function	PARAMS ((void));
 extern void report_problematic_module	PARAMS ((output_buffer *));     
+extern void debug_output_buffer         PARAMS ((output_buffer *));
 
 /* Called by report_error_function to print out function name.
  * Default may be overridden by language front-ends.  */
Index: ./gcc/diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.64.2.1
diff -d -u -p -r1.64.2.1 diagnostic.c
--- diagnostic.c	2001/12/22 19:55:47	1.64.2.1
+++ diagnostic.c	2002/01/23 16:33:05
@@ -1520,3 +1520,12 @@ default_diagnostic_finalizer (buffer, dc
 {
   output_destroy_prefix (buffer);
 }
+
+/* Dump the contents of an output_buffer on stderr.  */
+
+void 
+debug_output_buffer (buffer)
+     output_buffer *buffer;
+{
+  fprintf (stderr, "%s", output_message_text (buffer));
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]