[ast-optimizer-branch] langhooks for pretty printer

Sebastian Pop m1sp@csc.liv.ac.uk
Sun Jun 9 10:10:00 GMT 2002


Hi, 

The following patch adds langhooks for the pretty-printer.
The C pretty printer is used as a default behaviour for the ObjC and C++ 
front ends.  Since the ObjC is translated into plain C, there is nothing to 
be done.  I think that there's no use to pretty print back to the ObjC syntax 
since the aim of the pretty printer is for the moment for debugging purposes 
only.  

For example you'll see:
printf ("%s\n", objc_msg_lookup (objc_msg_lookup (aString, &_OBJC_SELECTOR_TABLE, "Hi!"), &_OBJC_SELECTOR_TABLE + 2))
instead of the original:
printf ("%s\n", [[aString stringWithString:"Hi!"] cString]);

Another improvement is that the pretty printer prints argument names for 
a function declaration, for example:

void ::callFunc (int & x, void (*f) (int &, float))
{
  f (x, 3.0e0);
}

Sebastian.



2002-06-09  Sebastian Pop  <s.pop@laposte.net>

	Added langhooks for pretty printing.
	Use output_indent for indenting.

	* pretty-print.h: New file.

	* pretty-print.c: New file.

	* Makefile.in (pretty-print.o): New.

	* c-call-graph.c: Include pretty-print.h and langhooks.
	Call PRETTY_PRINT_FUNCTION_DECL for printing all function names.
	(print_caller): New function.
	(print_callee_xml): New function.
	(construct_call_graph): Define static.  Move some code in print_callee.

	* c-decl.c (c_expand_body): Include pretty-print.h.
	s/print_c_tree/pretty_print_chain/g
	
	* c-lang.c: Include pretty-print.h. 
	Define pretty print hooks for C language.

	* c-pretty-print.c: Include pretty-print.h and langhooks.
	s/INDENT/output_indent/g
	s/op_prio/PRETTY_PRINT_OP_PRIO/g
	(print_c_tree, print_c_node, debug_c_tree, debug_c_node): 
	Replaced by a language independent interface in pretty-print.c.
	(dump_c_tree): Renamed c_pretty_print_chain, 
	call back is done by calling PRETTY_PRINT_CHAIN.
	(dump_c_node): Renamed into c_pretty_print_node, 
	Call back by calling PRETTY_PRINT_NODE. 
	Remove indentation argument, use output_buffer's field instead.
	(print_declaration): Renamed c_pretty_print_declaration, 
	call it with PRETTY_PRINT_DECLARATION.
	(pretty_print_function_decl): Renamed c_pretty_print_function_decl,
	call it with PRETTY_PRINT_FUNCTION_DECL.
	Remove namespace printing.
	Call pretty_print_function_decl_args.
	(print_struct_decl): Renamed c_pretty_print_struct_decl,
	call it with PRETTY_PRINT_STRUCT_DECL.
	(print_call_name): Renamed print_call_expr_name.
	(PRINT_FUNCTION_NAME): Moved in print_call_expr_name.
	(pretty_print_string): Moved in pretty-print.c.

	* c-simplify.c: s/print_c_tree/PRETTY_PRINT_CHAIN/g
	s/print_c_node/PRETTY_PRINT_NODE/g
	
	* c-tree.h (print_c_tree, print_c_node, debug_c_tree, debug_c_node):
	Removed.

	* diagnostic.c (output_indent): Declared extern.
	
	* diagnostic.h (output_indent): Declared extern.
	
	* langhooks-def.h (lhd_pretty_print_print_chain, 
	lhd_pretty_print_print_node, 
	lhd_pretty_print_print_declaration, 
	lhd_pretty_print_print_function_decl, 
	lhd_pretty_print_print_struct_decl, 
	lhd_pretty_print_op_prio): Declare default functions.
	(LANG_HOOKS_PRETTY_PRINT_CHAIN_FN, 
	LANG_HOOKS_PRETTY_PRINT_NODE_FN, 
	LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN, 
	LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN, 
	LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN, 
	LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN, 
	LANG_HOOKS_PRETTY_PRINT_INITIALIZER): New.

	* langhooks.h (lang_hooks_for_pretty_print): New struct.

	* langhooks.c (lhd_pretty_print_print_chain, 
	lhd_pretty_print_print_node, 
	lhd_pretty_print_print_declaration, 
	lhd_pretty_print_print_function_decl, 
	lhd_pretty_print_print_struct_decl, 
	lhd_pretty_print_op_prio): Define default functions.

	* simple-break-elim.c (update_break_paths): 
	Mark ATTRIBUTE_UNUSED its arguments.

	* simple-goto-elim.c: Disable all debugging functions. 
	Include pretty-print.h. 
	s/debug_c_node/pretty_debug_node/g.

	* tree-ssa-pre.c: Include pretty-print.h.
	s/print_c_tree/pretty_print_chain/g.

cp/
	* cp/cp-pretty-print.c: New file.

	* cp/Make-lang.in (CXX_C_OBJS): Add pretty-print.o.
	(CXX_OBJS): Add cp/cp-pretty-print.o.
	(cp-pretty-print.o): New.

	* cp/cp-lang.c: Include pretty-print.h.
	Define pretty print hooks for C++ language.

objc/
	* objc/objc-pretty-print.c: New file.

	* objc/Make-lang.in (OBJC_OBJS): Add objc-pretty-print.o.
	(objc-pretty-print.o): New.

	* objc/objc-lang.c: Include pretty-print.h.
	Define pretty print hooks for ObjC language.


Index: Makefile.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.701.2.31
diff -d -u -p -r1.701.2.31 Makefile.in
--- Makefile.in	6 Jun 2002 03:52:17 -0000	1.701.2.31
+++ Makefile.in	9 Jun 2002 17:07:23 -0000
@@ -729,8 +729,8 @@ OBJS = alias.o bb-reorder.o bitmap.o bui
  fold-const.o function.o gcse.o genrtl.o ggc-common.o global.o graph.o	\
  haifa-sched.o hash.o hashtable.o hooks.o ifcvt.o insn-attrtab.o insn-emit.o \
  insn-extract.o insn-opinit.o insn-output.o insn-peep.o insn-recog.o	\
- integrate.o intl.o jump.o  langhooks.o lcm.o lists.o local-alloc.o 	\
- loop.o mbchar.o optabs.o params.o predict.o print-rtl.o print-tree.o	\
+ integrate.o intl.o jump.o langhooks.o lcm.o lists.o local-alloc.o loop.o \
+ mbchar.o optabs.o params.o predict.o print-rtl.o print-tree.o pretty-print.o \
  profile.o real.o recog.o reg-stack.o regclass.o regmove.o regrename.o	\
  reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o	\
  sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o	\
@@ -1375,7 +1375,7 @@ tree-optimize.o : tree-optimize.c tree-o
    $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) $(EXPR_H) \
    $(GGC_H) output.h diagnostic.h ssa.h errors.h flags.h
 c-simplify.o : c-simplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) errors.h \
-   $(C_TREE_H) $(C_COMMON_H) diagnostic.h tree-simple.h varray.h
+   $(C_TREE_H) $(C_COMMON_H) pretty-print.h tree-simple.h varray.h
 simple-break-elim.o : simple-break-elim.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
    $(C_TREE_H) $(C_COMMON_H) diagnostic.h tree-dchain.h
 simple-goto-elim.o : simple-goto-elim.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
@@ -1383,10 +1383,14 @@ simple-goto-elim.o : simple-goto-elim.c 
 tree-dchain.o : tree-dchain.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
    $(C_TREE_H) $(C_COMMON_H) tree-dchain.h
 c-call-graph.o : c-call-graph.c $(CONFIG_H) $(SYSTEM_H) $(C_TREE_H) \
-   $(C_COMMON_H) diagnostic.h hard-reg-set.h $(BASIC_BLOCK_H) tree-flow.h
+   $(C_COMMON_H) diagnostic.h hard-reg-set.h $(BASIC_BLOCK_H) tree-flow.h \
+   pretty-print.h langhooks.h langhooks-def.h
 tree-simple.o : tree-simple.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) tree-simple.h
 c-pretty-print.o : c-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
-   $(RTL_H) $(TREE_H) $(EXPR_H) $(C_COMMON_H) errors.h diagnostic.h
+   $(RTL_H) $(TREE_H) $(EXPR_H) $(C_COMMON_H) errors.h diagnostic.h \
+   langhooks.h langhooks-def.h
+pretty-print.o : pretty-print.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(EXPR_H) \
+   errors.h diagnostic.h langhooks.h langhooks-def.h
 stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \
    function.h $(EXPR_H) $(RTL_H) toplev.h $(GGC_H) $(TM_P_H) $(TARGET_H) \
    langhooks.h
Index: c-call-graph.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/c-call-graph.c,v
retrieving revision 1.1.2.1
diff -d -u -p -r1.1.2.1 c-call-graph.c
--- c-call-graph.c	1 Mar 2002 23:56:41 -0000	1.1.2.1
+++ c-call-graph.c	9 Jun 2002 17:07:23 -0000
@@ -28,20 +28,73 @@ Software Foundation, 59 Temple Place - S
 #include "basic-block.h"
 #include "tree-flow.h"
 #include "diagnostic.h"
+#include "pretty-print.h"
+#include "langhooks.h"
+#include "langhooks-def.h"
 
 
 /* Static declarations.  */
-static void construct_call_graph PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-static void write_dtd PARAMS ((output_buffer *));
-static void print_callee PARAMS ((output_buffer *, tree, int));
+static void construct_call_graph        PARAMS ((output_buffer *, tree));
+static void print_caller                PARAMS ((output_buffer *, tree));
+static void print_callee                PARAMS ((output_buffer *, tree));
+static void print_callee_xml            PARAMS ((output_buffer *, tree));
+static void write_dtd                   PARAMS ((output_buffer *));
 
-#define INDENT(SPACE) do { \
-  int i; for (i = 0; i<SPACE; i++) output_add_space (buffer); } while (0)
-#define NIY do { \
-  debug_output_buffer (buffer); debug_tree (node); abort (); } while (0)
 
+/* A structure for holding information about the current function.  */
+typedef struct function_statistics 
+{
+  unsigned int decision_points;
+  unsigned int nb_statements;
+  unsigned int nb_calls;
+  struct function_statistics *outer_function;
+} *fstat_ptr;
 
-/* Print the call graph associated to the tree T, in the file FILE.  */
+#define FSTAT_DECISION (FSTAT_TOP->decision_points)
+#define FSTAT_NB_STMTS (FSTAT_TOP->nb_statements)
+#define FSTAT_NB_CALLS (FSTAT_TOP->nb_calls)
+#define FSTAT_OUTER_FN (FSTAT_TOP->outer_function)
+
+/* A stack of function_statistics (used when dealing with nested functions).  */
+#define FSTAT_TOP function_stats_top
+#define FSTAT_NULL NULL
+static fstat_ptr FSTAT_TOP = FSTAT_NULL;
+#define FSTAT_NEW  xmalloc (sizeof (struct function_statistics))
+#define FSTAT_FREE(FS) free (FS)
+#define FSTAT_INIT_ZERO(FS)             \
+do                                      \
+  {                                     \
+    (FS)->decision_points = 0;          \
+    (FS)->nb_statements = 0;            \
+    (FS)->nb_calls = 0;                 \
+    (FS)->outer_function = FSTAT_NULL;  \
+  }                                     \
+while (0)
+#define FSTAT_PUSH                      \
+do                                      \
+  {                                     \
+    fstat_ptr new_fstat;                \
+    new_fstat = FSTAT_NEW;              \
+    FSTAT_INIT_ZERO (new_fstat);        \
+    if (FSTAT_TOP != FSTAT_NULL)        \
+      FSTAT_OUTER_FN = FSTAT_TOP;       \
+    FSTAT_TOP = new_fstat;              \
+  }                                     \
+while (0)
+#define FSTAT_POP                       \
+do                                      \
+  {                                     \
+    fstat_ptr old_fstat;                \
+    old_fstat = FSTAT_TOP;              \
+    FSTAT_TOP = FSTAT_OUTER_FN;         \
+    FSTAT_FREE (old_fstat);             \
+  }                                     \
+while (0)
+
+
+
+/* Entry point: prints the call graph associated to the tree T, in the file
+   FILE.  */
 
 void 
 print_call_graph (file, t)
@@ -50,13 +103,9 @@ print_call_graph (file, t)
 {
   output_buffer buffer_rec;
   output_buffer *buffer = &buffer_rec;
-  
-  init_output_buffer (buffer, /* prefix */NULL, /* line-width */0);
+  init_output_buffer (buffer, NULL, 0);
   output_clear_message_text (buffer);
-  /* write_dtd (buffer);  */
-  output_printf (buffer, "<file>\n");
-  construct_call_graph (buffer, t, 0);
-  output_printf (buffer, "</file>\n");
+  construct_call_graph (buffer, t);
   fprintf (file, "%s", output_finalize_message (buffer));
 }
 
@@ -75,23 +124,21 @@ debug_call_graph (t)
    described above.  
    Not Yet Implemented : the dump of global variables and their use.  */
 
-void 
-construct_call_graph (buffer, t, spc)
+static void 
+construct_call_graph (buffer, t)
      output_buffer *buffer;
      tree t;
-     HOST_WIDE_INT spc;
 {
-  static unsigned int decision_points;
-  static unsigned int nb_statements;
-  static unsigned int nb_calls;
   tree node = t;
-
+  
   while (node && node != error_mark_node)
     {
       enum tree_code code = TREE_CODE (node);
-      if (is_ctrl_stmt (node)) decision_points++;
-      if (is_exec_stmt (node)) nb_statements++;
-
+      if (is_ctrl_stmt (node)) 
+	FSTAT_DECISION++;
+      if (is_exec_stmt (node)) 
+	FSTAT_NB_STMTS++;
+      
       switch (code)
 	{
 	case TYPE_DECL:
@@ -102,126 +149,53 @@ construct_call_graph (buffer, t, spc)
 	  return;
 	  
 	case FUNCTION_DECL:
-	  if (BUILT_IN_FRONTEND)
-
-	  INDENT (spc);
-	  output_printf (buffer, "<caller id = \"");
-	  print_function_decl (buffer, node, 0);
-	  output_printf (buffer, "\">\n");
-
-	  /* What about definition of nested functions?  That will reset the
-	     current value of decision_points and nb_statements...  */
-	  decision_points = 0;
-	  nb_statements = 0;
-	  nb_calls = 0;
-	  construct_call_graph (buffer, DECL_SAVED_TREE (node), spc+1);
-
-	  /* Statements based statistics.  */
-	  INDENT (spc+1);
-	  output_printf (buffer, "<stats calls=\"%d\" decisions=\"%d\" stmts=\"%d\" Gilb=\"%f\"", 
-			 nb_calls, decision_points, nb_statements, 
-			 ((nb_statements == 0) ? 0 : 
-			  ((float)decision_points / (float)nb_statements)));
-	  
-	  /* Control flow statistics.  */
-	  init_flow ();
-	  tree_find_basic_blocks (DECL_SAVED_TREE (node));
-	  output_printf (buffer, " CFG-edges=\"%d\" CFG-BB=\"%d\" McCabe=\"%d\">\n",
-			 n_edges, n_basic_blocks, n_edges - n_basic_blocks + 2);
-	  delete_cfg ();
-
-	  /* End of the node.  */
-	  INDENT (spc);
-	  output_printf (buffer, "</caller>\n");
-	  return;
-
-	case CALL_EXPR:
 	  {
-	    tree op0;
-	    op0 = TREE_OPERAND (node, 0);
-
-	    nb_calls++;
-	    if (TREE_CODE (op0) == NON_LVALUE_EXPR)
-	      op0 = TREE_OPERAND (op0, 0);
-
-	    switch (TREE_CODE (op0))
+	    if (DECL_EXTERNAL (node) && DECL_BUILT_IN (node))
 	      {
-	      case VAR_DECL:
-	      case PARM_DECL:
-		/* if (TREE_CODE (op0) == PARM_DECL)
-		   This function pointer was received in parameter.  
-		   I think that this should not enter in the call graph.  
-		   Or otherwise it enters but with a special mark
-		   saying that the name of this function is a parameter, 
-		   and thus for this name we don't expect a declaration.
-		   Example: 
-		   /gcc/libiberty/splay_tree.c:splay_tree_foreach_helper ().  */
-		print_callee (buffer, op0, spc);
-		break;
-
-	      case ADDR_EXPR:
-	      case INDIRECT_REF:
-	      case NOP_EXPR:
-		print_callee (buffer, TREE_OPERAND (op0, 0), spc);
-		break;
-
-	      case COND_EXPR:
-		//print_callee (buffer, TREE_OPERAND (TREE_OPERAND (op0, 0), 1), spc);
-		//print_callee (buffer, TREE_OPERAND (TREE_OPERAND (op0, 0), 2), spc);
-		break;
-
-	      case COMPONENT_REF:
-		/* The function is a pointer contained in a structure.  */
-		if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
-		    TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-		  print_callee (buffer, TREE_OPERAND (op0, 1), spc);
-		/* else
-		   We can have several levels of structures and a function 
-		   pointer inside.  This is not implemented yet...  */
-		//		  NIY;
-		break;
-	      
-	      case ARRAY_REF:
-		if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-		  print_callee (buffer, TREE_OPERAND (op0, 0), spc);
-		else
-		  print_callee (buffer, TREE_OPERAND (op0, 1), spc);
-		break;
-
-	      default:
-		NIY;
+		/* Ignore builtin function declarations.  */
 	      }
+	    else
+	      print_caller (buffer, node);
+	    
+	    return;
+	  }
+	  
+	case CALL_EXPR:
+	  {
+	    FSTAT_NB_CALLS++;
+	    print_callee (buffer, node);
+	    
 	    /* Walk through function's arguments.  */
-	    construct_call_graph (buffer, TREE_OPERAND (node, 1), spc);	  
+	    construct_call_graph (buffer, TREE_OPERAND (node, 1));	  
 	    node = TREE_CHAIN (node);
 	    break;
 	  }
-
+	  
 	case METHOD_CALL_EXPR:
 	  NIY;
-
+	  
 	case ADDR_EXPR:
 	  /* May be a function pointer passed as a parameter to a function.  */
 	  if (TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL)
-	    print_callee (buffer, TREE_OPERAND (node, 0), spc);
+	    print_callee_xml (buffer, TREE_OPERAND (node, 0));
 	  else
-	    construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
+	    construct_call_graph (buffer, TREE_OPERAND (node, 0));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case ARRAY_REF:
 	  if (TREE_CODE (TREE_OPERAND (node, 0)) == ARRAY_REF)
-	    construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
+	    construct_call_graph (buffer, TREE_OPERAND (node, 0));
 	  
-	  construct_call_graph (buffer, TREE_OPERAND (node, 1), spc);
+	  construct_call_graph (buffer, TREE_OPERAND (node, 1));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case TREE_LIST:
-	  construct_call_graph (buffer, TREE_VALUE (node), spc);
+	  construct_call_graph (buffer, TREE_VALUE (node));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case FIX_TRUNC_EXPR:
 	case FIX_CEIL_EXPR:
 	case FIX_FLOOR_EXPR:
@@ -236,10 +210,10 @@ construct_call_graph (buffer, t, spc)
 	case NOP_EXPR:
 	case RETURN_STMT:
 	  /* Unary nodes.  */
-	  construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
+	  construct_call_graph (buffer, TREE_OPERAND (node, 0));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case DO_STMT:
 	case WHILE_STMT:
 	case SWITCH_STMT:
@@ -267,29 +241,29 @@ construct_call_graph (buffer, t, spc)
 	case TRUNC_DIV_EXPR:
 	case MODIFY_EXPR:
 	  /* Binary nodes.  */
-	  construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 1), spc);
+	  construct_call_graph (buffer, TREE_OPERAND (node, 0));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 1));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case COND_EXPR:
 	case IF_STMT:
 	  /* Ternary nodes.  */
-	  construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 1), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 2), spc);
+	  construct_call_graph (buffer, TREE_OPERAND (node, 0));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 1));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 2));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	case FOR_STMT:
 	  /* Quaternary nodes.  */
-	  construct_call_graph (buffer, TREE_OPERAND (node, 0), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 1), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 2), spc);
-	  construct_call_graph (buffer, TREE_OPERAND (node, 3), spc);
+	  construct_call_graph (buffer, TREE_OPERAND (node, 0));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 1));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 2));
+	  construct_call_graph (buffer, TREE_OPERAND (node, 3));
 	  node = TREE_CHAIN (node);
 	  break;
-
+	  
 	default:
 	  node = TREE_CHAIN (node);
 	  break;
@@ -297,24 +271,124 @@ construct_call_graph (buffer, t, spc)
     }
 }
 
+/* Prints an xml node <caller> for a FUNCTION_DECL.   */
 
-/* Print the callee function declaration.  */
+static void 
+print_caller (buffer, node)
+     output_buffer *buffer;
+     tree node;
+{
+  output_indent (buffer);
+  output_printf (buffer, "<caller fid=\"");
+  PRETTY_PRINT_FUNCTION_DECL (buffer, node);
+  output_printf (buffer, "\">\n");
+  
+  /* Push a new level of statistics for this function.  */
+  FSTAT_PUSH;
+  ++output_indentation (buffer);
+  
+  construct_call_graph (buffer, DECL_SAVED_TREE (node));
+  
+  /* Print statements based statistics.  */
+  output_indent (buffer);
+  output_printf (buffer, "<stats calls=\"%d\" decisions=\"%d\" stmts=\"%d\" Gilb=\"%f\"", 
+		 FSTAT_NB_CALLS, FSTAT_DECISION, FSTAT_NB_STMTS, 
+		 ((FSTAT_NB_STMTS == 0) ? 0 : 
+		  ((float)FSTAT_DECISION / (float)FSTAT_NB_STMTS)));
+  
+  /* Print control flow statistics.  */
+  init_flow ();
+  tree_find_basic_blocks (DECL_SAVED_TREE (node));
+  output_printf (buffer, " CFG-edges=\"%d\" CFG-BB=\"%d\" McCabe=\"%d\">\n",
+		 n_edges, n_basic_blocks, n_edges - n_basic_blocks + 2);
+  delete_cfg ();
+  
+  /* No more need statistics information: pop it.  */
+  FSTAT_POP;
+  --output_indentation (buffer);
+  
+  /* End of the node.  */
+  output_indent (buffer);
+  output_printf (buffer, "</caller>\n");
+}
+
+/* Prints an xml node <callee> for a CALL_EXPR.   */
 
 static void 
-print_callee (buffer, node, spc)
+print_callee (buffer, node)
      output_buffer *buffer;
      tree node;
-     int spc;
 {
-  int i;
+  tree op0;
+  
+  if (TREE_CODE (node) != CALL_EXPR)
+    abort ();
+  
+  op0 = TREE_OPERAND (node, 0);
+  
+  if (TREE_CODE (op0) == NON_LVALUE_EXPR)
+    op0 = TREE_OPERAND (op0, 0);
+  
+  switch (TREE_CODE (op0))
+    {
+    case VAR_DECL:
+    case PARM_DECL:
+      /* if (TREE_CODE (op0) == PARM_DECL)
+	 This function pointer was received in parameter.  
+	 I think that this should not enter in the call graph.  
+	 Or otherwise it enters but with a special mark
+	 saying that the name of this function is a parameter, 
+	 and thus for this name we don't expect a declaration.
+	 Example: 
+	 /gcc/libiberty/splay_tree.c:splay_tree_foreach_helper ().  */
+      print_callee_xml (buffer, op0);
+      break;
+      
+    case ADDR_EXPR:
+    case INDIRECT_REF:
+    case NOP_EXPR:
+      print_callee_xml (buffer, TREE_OPERAND (op0, 0));
+      break;
+      
+    case COND_EXPR:
+      print_callee_xml (buffer, TREE_OPERAND (TREE_OPERAND (op0, 0), 1));
+      print_callee_xml (buffer, TREE_OPERAND (TREE_OPERAND (op0, 0), 2));
+      break;
+      
+    case COMPONENT_REF:
+      /* The function is a pointer contained in a structure.  */
+      if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
+	  TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
+	print_callee_xml (buffer, TREE_OPERAND (op0, 1));
+      /* else
+	 We can have several levels of structures and a function 
+	 pointer inside.  This is not implemented yet...  */
+      /* NIY; */
+      break;
+      
+    case ARRAY_REF:
+      if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
+	print_callee_xml (buffer, TREE_OPERAND (op0, 0));
+      else
+	print_callee_xml (buffer, TREE_OPERAND (op0, 1));
+      break;
+      
+    default:
+      NIY;
+    }
+}
 
-  /* Indent.  */
-  for (i = 0; i<spc; i++) 
-    output_add_space (buffer);
 
-  /* Print the node.  */
-  output_printf (buffer, "<callee idref = \"");
-  print_function_decl (buffer, node, 0);
+/* Print the callee function declaration.  */
+
+static void 
+print_callee_xml (buffer, node)
+     output_buffer *buffer;
+     tree node;
+{
+  output_indent (buffer);
+  output_printf (buffer, "<callee fid=\"");
+  PRETTY_PRINT_FUNCTION_DECL (buffer, node);
   output_printf (buffer, "\"/>\n");
 }
 
Index: c-decl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.239.2.21
diff -d -u -p -r1.239.2.21 c-decl.c
--- c-decl.c	6 Jun 2002 03:52:18 -0000	1.239.2.21
+++ c-decl.c	9 Jun 2002 17:07:39 -0000
@@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - S
 #include "c-common.h"
 #include "c-pragma.h"
 #include "tree-dchain.h"
+#include "pretty-print.h"
 
 /* In grokdeclarator, distinguish syntactic contexts of declarators.  */
 enum decl_context
@@ -6882,7 +6883,7 @@ c_expand_body (fndecl, nested_p, can_def
   /* If this is a varargs function, inform function.c.  */
   if (c_function_varargs)
     mark_varargs ();
-
+  
   /* Invoke the SSA tree optimizer.  */
   if (flag_tree_ssa)
     optimize_function_tree (fndecl);
Index: c-lang.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-lang.c,v
retrieving revision 1.53.2.8
diff -d -u -p -r1.53.2.8 c-lang.c
--- c-lang.c	6 Jun 2002 03:52:19 -0000	1.53.2.8
+++ c-lang.c	9 Jun 2002 17:07:40 -0000
@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - S
 #include "tree.h"
 #include "c-tree.h"
 #include "c-common.h"
+#include "pretty-print.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
 
@@ -113,6 +114,19 @@ static void c_init_options PARAMS ((void
 #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
 #undef LANG_HOOKS_TYPE_PROMOTES_TO
 #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
+
+#undef LANG_HOOKS_PRETTY_PRINT_CHAIN_FN
+#define LANG_HOOKS_PRETTY_PRINT_CHAIN_FN c_pretty_print_chain
+#undef LANG_HOOKS_PRETTY_PRINT_NODE_FN 
+#define LANG_HOOKS_PRETTY_PRINT_NODE_FN c_pretty_print_node
+#undef LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN 
+#define LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN c_pretty_print_declaration
+#undef LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN c_pretty_print_function_decl
+#undef LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN c_pretty_print_struct_decl
+#undef LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN
+#define LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN c_op_prio
 
 /* Hooks for tree simplification.  */
 #undef LANG_HOOKS_SIMPLIFY_FUNCTION_TREE
Index: c-pretty-print.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/c-pretty-print.c,v
retrieving revision 1.1.2.14
diff -d -u -p -r1.1.2.14 c-pretty-print.c
--- c-pretty-print.c	8 Jun 2002 15:50:34 -0000	1.1.2.14
+++ c-pretty-print.c	9 Jun 2002 17:07:41 -0000
@@ -1,5 +1,5 @@
 /* Pretty formatting of a tree in C syntax.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2002 Free Software Foundation, Inc.
    Contributed by Sebastian Pop <s.pop@laposte.net>
 
 This file is part of GCC.
@@ -26,97 +26,26 @@ Software Foundation, 59 Temple Place - S
 #include "c-tree.h"
 #include "c-common.h"
 #include "diagnostic.h"
+#include "pretty-print.h"
+#include "langhooks.h"
+#include "langhooks-def.h"
 #include "real.h"
 
-/* To be declared in a .h after diagnostic.h since output_buffer is used.  
-   Or we can declare them in diagnostic.h ?  */
-extern void dump_c_tree PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-extern int dump_c_node PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-extern void print_declaration PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-extern void print_function_decl PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-extern void print_struct_decl PARAMS ((output_buffer *, tree, HOST_WIDE_INT));
-
-static int op_prio              PARAMS ((tree));
-static const char *op_symbol    PARAMS ((tree));
-static void pretty_print_string PARAMS ((output_buffer *, const char*));
-static void print_call_name     PARAMS ((output_buffer *, tree));
-
-#define INDENT(SPACE) do { \
-  int i; for (i = 0; i<SPACE; i++) output_add_space (buffer); } while (0)
-#define NIY do { \
-    output_add_string (buffer, "<<< Unknown tree: "); \
-    output_add_string (buffer, tree_code_name[(int) TREE_CODE (node)]); \
-    output_add_string (buffer, " >>>\n"); } while (0)
-
-#define PRINT_FUNCTION_NAME(NODE)  output_printf             \
-  (buffer, "%s", TREE_CODE (NODE) == NOP_EXPR ?              \
-   IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (NODE, 0))) : \
-   IDENTIFIER_POINTER (DECL_NAME (NODE)))
-
-
-
-/* Print the tree T in full, on file FILE.  */
- 
-void 
-print_c_tree (file, t)
-     FILE *file;
-     tree t;
-{
-  output_buffer buffer_rec;
-  output_buffer *buffer = &buffer_rec;
-  
-  init_output_buffer (buffer, /* prefix */NULL, /* line-width */0);
-  output_clear_message_text (buffer);
-  dump_c_tree (buffer, t, 0);
-  fprintf (file, "%s", output_finalize_message (buffer));
-}
-
-/* Print the node T on file FILE.  */
-
-void 
-print_c_node (file, t)
-     FILE *file;
-     tree t;
-{
-  output_buffer buffer_rec;
-  output_buffer *buffer = &buffer_rec;
-
-  init_output_buffer (buffer, /* prefix */NULL, /* line-width */0);
-  output_clear_message_text (buffer);
-  dump_c_node (buffer, t, 0);
-  fprintf (file, "%s", output_finalize_message (buffer));
-}
-
-/* Print the tree T in full, on stderr.  */
-
-void 
-debug_c_tree (t)
-     tree t;
-{
-  print_c_tree (stderr, t);
-}
-
-/* Print the node T on stderr.  */
+static const char *op_symbol            PARAMS ((tree));
+static void print_call_expr_name        PARAMS ((output_buffer *, tree));
+static void print_call_expr_args        PARAMS ((output_buffer *, tree));
 
-void 
-debug_c_node (t)
-     tree t;
-{
-  print_c_node (stderr, t);
-}
+/* Dump the chain beginning at node T on the output_buffer BUFFER.  */
 
-/* Dump the tree T on the output_buffer BUFFER.  */
- 
 void 
-dump_c_tree (buffer, t, spc)
+c_pretty_print_chain (buffer, t)
      output_buffer *buffer;
      tree t;
-     HOST_WIDE_INT spc;
 {
   tree node = t;
   while (node && node != error_mark_node)
     {
-      spc = dump_c_node (buffer, node, spc);
+      PRETTY_PRINT_NODE (buffer, node);
       switch (TREE_CODE (node))
 	{
 	case TYPE_DECL:
@@ -135,17 +64,16 @@ dump_c_tree (buffer, t, spc)
 
 /* Dump the node NODE on the output_buffer BUFFER, SPC spaces of indent.  */
 
-int
-dump_c_node (buffer, node, spc)
+void
+c_pretty_print_node (buffer, node)
      output_buffer *buffer;
      tree node;
-     HOST_WIDE_INT spc;
 {
   tree type;
   tree op0, op1;
 
   if (node == NULL_TREE)
-    return spc;
+    return;
 
   /* Keep the following switch ordered as in 'tree.def' and 'c-common.def'.  */
   switch (TREE_CODE (node))
@@ -163,10 +91,10 @@ dump_c_node (buffer, node, spc)
 	{
 	  if (TREE_PURPOSE (node))
 	    {
-	      dump_c_node (buffer, TREE_PURPOSE (node), spc);
+	      PRETTY_PRINT_NODE (buffer, TREE_PURPOSE (node));
 	      output_add_space (buffer);
 	    }
-	  dump_c_node (buffer, TREE_VALUE (node), spc);
+	  PRETTY_PRINT_NODE (buffer, TREE_VALUE (node));
 	  node = TREE_CHAIN (node);
 	  if (node && TREE_CODE (node) == TREE_LIST)
 	    {
@@ -177,11 +105,12 @@ dump_c_node (buffer, node, spc)
       break;
 
     case TREE_VEC:
-      dump_c_node (buffer, BINFO_TYPE (node), spc);
+      PRETTY_PRINT_NODE (buffer, BINFO_TYPE (node));
       break;
 
     case BLOCK:
       NIY;
+      break;
 
     case VOID_TYPE:
     case INTEGER_TYPE:
@@ -233,7 +162,7 @@ dump_c_node (buffer, node, spc)
       if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
         {
 	  tree fnode = TREE_TYPE (node);
-	  dump_c_node (buffer, TREE_TYPE (fnode), spc);
+	  PRETTY_PRINT_NODE (buffer, TREE_TYPE (fnode));
 	  output_add_space (buffer);
 	  output_add_string (buffer, "(*");
 	  if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
@@ -250,7 +179,7 @@ dump_c_node (buffer, node, spc)
 	    tree tmp = TYPE_ARG_TYPES (fnode);
 	    while (tmp && TREE_CHAIN (tmp) && tmp != error_mark_node)
 	      {
-		dump_c_node (buffer, TREE_VALUE (tmp), spc);
+		PRETTY_PRINT_NODE (buffer, TREE_VALUE (tmp));
 		tmp = TREE_CHAIN (tmp);
 		if (TREE_CHAIN (tmp) && TREE_CODE (TREE_CHAIN (tmp)) == TREE_LIST)
 		  {
@@ -263,17 +192,18 @@ dump_c_node (buffer, node, spc)
 	}
       else
         {
-          dump_c_node (buffer, TREE_TYPE (node), spc);
+          PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
 	  output_add_string (buffer, " *");
 	}
       break;
 
     case OFFSET_TYPE:
       NIY;
+      break;
 
     case REFERENCE_TYPE:
       /* FIXME : What is the exact syntax of this node for C? */
-      dump_c_node (buffer, TREE_TYPE (node), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
       break;
 
     case METHOD_TYPE:
@@ -284,13 +214,14 @@ dump_c_node (buffer, node, spc)
 
     case FILE_TYPE:
       NIY;
+      break;
 
     case ARRAY_TYPE:
       {
 	tree tmp;
 
 	/* Print the array type.  */
-	dump_c_node (buffer, TREE_TYPE (node), spc);
+	PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
 
 	/* Print the dimensions.  */
 	tmp = node;
@@ -309,6 +240,7 @@ dump_c_node (buffer, node, spc)
 
     case SET_TYPE:
       NIY;
+      break;
 
     case RECORD_TYPE:
     case UNION_TYPE:
@@ -320,7 +252,7 @@ dump_c_node (buffer, node, spc)
 	  else if (TREE_CODE (node) == UNION_TYPE)
 	    output_add_string (buffer, "union ");
 
-	  dump_c_node (buffer, TYPE_NAME (node), spc);
+	  PRETTY_PRINT_NODE (buffer, TYPE_NAME (node));
 	}
       else
         output_add_string (buffer, "<unnamed type>");
@@ -330,10 +262,15 @@ dump_c_node (buffer, node, spc)
 
     case QUAL_UNION_TYPE:
       NIY;
+      break;
 
+    case FUNCTION_TYPE:
+      PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
+      break;
 
     case LANG_TYPE:
       NIY;
+      break;
 
     case INTEGER_CST:
       if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
@@ -378,9 +315,9 @@ dump_c_node (buffer, node, spc)
 
     case COMPLEX_CST:
       output_add_string (buffer, "__complex__ (");
-      dump_c_node (buffer, TREE_REALPART (node), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_REALPART (node));
       output_add_string (buffer, ", ");
-      dump_c_node (buffer, TREE_IMAGPART (node), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_IMAGPART (node));
       output_add_string (buffer, ")");
       break;
 
@@ -390,41 +327,9 @@ dump_c_node (buffer, node, spc)
       output_add_string (buffer, "\"");
       break;
 
-    case FUNCTION_TYPE:
-      break;
-
     case FUNCTION_DECL:
       /* Print the prototype of the function.  */
-      INDENT (spc);
-      
-      /* Print the return type.  */
-      dump_c_node (buffer, TREE_TYPE (TREE_TYPE (node)), spc);
-      output_add_space (buffer);
-
-      /* Print the namespace.  */
-      dump_c_node (buffer, TREE_TYPE (node), spc);
-	      
-      /* Print the function name.  */
-      output_add_string (buffer, IDENTIFIER_POINTER (DECL_NAME (node)));
-      output_add_space (buffer);
-      output_add_character (buffer, '(');
-      
-      /* Print the argument types.  The last element in the list is a 
-	  VOID_TYPE.  The following avoid to print the last element.  */
-      {
-	tree tmp = TYPE_ARG_TYPES (TREE_TYPE (node));
-	while (tmp && TREE_CHAIN (tmp) && tmp != error_mark_node)
-	  {
-	    dump_c_node (buffer, TREE_VALUE (tmp), spc);
-	    tmp = TREE_CHAIN (tmp);
-	    if (TREE_CHAIN (tmp) && TREE_CODE (TREE_CHAIN (tmp)) == TREE_LIST)
-	      {
-		output_add_character (buffer, ',');
-		output_add_space (buffer);
-	      }
-	  }
-      }
-      output_add_character (buffer, ')');
+      PRETTY_PRINT_FUNCTION_DECL (buffer, node);
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
@@ -459,15 +364,15 @@ dump_c_node (buffer, node, spc)
 	    {
 	      /* The caller is a c++ function : all structures have at least 
 		 4 methods. */
-	      INDENT (spc);
+	      output_indent (buffer);
 	      output_add_string (buffer, "class ");
-	      dump_c_node (buffer, TREE_TYPE (node), spc);
+	      PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
 	    }
 	  else
 	    {
-	      INDENT (spc);
+	      output_indent (buffer);
 	      output_add_string (buffer, "struct ");
-	      dump_c_node (buffer, TREE_TYPE (node), spc);
+	      PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));
 	      output_add_character (buffer, ';');
 	      output_add_newline (buffer);
 	    }
@@ -483,7 +388,7 @@ dump_c_node (buffer, node, spc)
       break;
 
     case RESULT_DECL:
-      dump_c_node (buffer, TREE_TYPE (node), spc);      
+      PRETTY_PRINT_NODE (buffer, TREE_TYPE (node));      
       break;
 
     case FIELD_DECL:
@@ -502,49 +407,51 @@ dump_c_node (buffer, node, spc)
 
     case COMPONENT_REF:
       op0 = TREE_OPERAND (node, 0);
-      if (op_prio (op0) < op_prio (node))
+      if (PRETTY_PRINT_OP_PRIO (op0) < PRETTY_PRINT_OP_PRIO (node))
 	output_add_character (buffer, '(');
-      dump_c_node (buffer, op0, spc);
-      if (op_prio (op0) < op_prio (node))
+      PRETTY_PRINT_NODE (buffer, op0);
+      if (PRETTY_PRINT_OP_PRIO (op0) < PRETTY_PRINT_OP_PRIO (node))
 	output_add_character (buffer, ')');
       output_add_character (buffer, '.');
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       break;
 
     case BIT_FIELD_REF:
       output_add_string (buffer, "__builtin_bit_field_ref (");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, ", ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_string (buffer, ", ");
-      dump_c_node (buffer, TREE_OPERAND (node, 2), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 2));
       output_add_string (buffer, ")");
       break;
 
     case BUFFER_REF:
       NIY;
+      break;
 
     case ARRAY_REF:
       op0 = TREE_OPERAND (node, 0);
-      if (op_prio (op0) < op_prio (node))
+      if (PRETTY_PRINT_OP_PRIO (op0) < PRETTY_PRINT_OP_PRIO (node))
 	output_add_character (buffer, '(');
-      dump_c_node (buffer, op0, spc);
-      if (op_prio (op0) < op_prio (node))
+      PRETTY_PRINT_NODE (buffer, op0);
+      if (PRETTY_PRINT_OP_PRIO (op0) < PRETTY_PRINT_OP_PRIO (node))
 	output_add_character (buffer, ')');
       output_add_character (buffer, '[');
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_character (buffer, ']');
       break;
 
     case ARRAY_RANGE_REF:
       NIY;
+      break;
 
     case CONSTRUCTOR:
       {
 	tree lnode;
 	bool is_struct_init = FALSE;
 	output_add_character (buffer, '{');     
-	/*	dump_c_node (buffer, TREE_OPERAND (node, 1), spc);  */
+	/*	PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));  */
 	lnode = TREE_OPERAND (node, 1);
 	if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
 	    || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
@@ -555,7 +462,7 @@ dump_c_node (buffer, node, spc)
 	    if (TREE_PURPOSE (lnode) && is_struct_init)
 	      {
 		output_add_character (buffer, '.');
-		dump_c_node (buffer, TREE_PURPOSE (lnode), spc);
+		PRETTY_PRINT_NODE (buffer, TREE_PURPOSE (lnode));
 		output_add_string (buffer, "=");
 	      }
 	    val = TREE_VALUE (lnode);
@@ -571,7 +478,7 @@ dump_c_node (buffer, node, spc)
 	      }
 	    else
 	      {
-		dump_c_node (buffer, TREE_VALUE (lnode), spc);
+		PRETTY_PRINT_NODE (buffer, TREE_VALUE (lnode));
 	      }
 	    lnode = TREE_CHAIN (lnode);
 	    if (lnode && TREE_CODE (lnode) == TREE_LIST)
@@ -585,67 +492,71 @@ dump_c_node (buffer, node, spc)
       break;
 
     case COMPOUND_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_character (buffer, ',');
       output_add_space (buffer);
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       break;
 
     case MODIFY_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_space (buffer);
       output_add_character (buffer, '=');
       output_add_space (buffer);
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       break;
 
     case INIT_EXPR:
       NIY;
+      break;
 
     case TARGET_EXPR:
       NIY;
+      break;
 
     case COND_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_space (buffer);
       output_add_character (buffer, '?');
       output_add_space (buffer);
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_space (buffer);
       output_add_character (buffer, ':');
       output_add_space (buffer);
-      dump_c_node (buffer, TREE_OPERAND (node, 2), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 2));
       break;
 
     case BIND_EXPR:
       NIY;
+      break;
 
     case CALL_EXPR:
-      print_call_name (buffer, node);
-
-      /* Print parameters.  */
+      print_call_expr_name (buffer, node);
       output_add_space (buffer);
       output_add_character (buffer, '(');
-      op1 = TREE_OPERAND (node, 1);
-      if (op1)
-	dump_c_node (buffer, op1, 0);
+      print_call_expr_args (buffer, node);
       output_add_character (buffer, ')');
       break;
 
     case METHOD_CALL_EXPR:
       NIY;
+      break;
 
     case WITH_CLEANUP_EXPR:
       NIY;
+      break;
 
     case CLEANUP_POINT_EXPR:
       NIY;
+      break;
 
     case PLACEHOLDER_EXPR:
       NIY;
+      break;
 
     case WITH_RECORD_EXPR:
       NIY;
+      break;
 
       /* Binary arithmetic and logic expressions.  */
     case MULT_EXPR:
@@ -692,14 +603,14 @@ dump_c_node (buffer, node, spc)
 
 	/* When the operands are expressions with less priority, 
 	   keep semantics of the tree representation.  */
-	if (op_prio (op0) < op_prio (node))
+	if (PRETTY_PRINT_OP_PRIO (op0) < PRETTY_PRINT_OP_PRIO (node))
 	  {
 	    output_add_character (buffer, '(');
-	    dump_c_node (buffer, op0, spc);
+	    PRETTY_PRINT_NODE (buffer, op0);
 	    output_add_character (buffer, ')');
 	  }
 	else
-	  dump_c_node (buffer, op0, spc);
+	  PRETTY_PRINT_NODE (buffer, op0);
 
 	output_add_space (buffer);
 	output_add_string (buffer, op);
@@ -707,14 +618,14 @@ dump_c_node (buffer, node, spc)
 
 	/* When the operands are expressions with less priority, 
 	   keep semantics of the tree representation.  */
-	if (op_prio (op1) < op_prio (node))
+	if (PRETTY_PRINT_OP_PRIO (op1) < PRETTY_PRINT_OP_PRIO (node))
 	  {
 	    output_add_character (buffer, '(');
-	    dump_c_node (buffer, op1, spc);
+	    PRETTY_PRINT_NODE (buffer, op1);
 	    output_add_character (buffer, ')');
 	  }
 	else
-	  dump_c_node (buffer, op1, spc);
+	  PRETTY_PRINT_NODE (buffer, op1);
       }
       break;
 
@@ -723,7 +634,7 @@ dump_c_node (buffer, node, spc)
     case FIX_FLOOR_EXPR:
     case FIX_ROUND_EXPR:
     case FLOAT_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);	  
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));	  
       break;
 
       /* Unary arithmetic and logic expressions.  */
@@ -742,154 +653,168 @@ dump_c_node (buffer, node, spc)
       else
 	output_add_string (buffer, op_symbol (node));
 
-      if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
+      if (PRETTY_PRINT_OP_PRIO (TREE_OPERAND (node, 0)) < PRETTY_PRINT_OP_PRIO (node))
 	{
 	  output_add_character (buffer, '(');
-	  dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+	  PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
 	  output_add_character (buffer, ')');
 	}
       else
-	dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+	PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case POSTDECREMENT_EXPR:
     case POSTINCREMENT_EXPR:
-      if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
+      if (PRETTY_PRINT_OP_PRIO (TREE_OPERAND (node, 0)) < PRETTY_PRINT_OP_PRIO (node))
 	{
 	  output_add_character (buffer, '(');
-	  dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+	  PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
 	  output_add_character (buffer, ')');
 	}
       else
-	dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+	PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, op_symbol (node));
       break;
 
     case MIN_EXPR:
       /* #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))  */
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " < ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_string (buffer, " ? ");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " : ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       break;
 
     case MAX_EXPR:
       /* #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))  */
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " > ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_string (buffer, " ? ");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " : ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       break;
 
     case ABS_EXPR:
       /* n < 0 ? -n : n */
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " < 0 ? -");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, " : ");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
       
     case FFS_EXPR:
       NIY;
+      break;
 
     case UNORDERED_EXPR:
       NIY;
+      break;
 
     case ORDERED_EXPR:
       NIY;
+      break;
 
     case IN_EXPR:
       NIY;
+      break;
 
     case SET_LE_EXPR:
       NIY;
+      break;
 
     case CARD_EXPR:
       NIY;
+      break;
 
     case RANGE_EXPR:
       NIY;
+      break;
 
     case CONVERT_EXPR:
     case NOP_EXPR:
       type = TREE_TYPE (node);
-      if (type != TREE_TYPE (TREE_OPERAND (node, 0)))
+      if (type == ptr_type_node)
 	{
+	  /* Get the pointed-to type.  */
+	  type = TREE_TYPE (type);
 	  output_add_character (buffer, '(');
-	  dump_c_node (buffer, type, spc);
-	  output_add_string (buffer, ")");
+	  PRETTY_PRINT_NODE (buffer, type);
+	  output_add_string (buffer, " *)");
 	}
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case NON_LVALUE_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case SAVE_EXPR:
       output_add_string (buffer, "SAVE_EXPR (");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_character (buffer, ')');
       break;
 
     case UNSAVE_EXPR:
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case RTL_EXPR:
       NIY;
+      break;
 
     case ENTRY_VALUE_EXPR:
       NIY;
+      break;
 
     case COMPLEX_EXPR:
       output_add_string (buffer, "__complex__ (");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, ", ");
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_string (buffer, ")");
       break;
 
     case CONJ_EXPR:
       output_add_string (buffer, "__builtin_conjf (");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case REALPART_EXPR:
       output_add_string (buffer, "__real__ ");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case IMAGPART_EXPR:
       output_add_string (buffer, "__imag__ ");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case VA_ARG_EXPR:
       output_add_string (buffer, "__builtin_va_arg (");
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_string (buffer, ")");
       break;
 
     case TRY_CATCH_EXPR:
       NIY;
+      break;
 
     case TRY_FINALLY_EXPR:
       NIY;
+      break;
 
     case GOTO_SUBROUTINE_EXPR:
       NIY;
+      break;
 
     case LABEL_EXPR:
-      INDENT (spc);
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      output_indent (buffer);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_character (buffer, ':');
       output_add_character (buffer, ';');
       output_add_newline (buffer);
@@ -897,91 +822,107 @@ dump_c_node (buffer, node, spc)
 
     case GOTO_EXPR:
       NIY;
+      break;
 
     case EXIT_EXPR:
       NIY;
+      break;
 
     case LOOP_EXPR:
       NIY;
+      break;
 
     case LABELED_BLOCK_EXPR:
       NIY;
+      break;
 
     case EXIT_BLOCK_EXPR:
       NIY;
+      break;
 
     case EXPR_WITH_FILE_LOCATION:
-      INDENT (spc);
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      output_indent (buffer);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       break;
 
     case SWITCH_EXPR:
       NIY;
+      break;
 
     case EXC_PTR_EXPR:
       NIY;
+      break;
 
       /* Nodes from 'c-common.def'.  */
 
     case SRCLOC:
       NIY;
+      break;
 
     case SIZEOF_EXPR:
       NIY;
+      break;
 
     case ARROW_EXPR:
       NIY;
+      break;
 
     case ALIGNOF_EXPR:
       NIY;
+      break;
 
     case EXPR_STMT:
-      INDENT (spc);
-      dump_c_node (buffer, EXPR_STMT_EXPR (node), spc);
+      output_indent (buffer);
+      PRETTY_PRINT_NODE (buffer, EXPR_STMT_EXPR (node));
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
 
     case COMPOUND_STMT:
-      dump_c_tree (buffer, COMPOUND_BODY (node), spc);
+      PRETTY_PRINT_CHAIN (buffer, COMPOUND_BODY (node));
       break;
 
     case DECL_STMT:
-      print_declaration (buffer, TREE_OPERAND (node, 0), spc);
+      PRETTY_PRINT_DECLARATION (buffer, TREE_OPERAND (node, 0));
       break;
 
     case IF_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "if (");
-      dump_c_node (buffer, IF_COND (node), spc);
+      PRETTY_PRINT_NODE (buffer, IF_COND (node));
       output_add_character (buffer, ')');
       output_add_newline (buffer);
-      dump_c_node (buffer, THEN_CLAUSE (node), spc+2);
+      output_indentation (buffer) += 2;
+      PRETTY_PRINT_NODE (buffer, THEN_CLAUSE (node));
+      output_indentation (buffer) -= 2;
       if (ELSE_CLAUSE (node))
 	{
-	  INDENT (spc);
+	  output_indent (buffer);
 	  output_add_string (buffer, "else");
 	  output_add_newline (buffer);
-	  dump_c_node (buffer, ELSE_CLAUSE (node), spc+2);
+	  output_indentation (buffer) += 2;
+	  PRETTY_PRINT_NODE (buffer, ELSE_CLAUSE (node));
+	  output_indentation (buffer) -= 2;
 	}
       break;
 
     case FOR_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "for (");
       if (FOR_INIT_STMT (node))
-	dump_c_node (buffer, EXPR_STMT_EXPR (FOR_INIT_STMT (node)), 0);
-      output_add_character (buffer, ';');
+	PRETTY_PRINT_NODE (buffer, FOR_INIT_STMT (node));
       output_add_space (buffer);
-      dump_c_node (buffer, FOR_COND (node), 0);
+      PRETTY_PRINT_NODE (buffer, FOR_COND (node));
       output_add_character (buffer, ';');
       output_add_space (buffer);
-      dump_c_node (buffer, FOR_EXPR (node), 0);
+      PRETTY_PRINT_NODE (buffer, FOR_EXPR (node));
       output_add_character (buffer, ')');
       if (FOR_BODY (node))
 	{
 	  output_add_newline (buffer);
-	  dump_c_node (buffer, FOR_BODY (node), spc+2);
+	  output_indentation (buffer) += 2;
+	  PRETTY_PRINT_NODE (buffer, FOR_BODY (node));
+	  output_indentation (buffer) -= 2;
 	}
       else
 	{ 
@@ -991,90 +932,96 @@ dump_c_node (buffer, node, spc)
       break;
 
     case WHILE_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "while (");
-      dump_c_node (buffer, WHILE_COND (node), spc);
+      PRETTY_PRINT_NODE (buffer, WHILE_COND (node));
       output_add_character (buffer, ')');
       output_add_newline (buffer);
-      dump_c_node (buffer, WHILE_BODY (node), spc+2);
+      output_indentation (buffer) += 2;
+      PRETTY_PRINT_NODE (buffer, WHILE_BODY (node));
+      output_indentation (buffer) -= 2;
       break;
 
     case DO_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "do");
       output_add_newline (buffer);
-      dump_c_node (buffer, DO_BODY (node), spc+2);
-      INDENT (spc);
+      output_indentation (buffer) += 2;
+      PRETTY_PRINT_NODE (buffer, DO_BODY (node));
+      output_indentation (buffer) -= 2;
+      output_indent (buffer);
       output_add_string (buffer, "while (");
-      dump_c_node (buffer, DO_COND (node), spc);
+      PRETTY_PRINT_NODE (buffer, DO_COND (node));
       output_add_character (buffer, ')');
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
 
     case RETURN_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "return");
       if (TREE_CODE (TREE_TYPE (TREE_TYPE (current_function_decl))) != VOID_TYPE)
 	{
 	  output_add_space (buffer);
 	  if (TREE_CODE (RETURN_EXPR (node)) == MODIFY_EXPR)
-	    dump_c_node (buffer, TREE_OPERAND (RETURN_EXPR (node), 1), spc);
+	    PRETTY_PRINT_NODE (buffer, TREE_OPERAND (RETURN_EXPR (node), 1));
 	  else
-	    dump_c_node (buffer, RETURN_EXPR (node), spc);
+	    PRETTY_PRINT_NODE (buffer, RETURN_EXPR (node));
 	}
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
 
     case BREAK_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "break;");
       output_add_newline (buffer);
       break;
 
     case CONTINUE_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "continue;");
       output_add_newline (buffer);
       break;
 
     case SWITCH_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "switch (");
-      dump_c_node (buffer, SWITCH_COND (node), spc);
+      PRETTY_PRINT_NODE (buffer, SWITCH_COND (node));
       output_add_character (buffer, ')');
       output_add_newline (buffer);
-      dump_c_node (buffer, SWITCH_BODY (node), spc+2);
+      output_indentation (buffer) += 2;
+      PRETTY_PRINT_NODE (buffer, SWITCH_BODY (node));
+      output_indentation (buffer) -= 2;
       break;
 
     case GOTO_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "goto ");
-      dump_c_node (buffer, GOTO_DESTINATION (node), spc);
+      PRETTY_PRINT_NODE (buffer, GOTO_DESTINATION (node));
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
 
     case LABEL_STMT:
-      INDENT (spc);
-      dump_c_node (buffer, TREE_OPERAND (node, 0), spc);
+      output_indent (buffer);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 0));
       output_add_character (buffer, ':');
       output_add_character (buffer, ';');
       output_add_newline (buffer);
       break;
 
     case ASM_STMT:
-      INDENT (spc);
+      output_indent (buffer);
       output_add_string (buffer, "__asm__");
       if (ASM_VOLATILE_P (node))
 	output_add_string (buffer, " __volatile__");
       output_add_character (buffer, '(');
-      dump_c_node (buffer, TREE_OPERAND (node, 1), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 1));
       output_add_character (buffer, ':');
-      dump_c_node (buffer, TREE_OPERAND (node, 2), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 2));
       output_add_character (buffer, ':');
-      dump_c_node (buffer, TREE_OPERAND (node, 3), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_OPERAND (node, 3));
       output_add_string (buffer, ");");
       output_add_newline (buffer);      
       break;
@@ -1082,33 +1029,35 @@ dump_c_node (buffer, node, spc)
     case SCOPE_STMT:
       if (SCOPE_BEGIN_P (node))
 	{
-	  INDENT (spc);
+	  output_indent (buffer);
 	  output_add_character (buffer, '{');
 	  output_add_newline (buffer);
-	  spc += 2;
+	  output_indentation (buffer) += 2;
 	}
       else
 	{
-	  spc -= 2;
-	  INDENT (spc);
+	  output_indentation (buffer) -= 2;
+	  output_indent (buffer);
 	  output_add_character (buffer, '}');
 	  output_add_newline (buffer);
 	}
       break;
 
     case CASE_LABEL:
-      INDENT (spc-2);
+      output_indentation (buffer) -= 2;
+      output_indent (buffer);
+      output_indentation (buffer) += 2;
       if (CASE_LOW (node) && CASE_HIGH (node))
 	{
 	  output_add_string (buffer, "case ");
-	  dump_c_node (buffer, CASE_LOW (node), spc);
+	  PRETTY_PRINT_NODE (buffer, CASE_LOW (node));
 	  output_add_string (buffer, " ... ");
-	  dump_c_node (buffer, CASE_HIGH (node), spc);
+	  PRETTY_PRINT_NODE (buffer, CASE_HIGH (node));
 	}
       else if (CASE_LOW (node))
 	{
 	  output_add_string (buffer, "case ");
-	  dump_c_node (buffer, CASE_LOW (node), spc);
+	  PRETTY_PRINT_NODE (buffer, CASE_LOW (node));
 	}
       else
 	output_add_string (buffer, "default ");
@@ -1119,8 +1068,8 @@ dump_c_node (buffer, node, spc)
     case STMT_EXPR:
       output_add_character (buffer, '(');
       output_add_newline (buffer);
-      dump_c_node (buffer, STMT_EXPR_STMT (node), spc);
-      INDENT (spc);
+      PRETTY_PRINT_NODE (buffer, STMT_EXPR_STMT (node));
+      output_indent (buffer);
       output_add_character (buffer, ')');
       break;
 
@@ -1131,26 +1080,27 @@ dump_c_node (buffer, node, spc)
 
     case COMPOUND_LITERAL_EXPR:
       NIY;
+      break;
 
     default:
       NIY;
+      break;
     }
-  return spc;
+  return;
 }
 
 /* Print the declaration of a variable.  */
 
 void
-print_declaration (buffer, t, spc)
+c_pretty_print_declaration (buffer, t)
      output_buffer *buffer;
      tree t;
-     HOST_WIDE_INT spc;
 {
   /* Don't print type declarations.  */
   if (TREE_CODE (t) == TYPE_DECL)
     return;
       
-  INDENT (spc);
+  output_indent (buffer);
   
   if (DECL_REGISTER (t))
     output_add_string (buffer, "register ");
@@ -1164,11 +1114,11 @@ print_declaration (buffer, t, spc)
       tmp = TREE_TYPE (t);
       while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
 	tmp = TREE_TYPE (tmp);
-      dump_c_node (buffer, TREE_TYPE (tmp), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_TYPE (tmp));
       
       /* Print variable's name.  */
       output_add_space (buffer);
-      dump_c_node (buffer, t, spc);
+      PRETTY_PRINT_NODE (buffer, t);
       
       /* Print the dimensions.  */
       tmp = TREE_TYPE (t);
@@ -1185,11 +1135,11 @@ print_declaration (buffer, t, spc)
   else
     {
       /* Print type declaration.  */
-      dump_c_node (buffer, TREE_TYPE (t), spc);
+      PRETTY_PRINT_NODE (buffer, TREE_TYPE (t));
       
       /* Print variable's name.  */
       output_add_space (buffer);
-      dump_c_node (buffer, t, spc);
+      PRETTY_PRINT_NODE (buffer, t);
     }
   
   /* The initial value of a function serves to determine wether the function 
@@ -1203,7 +1153,7 @@ print_declaration (buffer, t, spc)
 	  output_add_space (buffer);
 	  output_add_character (buffer, '=');
 	  output_add_space (buffer);
-	  dump_c_node (buffer, DECL_INITIAL (t), spc);
+	  PRETTY_PRINT_NODE (buffer, DECL_INITIAL (t));
 	}
     }
   
@@ -1215,40 +1165,27 @@ print_declaration (buffer, t, spc)
 /* Print the declaration of a function given its declaration node.  */
 
 void
-print_function_decl (buffer, node, spc)
+c_pretty_print_function_decl (buffer, node)
      output_buffer *buffer;
      tree node;
-     HOST_WIDE_INT spc;
 {
   if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd')
-    NIY;
+    {
+      NIY;
+      return;
+    }
   
-  INDENT (spc);
+  output_indent (buffer);
 
   /* Print the return type.  */
-  dump_c_node (buffer, TREE_TYPE (TREE_TYPE (node)), 0);
+  PRETTY_PRINT_NODE (buffer, TREE_TYPE (TREE_TYPE (node)));
   output_add_space (buffer);
-  /* Print the namespace.  */
-  dump_c_node (buffer, TREE_TYPE (node), 0);
+  
   /* Print function name.  */
-  output_printf (buffer, "::%s (", TREE_CODE (node) == NOP_EXPR ?
+  output_printf (buffer, "%s (", TREE_CODE (node) == NOP_EXPR ?
 		 IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (node, 0))) :
 		 IDENTIFIER_POINTER (DECL_NAME (node)));
-  
-  /* Print the functions arguments.  */
-  {
-    tree tmp = TYPE_ARG_TYPES (TREE_TYPE (node));
-    while (tmp && TREE_CHAIN (tmp) && tmp != error_mark_node)
-      {
-	dump_c_node (buffer, TREE_VALUE (tmp), 0);
-	tmp = TREE_CHAIN (tmp);
-	if (TREE_CHAIN (tmp) && TREE_CODE (TREE_CHAIN (tmp)) == TREE_LIST)
-	  {
-	    output_add_character (buffer, ',');
-	    output_add_space (buffer);
-	  }
-      }
-  }
+  pretty_print_function_decl_args (buffer, TREE_TYPE (node));
   output_add_character (buffer, ')');
 }
 
@@ -1256,27 +1193,29 @@ print_function_decl (buffer, node, spc)
    FIXME : Not Implemented Yet correctly.  */
 
 void 
-print_struct_decl (buffer, node, spc)
+c_pretty_print_struct_decl (buffer, node)
      output_buffer *buffer;
      tree node;
-     HOST_WIDE_INT spc;
 {
   /* Print the name of the structure.  */
   if (TYPE_NAME (node))
     {
-      INDENT (spc);
+      output_indent (buffer);
       if (TREE_CODE (node) == RECORD_TYPE)
 	output_add_string (buffer, "struct ");
       else if (TREE_CODE (node) == UNION_TYPE)
 	output_add_string (buffer, "union ");
       else
-	NIY;
-      dump_c_node (buffer, TYPE_NAME (node), spc);
+	{
+	  NIY;
+	  return;
+	}
+      PRETTY_PRINT_NODE (buffer, TYPE_NAME (node));
     }
 
   /* Print the contents of the structure.  */  
   output_add_newline (buffer);
-  INDENT (spc);
+  output_indent (buffer);
   output_add_character (buffer, '{');
   output_add_newline (buffer);
   
@@ -1294,7 +1233,11 @@ print_struct_decl (buffer, node, spc)
 	if (TREE_TYPE (tmp) != node 
 	    || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE && 
 		TREE_TYPE (TREE_TYPE (tmp)) != node))
-	  print_declaration (buffer, tmp, spc+2);
+	  {
+	    output_indentation (buffer) += 2;
+	    PRETTY_PRINT_DECLARATION (buffer, tmp);
+	    output_indentation (buffer) -= 2;
+	  }
 	else
 	  {
 	    
@@ -1302,7 +1245,7 @@ print_struct_decl (buffer, node, spc)
 	tmp = TREE_CHAIN (tmp);
       }
   }
-  INDENT (spc);
+  output_indent (buffer);
   output_add_character (buffer, '}');
 }
 
@@ -1330,8 +1273,8 @@ print_struct_decl (buffer, node, spc)
    unary +, - and * have higher precedence than the corresponding binary
    operators.  */
 
-static int
-op_prio (op)
+int
+c_op_prio (op)
      tree op;
 {
   if (op == NULL)
@@ -1434,10 +1377,10 @@ op_prio (op)
 
     case SAVE_EXPR:
     case NON_LVALUE_EXPR:
-      return op_prio (TREE_OPERAND (op, 0));
+      return PRETTY_PRINT_OP_PRIO (TREE_OPERAND (op, 0));
 
     case EXPR_WITH_FILE_LOCATION:
-      return op_prio (EXPR_WFL_NODE (op));
+      return PRETTY_PRINT_OP_PRIO (EXPR_WFL_NODE (op));
 
     default:
       /* If OP is any type of expression operator, abort because we
@@ -1450,7 +1393,7 @@ op_prio (op)
 	  || TREE_CODE_CLASS (TREE_CODE (op)) == 'e')
 	{
 	  fputs ("\n", stderr);
-	  fprintf (stderr, "unhandled expression in op_prio(): ");
+	  fprintf (stderr, "unhandled expression in c_op_prio(): ");
 	  print_node_brief (stderr, "", op, 0);
 	  fputs ("\n", stderr);
 	  return -1;
@@ -1577,7 +1520,7 @@ op_symbol (op)
 /* Prints the name of a CALL_EXPR.  */
 
 static void 
-print_call_name (buffer, node)
+print_call_expr_name (buffer, node)
      output_buffer *buffer;
      tree node;
 {
@@ -1588,9 +1531,17 @@ print_call_name (buffer, node)
 
   op0 = TREE_OPERAND (node, 0);
 
+  while (TREE_CODE (op0) == CALL_EXPR)
+   op0 = TREE_OPERAND (op0, 0);
+
   if (TREE_CODE (op0) == NON_LVALUE_EXPR)
     op0 = TREE_OPERAND (op0, 0);
 
+#define PRINT_FUNCTION_NAME(NODE)  output_printf             \
+  (buffer, "%s", TREE_CODE (NODE) == NOP_EXPR ?              \
+   IDENTIFIER_POINTER (DECL_NAME (TREE_OPERAND (NODE, 0))) : \
+   IDENTIFIER_POINTER (DECL_NAME (NODE)))
+
   switch (TREE_CODE (op0))
     {
     case VAR_DECL:
@@ -1603,14 +1554,7 @@ print_call_name (buffer, node)
     case NOP_EXPR:
       PRINT_FUNCTION_NAME (TREE_OPERAND (op0, 0));
       break;
-    
-    case EXPR_WITH_FILE_LOCATION:
-      if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
-        PRINT_FUNCTION_NAME (TREE_OPERAND (op0, 0));
-      else
-	dump_c_node (buffer, TREE_OPERAND (op0, 0), 0);
-      break;
-    
+      
     case COND_EXPR:
       PRINT_FUNCTION_NAME (TREE_OPERAND (TREE_OPERAND (op0, 0), 1));
       PRINT_FUNCTION_NAME (TREE_OPERAND (TREE_OPERAND (op0, 0), 2));
@@ -1621,12 +1565,10 @@ print_call_name (buffer, node)
       if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
 	  TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
 	PRINT_FUNCTION_NAME (TREE_OPERAND (op0, 1));
-      else
-	dump_c_node (buffer, TREE_OPERAND (op0, 0), 0);
       /* else
 	 We can have several levels of structures and a function 
 	 pointer inside.  This is not implemented yet...  */
-      /*		  NIY;*/
+      //		  NIY;
       break;
       
     case ARRAY_REF:
@@ -1638,95 +1580,64 @@ print_call_name (buffer, node)
       
     default:
       NIY;
+      break;
     }
+#undef PRINT_FUNCTION_NAME
 }
 
-/* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ...  */
+/* Prints arguments of a CALL_EXPR.  */
 
 static void 
-pretty_print_string (buffer, str) 
+print_call_expr_args (buffer, node)
      output_buffer *buffer;
-     const char *str;
+     tree node;
 {
-  if (str == NULL)
-    return;
 
-  while (*str)
+  
+  if (TREE_CODE (node) != CALL_EXPR)
+    abort ();
+  
+  /* Operand 1 is a TREE_LIST or a NULL_TREE.  */
+  node = TREE_OPERAND (node, 1);
+
+  while (node && node != error_mark_node)
     {
-      switch (str[0])
+      tree value = TREE_VALUE (node);
+
+      switch (TREE_CODE (value))
 	{
-	case '\b':
-	  output_add_string (buffer, "\\b");
-	  break;
-	  
-	case '\f':
-	  output_add_string (buffer, "\\f");
-	  break;
-	  
-	case '\n':
-	  output_add_string (buffer, "\\n");
-	  break;
-	  
-	case '\r':
-	  output_add_string (buffer, "\\r");
-	  break;
-	  
-	case '\t':
-	  output_add_string (buffer, "\\t");
-	  break;
-	  
-	case '\v':
-	  output_add_string (buffer, "\\v");
-	  break;
+	case ADDR_EXPR:
+	  {
+	    tree op0;
+	    op0 = TREE_OPERAND (value, 0);
+	    switch (TREE_CODE (op0))
+	      {
+	      case FUNCTION_DECL:
+		/* Print just function's name.  */
+		output_printf (buffer, "%s", TREE_CODE (op0) == NOP_EXPR ?
+			       IDENTIFIER_POINTER (DECL_NAME 
+						   (TREE_OPERAND (op0, 0))) :
+			       IDENTIFIER_POINTER (DECL_NAME (op0)));
+		break;
+		
+	      default:
+		PRETTY_PRINT_NODE (buffer, value);
+		break;
+	      }
+	    break;
+	  }
 	  
-	case '\\':
-	  output_add_string (buffer, "\\\\");
-	  break;
-
-	case '\"':
-	  output_add_string (buffer, "\\\"");
-	  break;
-
-	case '\'':
-	  output_add_string (buffer, "\\'");
-	  break;
-
-	case '\0':
-	  output_add_string (buffer, "\\0");
-	  break;
-
-	case '\1':
-	  output_add_string (buffer, "\\1");
-	  break;
-
-	case '\2':
-	  output_add_string (buffer, "\\2");
-	  break;
-
-	case '\3':
-	  output_add_string (buffer, "\\3");
-	  break;
-
-	case '\4':
-	  output_add_string (buffer, "\\4");
-	  break;
-
-	case '\5':
-	  output_add_string (buffer, "\\5");
-	  break;
-
-	case '\6':
-	  output_add_string (buffer, "\\6");
-	  break;
-
-	case '\7':
-	  output_add_string (buffer, "\\7");
-	  break;
-
 	default:
-	  output_add_character (buffer, str[0]);
+	  PRETTY_PRINT_NODE (buffer, value);
 	  break;
 	}
-      str++;
+      
+      node = TREE_CHAIN (node);
+      if (node && TREE_CODE (node) == TREE_LIST)
+	{
+	  output_add_character (buffer, ',');
+	  output_add_space (buffer);
+	}
     }
 }
+
Index: c-simplify.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.2.22
diff -d -u -p -r1.1.2.22 c-simplify.c
--- c-simplify.c	8 Jun 2002 07:43:08 -0000	1.1.2.22
+++ c-simplify.c	9 Jun 2002 17:07:49 -0000
@@ -33,7 +33,7 @@ Software Foundation, 59 Temple Place - S
 #include "c-common.h"
 #include "tree-simple.h"
 #include "tree-inline.h"
-#include "diagnostic.h"
+#include "pretty-print.h"
 
 /** The simplification pass converts the language-dependent trees
     (ld-trees) emitted by the parser into language-independent trees
@@ -123,7 +123,7 @@ c_simplify_function_tree (fndecl)
 	       IDENTIFIER_POINTER (DECL_NAME (fndecl)));
 
       if (dump_flags & TDF_UNPARSE)
-	print_c_tree (dump_file, fnbody);
+	pretty_print_chain (dump_file, fnbody);
       else
 	dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
     }
@@ -149,7 +149,7 @@ c_simplify_function_tree (fndecl)
 	       IDENTIFIER_POINTER (DECL_NAME (fndecl)));
 
       if (dump_flags & TDF_UNPARSE)
-	print_c_tree (dump_file, fnbody);
+	pretty_print_chain (dump_file, fnbody);
       else
 	dump_node (fnbody, TDF_SLIM | dump_flags, dump_file);
 
@@ -198,7 +198,7 @@ simplify_stmt (stmt)
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
 	  fprintf (dump_file, "# %d\nORIGINAL:\n", STMT_LINENO (stmt));
-	  print_c_node (dump_file, stmt);
+	  pretty_print_node (dump_file, stmt);
 	  fprintf (dump_file, "\n");
 	}
 
@@ -305,15 +305,15 @@ simplify_stmt (stmt)
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
 	  fprintf (dump_file, "# %d\nPRE:\n", STMT_LINENO (stmt));
-	  print_c_tree (dump_file, pre);
+	  pretty_print_chain (dump_file, pre);
 	  fprintf (dump_file, "\n");
 
 	  fprintf (dump_file, "SIMPLIFIED:\n");
-	  print_c_tree (dump_file, stmt);
+	  pretty_print_chain (dump_file, stmt);
 	  fprintf (dump_file, "\n");
 
 	  fprintf (dump_file, "POST:\n");
-	  print_c_tree (dump_file, post);
+	  pretty_print_chain (dump_file, post);
 	  fprintf (dump_file, "\n");
 	}
 
Index: c-tree.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-tree.h,v
retrieving revision 1.64.2.12
diff -d -u -p -r1.64.2.12 c-tree.h
--- c-tree.h	6 Jun 2002 03:52:19 -0000	1.64.2.12
+++ c-tree.h	9 Jun 2002 17:07:54 -0000
@@ -390,12 +390,6 @@ extern tree static_dtors;
 /* In c-simplify.c  */
 extern int c_simplify_function_tree PARAMS ((tree));
 
-/* In c-pretty-print.c  */
-extern void print_c_tree  PARAMS ((FILE*, tree));
-extern void print_c_node  PARAMS ((FILE*, tree));
-extern void debug_c_tree  PARAMS ((tree));
-extern void debug_c_node  PARAMS ((tree));
-
 /* In c-call-graph.c  */
 extern void print_call_graph PARAMS ((FILE*, tree));
 extern void debug_call_graph PARAMS ((tree));
Index: diagnostic.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.64.2.6
diff -d -u -p -r1.64.2.6 diagnostic.c
--- diagnostic.c	12 May 2002 22:28:00 -0000	1.64.2.6
+++ diagnostic.c	9 Jun 2002 17:07:56 -0000
@@ -64,7 +64,6 @@ static void output_do_verbatim PARAMS ((
 					const char *, va_list *));
 static void output_buffer_to_stream PARAMS ((output_buffer *));
 static void output_format PARAMS ((output_buffer *));
-static void output_indent PARAMS ((output_buffer *));
 
 static char *vbuild_message_string PARAMS ((const char *, va_list))
      ATTRIBUTE_PRINTF (1, 0);
@@ -519,7 +518,7 @@ output_append (buffer, start, end)
   output_append_r (buffer, start, end - start);
 }
 
-static void
+void
 output_indent (buffer)
      output_buffer *buffer;
 {
Index: diagnostic.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/diagnostic.h,v
retrieving revision 1.32.2.5
diff -d -u -p -r1.32.2.5 diagnostic.h
--- diagnostic.h	28 Apr 2002 18:48:09 -0000	1.32.2.5
+++ diagnostic.h	9 Jun 2002 17:07:57 -0000
@@ -317,5 +317,6 @@ extern int error_function_changed	PARAMS
 extern void record_last_error_function	PARAMS ((void));
 extern void report_problematic_module	PARAMS ((output_buffer *));     
 extern void debug_output_buffer         PARAMS ((output_buffer *));
+extern void output_indent               PARAMS ((output_buffer *));
 
 #endif /* ! GCC_DIAGNOSTIC_H */
Index: langhooks-def.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.8.2.6
diff -d -u -p -r1.8.2.6 langhooks-def.h
--- langhooks-def.h	6 Jun 2002 03:52:19 -0000	1.8.2.6
+++ langhooks-def.h	9 Jun 2002 17:08:00 -0000
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hooks.h"
 
 struct diagnostic_context;
+struct output_buffer;
 
 /* Provide a hook routine for alias sets that always returns 1.  This is
    used by languages that haven't deal with alias sets yet.  */
@@ -186,6 +187,39 @@ int lhd_tree_dump_type_quals			PARAMS ((
   LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \
 }
 
+/* Pretty printing hooks.  */
+extern void lhd_pretty_print_print_chain        PARAMS ((struct output_buffer *,
+							 tree));
+extern void lhd_pretty_print_print_node         PARAMS ((struct output_buffer *,
+							 tree));
+extern void lhd_pretty_print_print_declaration  PARAMS ((struct output_buffer *,
+							 tree));
+extern void lhd_pretty_print_print_function_decl PARAMS ((struct output_buffer*,
+							  tree));
+extern void lhd_pretty_print_print_struct_decl  PARAMS ((struct output_buffer *,
+							 tree));
+extern int  lhd_pretty_print_op_prio            PARAMS ((tree));
+
+#define LANG_HOOKS_PRETTY_PRINT_CHAIN_FN lhd_pretty_print_print_chain
+#define LANG_HOOKS_PRETTY_PRINT_NODE_FN lhd_pretty_print_print_node
+#define LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN \
+  lhd_pretty_print_print_declaration
+#define LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN \
+  lhd_pretty_print_print_function_decl
+#define LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN \
+  lhd_pretty_print_print_struct_decl
+#define LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN \
+  lhd_pretty_print_op_prio
+
+#define LANG_HOOKS_PRETTY_PRINT_INITIALIZER { \
+  LANG_HOOKS_PRETTY_PRINT_CHAIN_FN, \
+  LANG_HOOKS_PRETTY_PRINT_NODE_FN, \
+  LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN, \
+  LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN, \
+  LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN, \
+  LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN \
+}
+
 /* Types hooks.  There are no reasonable defaults for most of them,
    so we create a compile-time error instead.  */
 #define LANG_HOOKS_MAKE_TYPE make_node
@@ -266,6 +300,7 @@ int lhd_tree_dump_type_quals			PARAMS ((
   LANG_HOOKS_TREE_DUMP_INITIALIZER, \
   LANG_HOOKS_DECLS, \
   LANG_HOOKS_FOR_TYPES_INITIALIZER, \
+  LANG_HOOKS_PRETTY_PRINT_INITIALIZER, \
   LANG_HOOKS_SIMPLIFY_FUNCTION_TREE \
 }
 
Index: langhooks.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.15.2.7
diff -d -u -p -r1.15.2.7 langhooks.h
--- langhooks.h	6 Jun 2002 03:52:19 -0000	1.15.2.7
+++ langhooks.h	9 Jun 2002 17:08:00 -0000
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA.  */
 /* This file should be #include-d after tree.h.  */
 
 struct diagnostic_context;
+struct output_buffer;
 
 /* A print hook for print_tree ().  */
 typedef void (*lang_print_tree_hook) PARAMS ((FILE *, tree, int indent));
@@ -171,6 +172,28 @@ struct lang_hooks_for_decls
   bool (*warn_unused_global) PARAMS ((tree));
 };
 
+/* Hooks for pretty printing.  */
+struct lang_hooks_for_pretty_print
+{
+  /* Function for pretty print an entire chain of statement nodes.  */
+  void (*print_chain) PARAMS ((struct output_buffer *, tree));
+  
+  /* Function for pretty print a node.  */
+  void (*print_node) PARAMS ((struct output_buffer *, tree));
+  
+  /* Function for pretty print a declaration node.  */
+  void (*print_declaration) PARAMS ((struct output_buffer *, tree));
+  
+  /* Function for pretty print a function declaration node.  */
+  void (*print_function_decl) PARAMS ((struct output_buffer *, tree));
+  
+  /* Function for pretty print a structure declaration node.  */
+  void (*print_struct_decl) PARAMS ((struct output_buffer *, tree));
+
+  /* Function for determining the priority of an operator.  */
+  int (*op_prio) PARAMS ((tree));
+};
+
 /* Language-specific hooks.  See langhooks-def.h for defaults.  */
 
 struct lang_hooks
@@ -350,6 +373,8 @@ struct lang_hooks
   struct lang_hooks_for_decls decls;
 
   struct lang_hooks_for_types types;
+
+  struct lang_hooks_for_pretty_print pretty_print;
 
   int (*simplify_function_tree) PARAMS ((tree));
 
Index: langhooks.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/langhooks.c,v
retrieving revision 1.14.2.6
diff -d -u -p -r1.14.2.6 langhooks.c
--- langhooks.c	6 Jun 2002 03:52:19 -0000	1.14.2.6
+++ langhooks.c	9 Jun 2002 17:08:00 -0000
@@ -422,6 +422,67 @@ lhd_tree_dump_type_quals (t)
   return TYPE_QUALS (t);
 }
 
+/* lang_hooks.pretty_print.print_chain: pretty prints an entire chain  
+   following the TREE_CHAIN information.  */
+
+void
+lhd_pretty_print_print_chain (buffer, stmt)
+     struct output_buffer *buffer ATTRIBUTE_UNUSED;
+     tree stmt ATTRIBUTE_UNUSED;
+{
+  return 0;
+}
+
+/* lang_hooks.pretty_print.print_node: pretty prints the given node.  */
+
+void
+lhd_pretty_print_print_node (buffer, node)
+     struct output_buffer *buffer ATTRIBUTE_UNUSED;
+     tree node ATTRIBUTE_UNUSED;
+{
+  return 0;
+}
+
+/* lang_hooks.pretty_print.print_declaration: pretty prints the given 
+   declaration node.  */
+
+void 
+lhd_pretty_print_print_declaration (buffer, node)
+     struct output_buffer *buffer ATTRIBUTE_UNUSED;
+     tree node ATTRIBUTE_UNUSED;
+{
+}
+
+/* lang_hooks.pretty_print.print_function_decl: pretty prints the given
+   function node.  */
+
+void 
+lhd_pretty_print_print_function_decl (buffer, node)
+     struct output_buffer *buffer ATTRIBUTE_UNUSED;
+     tree node ATTRIBUTE_UNUSED;
+{
+}
+
+/* lang_hooks.pretty_print.print_struct_decl: pretty prints the given 
+   structure node.  */
+
+void 
+lhd_pretty_print_print_struct_decl (buffer, node)
+     struct output_buffer *buffer ATTRIBUTE_UNUSED;
+     tree node ATTRIBUTE_UNUSED;
+{
+}
+
+/* lang_hooks.pretty_print.op_prio: determines the priority of an operator.  */
+
+int
+lhd_pretty_print_op_prio (node)
+     tree node ATTRIBUTE_UNUSED;
+{
+  /* Lowest priority.  */
+  return 1;
+}
+
 /* lang_hooks.simplify_function_tree re-writes the body of function FNDECL
    into SIMPLE form.  */
 
Index: simple-break-elim.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/simple-break-elim.c,v
retrieving revision 1.1.2.1
diff -d -u -p -r1.1.2.1 simple-break-elim.c
--- simple-break-elim.c	6 May 2002 15:53:44 -0000	1.1.2.1
+++ simple-break-elim.c	9 Jun 2002 17:08:02 -0000
@@ -713,7 +713,10 @@ outward_motion (parent, last_executed, l
 
 static void 
 update_break_paths (st1, st2, begin_stmt, end_stmt)
-     tree st1, st2, begin_stmt, end_stmt;
+     tree st1 ATTRIBUTE_UNUSED;
+     tree st2 ATTRIBUTE_UNUSED;
+     tree begin_stmt ATTRIBUTE_UNUSED;
+     tree end_stmt ATTRIBUTE_UNUSED;
 {
 }
 
Index: simple-goto-elim.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/simple-goto-elim.c,v
retrieving revision 1.1.2.1
diff -d -u -p -r1.1.2.1 simple-goto-elim.c
--- simple-goto-elim.c	6 May 2002 15:53:44 -0000	1.1.2.1
+++ simple-goto-elim.c	9 Jun 2002 17:08:05 -0000
@@ -1034,7 +1034,9 @@ label_hash_lookup (string, create)
 }
 
 
-#if 1
+#if 0
+#include "pretty-print.h"
+
 /* Debugging functions.  */
 static void debug_path                         PARAMS ((PATH_TYPE));
 static void debug_path_elt                     PARAMS ((PATH_TYPE));
@@ -1063,7 +1065,7 @@ debug_path_elt (elt)
      PATH_TYPE elt;
 {
   fprintf (stderr, "<path_node> \n");
-  debug_c_node (PATH_STMT (elt));
+  pretty_debug_node (PATH_STMT (elt));
   fprintf (stderr, "</path_node> \n");
 }
 
@@ -1080,7 +1082,7 @@ debug_goto_list (list)
       fprintf (stderr, "offset: %d\n", GOTO_OFFSET (it));
       fprintf (stderr, "level: %d\n", GOTO_LEVEL (it));
       fprintf (stderr, "if_stmt:\n");
-      debug_c_node (GOTO_IF_STMT (it));
+      pretty_debug_node (GOTO_IF_STMT (it));
       fprintf (stderr, "path:\n");
       debug_path (GOTO_PATH (it));
       fprintf (stderr, "===================================\n");
@@ -1098,7 +1100,7 @@ debug_label_hash_entry (entry)
   fprintf (stderr, "level: %d\n", LABEL_LEVEL (entry));
   fprintf (stderr, "label_id: %s\n", LABEL_ID (entry));
   fprintf (stderr, "label_stmt:\n");
-  debug_c_node (LABEL_LABEL_STMT (entry));
+  pretty_debug_node (LABEL_LABEL_STMT (entry));
   fprintf (stderr, "path:\n");
   debug_path (LABEL_PATH (entry));
   fprintf (stderr, "===================================\n");
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 tree-ssa-pre.c
--- tree-ssa-pre.c	5 Jun 2002 13:51:10 -0000	1.1.2.2
+++ tree-ssa-pre.c	9 Jun 2002 17:08:08 -0000
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "errors.h"
 #include "expr.h"
 #include "diagnostic.h"
+#include "pretty-print.h"
 #include "tree-optimize.h"
 #include "tree-simple.h"
 #include "tree-flow.h"
@@ -1264,11 +1265,11 @@ finalize_1 (ei, temp)
 		    {
 		      fprintf (dump_file, "In BB %d, insert save of ",
 			       EXPRREF_BB (X)->index);
-		      print_c_tree (dump_file, ei->expr);
+		      pretty_print_chain (dump_file, ei->expr);
 		      fprintf (dump_file, " to ");
-		      print_c_tree (dump_file, temp);
+		      pretty_print_chain (dump_file, temp);
 		      fprintf (dump_file, " after ");
-		      print_c_node (dump_file, BLOCK_END_TREE (EXPRREF_BB(X)->index));
+		      pretty_print_node (dump_file, BLOCK_END_TREE (EXPRREF_BB(X)->index));
 		      fprintf (dump_file, " (at end of BB), because of ExprPhi");
 		      fprintf (dump_file, " in BB %d\n", 
 			       EXPRREF_BB (phi)->index);
@@ -1630,11 +1631,11 @@ code_motion (ei, temp)
 		{
 		  fprintf (dump_file, "In BB %d, insert save of ", 
 			   use_bb->index);
-		  print_c_tree (dump_file, use_expr);
+		  pretty_print_chain (dump_file, use_expr);
 		  fprintf (dump_file, " to ");
-		  print_c_tree (dump_file, temp);
+		  pretty_print_chain (dump_file, temp);
 		  fprintf (dump_file, " in statement ");
-		  print_c_tree (dump_file, TREE_OPERAND (use_stmt, 0));
+		  pretty_print_chain (dump_file, TREE_OPERAND (use_stmt, 0));
 		  fprintf (dump_file, " on line %d\n", STMT_LINENO (use_stmt));
 		}
 	      newexpr = build_modify_expr (temp, NOP_EXPR, use_expr);
@@ -1649,11 +1650,11 @@ code_motion (ei, temp)
                 {
 		  fprintf (dump_file, "In BB %d, insert reload of ", 
 			   use_bb->index);
-                  print_c_tree (dump_file, use_expr);
+                  pretty_print_chain (dump_file, use_expr);
                   fprintf (dump_file, " from ");
-                  print_c_tree (dump_file, temp);
+                  pretty_print_chain (dump_file, temp);
                   fprintf (dump_file, " in statement ");
-                  print_c_tree (dump_file, TREE_OPERAND (use_stmt, 0));
+                  pretty_print_chain (dump_file, TREE_OPERAND (use_stmt, 0));
                   fprintf (dump_file, " on line %d\n", STMT_LINENO (use_stmt));
                 }
               replace_expr_in_tree (use_stmt, use_expr, temp);
@@ -1701,7 +1702,7 @@ pre_part_1_trav (slot, data)
   if (dump_file)
     {
       fprintf (dump_file, "Occurrences for expression ");
-      print_c_tree (dump_file, ei->expr);
+      pretty_print_chain (dump_file, ei->expr);
       fprintf (dump_file, "\n");
       dump_varref_list (dump_file, "", ei->refs, 0, 1);
     }
@@ -1710,7 +1711,7 @@ pre_part_1_trav (slot, data)
   if (dump_file)
     {
       fprintf (dump_file, "ExprPhi's for expression ");
-      print_c_tree (dump_file, ei->expr);
+      pretty_print_chain (dump_file, ei->expr);
       fprintf (dump_file, "\n");
       dump_varref_list (dump_file, "", ei->phis, 0, 1);
     }
@@ -1758,7 +1759,7 @@ tree_perform_ssapre ()
                IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
       
       if (dump_flags & TDF_UNPARSE)
-        print_c_tree (dump_file, fn);
+        pretty_print_chain (dump_file, fn);
       else
         dump_node (fn, TDF_SLIM | dump_flags, dump_file);
     }
@@ -1865,7 +1866,7 @@ tree_perform_ssapre ()
                IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
       
       if (dump_flags & TDF_UNPARSE)
-        print_c_tree (dump_file, fn);
+        pretty_print_chain (dump_file, fn);
       else
         dump_node (fn, TDF_SLIM | dump_flags, dump_file);
       dump_end (TDI_ssa_pre, dump_file);
Index: ./cp/Make-lang.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.88.2.14
diff -d -u -p -r1.88.2.14 Make-lang.in
--- ./cp/Make-lang.in	3 Jun 2002 22:00:33 -0000	1.88.2.14
+++ ./cp/Make-lang.in	9 Jun 2002 17:08:08 -0000
@@ -98,14 +98,14 @@ $(DEMANGLER_PROG): cxxmain.o underscore.
 CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
  $(CXX_TARGET_OBJS) \
   tree-cfg.o tree-dfa.o tree-optimize.o tree-ssa.o tree-ssa-pre.o c-simplify.o \
-  c-pretty-print.o tree-simple.o
+  pretty-print.o c-pretty-print.o tree-simple.o
 
 # Language-specific object files.
 CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
  cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parse.o cp/ptree.o cp/rtti.o \
  cp/spew.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o \
  cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o \
- cp/optimize.o cp/mangle.o cp/cp-lang.o
+ cp/optimize.o cp/mangle.o cp/cp-lang.o cp/cp-pretty-print.o
 
 # Use loose warnings for this front end.
 cp-warn =
@@ -249,6 +249,8 @@ CXX_TREE_H = $(TREE_H) cp/cp-tree.h c-co
 	function.h varray.h $(SYSTEM_H) $(CONFIG_H) $(TARGET_H) \
 	$(srcdir)/../include/hashtab.h $(srcdir)/../include/splay-tree.h
 
+cp/cp-pretty-print.o: cp/cp-pretty-print.c $(CXX_TREE_H) pretty-print.h \
+  diagnostic.h langhooks.h langhooks-def.h 
 cp/spew.o: cp/spew.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h toplev.h
 cp/lex.o: cp/lex.c $(CXX_TREE_H) cp/parse.h flags.h cp/lex.h c-pragma.h \
   toplev.h output.h mbchar.h $(GGC_H) input.h diagnostic.h cp/operators.def \
Index: ./cp/cp-lang.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.9.2.6
diff -d -u -p -r1.9.2.6 cp-lang.c
--- ./cp/cp-lang.c	29 May 2002 15:06:30 -0000	1.9.2.6
+++ ./cp/cp-lang.c	9 Jun 2002 17:08:09 -0000
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 #include "cp-tree.h"
 #include "c-common.h"
 #include "toplev.h"
+#include "pretty-print.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
 
@@ -151,6 +152,20 @@ static bool cxx_warn_unused_global_decl 
 #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR cxx_incomplete_type_error
 #undef LANG_HOOKS_TYPE_PROMOTES_TO
 #define LANG_HOOKS_TYPE_PROMOTES_TO cxx_type_promotes_to
+
+#undef LANG_HOOKS_PRETTY_PRINT_CHAIN_FN
+#define LANG_HOOKS_PRETTY_PRINT_CHAIN_FN cp_pretty_print_chain
+#undef LANG_HOOKS_PRETTY_PRINT_NODE_FN 
+#define LANG_HOOKS_PRETTY_PRINT_NODE_FN cp_pretty_print_node
+#undef LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN 
+#define LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN cp_pretty_print_declaration
+#undef LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN cp_pretty_print_function_decl
+#undef LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN cp_pretty_print_struct_decl
+#undef LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN
+#define LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN cp_op_prio
+
 
 /* Each front end provides its own hooks, for toplev.c.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
Index: ./objc/Make-lang.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/objc/Make-lang.in,v
retrieving revision 1.34.6.4
diff -d -u -p -r1.34.6.4 Make-lang.in
--- ./objc/Make-lang.in	29 May 2002 15:07:32 -0000	1.34.6.4
+++ ./objc/Make-lang.in	9 Jun 2002 17:08:09 -0000
@@ -48,12 +48,20 @@ OBJECTIVE-C objective-c: cc1obj$(exeext)
 objc-warn = $(STRICT_WARN)
 
 # Language-specific object files for Objective C.
-OBJC_OBJS = objc-lang.o objc-parse.o objc-act.o $(C_AND_OBJC_OBJS)
+OBJC_OBJS = objc-lang.o objc-parse.o objc-act.o objc-pretty-print.o \
+  $(C_AND_OBJC_OBJS)
 
 cc1obj$(exeext): $(OBJC_OBJS) $(BACKEND) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(BACKEND) $(LIBS)
 
 # Objective C language specific files.
+
+objc-pretty-print.o : $(srcdir)/objc/objc-pretty-print.c \
+   $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(srcdir)/c-tree.h \
+   $(srcdir)/c-common.h $(srcdir)/diagnostic.h $(srcdir)/pretty-print.h \
+   $(srcdir)/objc/objc-act.h $(srcdir)/langhooks.h $(srcdir)/langhooks-def.h
+	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
+	-c $(srcdir)/objc/objc-pretty-print.c $(OUTPUT_OPTION)
 
 objc-lang.o : $(srcdir)/objc/objc-lang.c \
    $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(srcdir)/c-tree.h \
Index: ./objc/objc-lang.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.2.4.5
diff -d -u -p -r1.2.4.5 objc-lang.c
--- ./objc/objc-lang.c	29 May 2002 15:07:36 -0000	1.2.4.5
+++ ./objc/objc-lang.c	9 Jun 2002 17:08:09 -0000
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA.  */
 #include "c-tree.h"
 #include "c-common.h"
 #include "toplev.h"
+#include "pretty-print.h"
 #include "objc-act.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
@@ -111,6 +112,19 @@ static void objc_init_options           
 #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
 #undef LANG_HOOKS_TYPE_PROMOTES_TO
 #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
+
+#undef LANG_HOOKS_PRETTY_PRINT_CHAIN_FN
+#define LANG_HOOKS_PRETTY_PRINT_CHAIN_FN objc_pretty_print_chain
+#undef LANG_HOOKS_PRETTY_PRINT_NODE_FN 
+#define LANG_HOOKS_PRETTY_PRINT_NODE_FN objc_pretty_print_node
+#undef LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN 
+#define LANG_HOOKS_PRETTY_PRINT_DECLARATION_FN c_pretty_print_declaration
+#undef LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_FUNCTION_DECL_FN c_pretty_print_function_decl
+#undef LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN
+#define LANG_HOOKS_PRETTY_PRINT_STRUCT_DECL_FN c_pretty_print_struct_decl
+#undef LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN
+#define LANG_HOOKS_PRETTY_PRINT_OP_PRIO_FN c_op_prio
 
 /* Each front end provides its own hooks, for toplev.c.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newfiles.tar.gz
Type: application/x-gzip
Size: 4778 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20020609/0fe7133f/attachment.bin>


More information about the Gcc-patches mailing list