GCC Middle and Back End API Reference
tree-pretty-print.c File Reference

Functions

static const char * op_symbol (const_tree)
static void pretty_print_string (pretty_printer *, const char *)
static void newline_and_indent (pretty_printer *, int)
static void maybe_init_pretty_print (FILE *)
static void print_struct_decl (pretty_printer *, const_tree, int, int)
static void do_niy (pretty_printer *, const_tree)
static void do_niy ()
DEBUG_FUNCTION void debug_generic_expr ()
DEBUG_FUNCTION void debug_generic_stmt ()
DEBUG_FUNCTION void debug_tree_chain ()
void print_generic_decl ()
void print_generic_stmt ()
void print_generic_stmt_indented ()
void print_generic_expr ()
static void dump_decl_name ()
static void dump_function_name ()
static void dump_function_declaration (pretty_printer *buffer, tree node, int spc, int flags)
static void dump_array_domain ()
static void dump_omp_clause ()
void dump_omp_clauses ()
static void dump_location ()
static void dump_block_node ()
int dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, bool is_stmt)
void print_declaration ()
static void print_struct_decl ()
int op_code_prio ()
int op_prio ()
const char * op_symbol_code ()
static const char * op_symbol ()
void print_call_name ()
static void pretty_print_string ()
static void maybe_init_pretty_print ()
static void newline_and_indent ()
void percent_K_format ()
void pp_tree_identifier ()
void dump_function_header ()
void pp_double_int ()

Variables

static pretty_printer buffer
static int initialized = 0

Function Documentation

DEBUG_FUNCTION void debug_generic_expr ( )
   Debugging function to print out a generic expression.  

Referenced by build_ssa_operands(), and valid_fixed_convert_types_p().

DEBUG_FUNCTION void debug_generic_stmt ( )
   Debugging function to print out a generic statement.  

References pointer_set_create().

Referenced by verify_gimple_assign_ternary(), and verify_types_in_gimple_min_lval().

DEBUG_FUNCTION void debug_tree_chain ( )
   Debugging function to print out a chain of trees .  
static void do_niy ( pretty_printer ,
const_tree   
)
static
static void do_niy ( )
static
   Try to print something for an unknown tree code.  
static void dump_array_domain ( )
static
   Dump the domain associated with an array.  
static void dump_block_node ( )
static
   Dump lexical block BLOCK.  BUFFER, SPC and FLAGS are as in
   dump_generic_node.  

References dump_generic_node(), newline_and_indent(), and pp_string().

static void dump_decl_name ( )
static
   Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
   in FLAGS.  
static void dump_function_declaration ( pretty_printer buffer,
tree  node,
int  spc,
int  flags 
)
static
   Dump a function declaration.  NODE is the FUNCTION_TYPE.  BUFFER, SPC and
   FLAGS are as in dump_generic_node.  
     Print the argument types.  
     Drop the trailing void_type_node if we had any previous argument.  
     Properly dump vararg function types.  
     Avoid printing any arg for unprototyped functions.  
void dump_function_header ( )
   A helper function that is used to dump function information before the
   function dump.  

Referenced by leaf_renumber_regs().

static void dump_function_name ( )
static
   Like the above, but used for pretty printing function calls.  
int dump_generic_node ( pretty_printer buffer,
tree  node,
int  spc,
int  flags,
bool  is_stmt 
)
   Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
   indent.  FLAGS specifies details to show in the dump (see TDF_* in
   dumpfile.h).  If IS_STMT is true, the object printed is considered
   to be a statement and it is terminated by ';' if appropriate.  
               Dump the types of INTEGER_CSTs explicitly, for we can't
               infer them and MEM_ATTR caching will share MEM_REFs
               with differently-typed op0s.  
               Released SSA_NAMES have no TREE_TYPE.  
               Same pointer types, but ignoring POINTER_TYPE vs.
               REFERENCE_TYPE.  
               Same value types ignoring qualifiers.  
           Print the innermost component type.  
           Print the dimensions.  
           Print the name of the structure.  
             FIXME: If we eliminate the 'else' above and attempt
             to show the fields for named types, we may get stuck
             following a cycle of pointers to structs.  The alleged
             self-reference check in print_struct_decl will not detect
             cycles involving more than one pointer or struct type.  
             In the case of a pointer, one may want to divide by the
             size of the pointed-to type.  Unfortunately, this not
             straightforward.  The C front-end maps expressions

             (int *) 5
             int *p; (p + 5)

             in such a way that the two INTEGER_CST nodes for "5" have
             different values but identical types.  In the latter
             case, the 5 is multiplied by sizeof (int) in c-common.c
             (pointer_int_sum) to convert it to a byte address, and
             yet the type of the node is left unchanged.  Argh.  What
             is consistent though is that the number value corresponds
             to bytes (UNITS) offset.

             NB: Neither of the following divisors can be trivially
             used to recover the original literal:

             TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
             TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node)))  
         Code copied from print_node.  
             Don't print the declaration of built-in types.  
                 The type is a c++ class: all structures have at least
                 4 methods.  
                     Dump the types of INTEGER_CSTs explicitly, for we
                     can't infer them and MEM_ATTR caching will share
                     MEM_REFs with differently-typed op0s.  
                     Released SSA_NAMES have no TREE_TYPE.  
                     Same pointer types, but ignoring POINTER_TYPE vs.
                     REFERENCE_TYPE.  
                     Same value types ignoring qualifiers.  
             The lowered cond_exprs should always be printed in full.  
                 Output COND_EXPR_THEN.  
                 Output COND_EXPR_ELSE.  
         Print parameters.  
         Binary arithmetic and logic expressions.  
           When the operands are expressions with less priority,
           keep semantics of the tree representation.  
           When the operands are expressions with less priority,
           keep semantics of the tree representation.  
         Unary arithmetic and logic expressions.  
         If this is for break or continue, don't bother printing it.  

Referenced by dump_block_node(), dump_gimple_fmt(), dump_gimple_omp_block(), dump_gimple_omp_parallel(), dump_gimple_omp_return(), dump_gimple_omp_teams(), dump_ssaname_info(), print_generic_decl(), and print_generic_stmt().

static void dump_location ( )
static
   Dump location LOC to BUFFER.  
static void dump_omp_clause ( )
static
   Dump OpenMP clause CLAUSE.  BUFFER, CLAUSE, SPC and FLAGS are as in
   dump_generic_node.  
         Should never happen.  
void dump_omp_clauses ( )
   Dump the list of OpenMP clauses.  BUFFER, SPC and FLAGS are as in
   dump_generic_node.  

References expand_location(), and pp_string().

Referenced by dump_gimple_debug(), dump_gimple_omp_parallel(), and dump_gimple_omp_teams().

static void maybe_init_pretty_print ( FILE *  )
static
static void maybe_init_pretty_print ( )
static
static void newline_and_indent ( pretty_printer ,
int   
)
static
static void newline_and_indent ( )
static
int op_code_prio ( )
   Return the priority of the operator CODE.

   From lowest to highest precedence with either left-to-right (L-R)
   or right-to-left (R-L) associativity]:

     1  [L-R] ,
     2  [R-L] = += -= *= /= %= &= ^= |= <<= >>=
     3  [R-L] ?:
     4  [L-R] ||
     5  [L-R] &&
     6  [L-R] |
     7  [L-R] ^
     8  [L-R] &
     9  [L-R] == !=
    10  [L-R] < <= > >=
    11  [L-R] << >>
    12  [L-R] + -
    13  [L-R] * / %
    14  [R-L] ! ~ ++ -- + - * & (type) sizeof
    15  [L-R] fn() [] -> .

   unary +, - and * have higher precedence than the corresponding binary
   operators.  
         Special expressions.  
         Return an arbitrarily high precedence to avoid surrounding single
         VAR_DECLs in ()s.  
int op_prio ( )
   Return the priority of the operator OP.  
static const char* op_symbol ( const_tree  )
static
@verbatim 

Pretty formatting of GENERIC trees in C syntax. Copyright (C) 2001-2013 Free Software Foundation, Inc. Adapted from c-pretty-print.c by Diego Novillo dnovi.nosp@m.llo@.nosp@m.redha.nosp@m.t.co.nosp@m.m

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

   Local functions, macros and variables.  
static const char* op_symbol ( )
static
   Return the symbol associated with operator OP.  

References pp_string().

const char* op_symbol_code ( )
   Return the symbol associated with operator CODE.  
void percent_K_format ( )
@verbatim 

Handle a K format for TEXT. Separate from default_tree_printer so it can also be used in front ends. K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.

void pp_double_int ( )
   Dump double_int D to pretty_printer PP.  UNS is true
   if D is unsigned and false otherwise.  
         Would "%x%0*x" or "%x%*0x" get zero-padding on all
         systems?  
void pp_tree_identifier ( )
   Print the identifier ID to PRETTY-PRINTER.  

Referenced by asan_clear_shadow(), and print_generic_expr().

static void pretty_print_string ( pretty_printer ,
const char *   
)
static
static void pretty_print_string ( )
static
   Parses the string STR and replaces new-lines by '\n', tabs by '\t', ...  
             No need to handle \0; the loop terminates on \0.  
void print_call_name ( )
   Prints the name of a call.  NODE is the CALL_EXPR_FN of a CALL_EXPR or
   the gimple_call_fn of a GIMPLE_CALL.  
         Fallthru.  
void print_declaration ( )
   Print the declaration of a variable.  
     Print the type and name.  
         Print array's type.  
         Print variable's name.  
         Print the dimensions.  
         Print type declaration.  
         Print variable's name.  
     The initial value of a function serves to determine whether the function
     is declared or defined.  So the following does not apply to function
     nodes.  
         Print the initial value.  

Referenced by dump_gimple_goto().

void print_generic_decl ( )
   Prints declaration DECL to the FILE with details specified by FLAGS.  

References dump_generic_node(), maybe_init_pretty_print(), and pp_newline_and_flush().

void print_generic_stmt ( )
   Print tree T, and its successors, on file FILE.  FLAGS specifies details
   to show in the dump.  See TDF_* in dumpfile.h.  

References dump_generic_node(), indent, and maybe_init_pretty_print().

Referenced by get_unary_op().

void print_generic_stmt_indented ( )
   Print tree T, and its successors, on file FILE.  FLAGS specifies details
   to show in the dump.  See TDF_* in dumpfile.h.  The output is indented by
   INDENT spaces.  
static void print_struct_decl ( pretty_printer ,
const_tree  ,
int  ,
int   
)
static
static void print_struct_decl ( )
static
   Prints a structure: name, fields, and methods.
   FIXME: Still incomplete.  
     Print the name of the structure.  
     Print the contents of the structure.  
     Print the fields of the structure.  
           Avoid to print recursively the structure.  
           FIXME : Not implemented correctly...,
           what about the case when we have a cycle in the contain graph? ...
           Maybe this could be solved by looking at the scope in which the
           structure was declared.  

Variable Documentation

int initialized = 0
static