Home | History | Annotate | Line # | Download | only in gcc
dumpfile.h revision 1.1.1.1
      1  1.1  mrg /* Definitions for the shared dumpfile.
      2  1.1  mrg    Copyright (C) 2004-2013 Free Software Foundation, Inc.
      3  1.1  mrg 
      4  1.1  mrg This file is part of GCC.
      5  1.1  mrg 
      6  1.1  mrg GCC is free software; you can redistribute it and/or modify
      7  1.1  mrg it under the terms of the GNU General Public License as published by
      8  1.1  mrg the Free Software Foundation; either version 3, or (at your option)
      9  1.1  mrg any later version.
     10  1.1  mrg 
     11  1.1  mrg GCC is distributed in the hope that it will be useful,
     12  1.1  mrg but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  1.1  mrg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14  1.1  mrg GNU General Public License for more details.
     15  1.1  mrg 
     16  1.1  mrg You should have received a copy of the GNU General Public License
     17  1.1  mrg along with GCC; see the file COPYING3.  If not see
     18  1.1  mrg <http://www.gnu.org/licenses/>.  */
     19  1.1  mrg 
     20  1.1  mrg 
     21  1.1  mrg #ifndef GCC_DUMPFILE_H
     22  1.1  mrg #define GCC_DUMPFILE_H 1
     23  1.1  mrg 
     24  1.1  mrg #include "line-map.h"
     25  1.1  mrg 
     26  1.1  mrg /* Different tree dump places.  When you add new tree dump places,
     27  1.1  mrg    extend the DUMP_FILES array in dumpfile.c.  */
     28  1.1  mrg enum tree_dump_index
     29  1.1  mrg {
     30  1.1  mrg   TDI_none,			/* No dump */
     31  1.1  mrg   TDI_cgraph,                   /* dump function call graph.  */
     32  1.1  mrg   TDI_tu,			/* dump the whole translation unit.  */
     33  1.1  mrg   TDI_class,			/* dump class hierarchy.  */
     34  1.1  mrg   TDI_original,			/* dump each function before optimizing it */
     35  1.1  mrg   TDI_generic,			/* dump each function after genericizing it */
     36  1.1  mrg   TDI_nested,			/* dump each function after unnesting it */
     37  1.1  mrg   TDI_tree_all,                 /* enable all the GENERIC/GIMPLE dumps.  */
     38  1.1  mrg   TDI_rtl_all,                  /* enable all the RTL dumps.  */
     39  1.1  mrg   TDI_ipa_all,                  /* enable all the IPA dumps.  */
     40  1.1  mrg 
     41  1.1  mrg   TDI_end
     42  1.1  mrg };
     43  1.1  mrg 
     44  1.1  mrg /* Bit masks to control dumping. Not all values are applicable to all
     45  1.1  mrg    dumps. Add new ones at the end. When you define new values, extend
     46  1.1  mrg    the DUMP_OPTIONS array in dumpfile.c. The TDF_* flags coexist with
     47  1.1  mrg    MSG_* flags (for -fopt-info) and the bit values must be chosen to
     48  1.1  mrg    allow that.  */
     49  1.1  mrg #define TDF_ADDRESS	(1 << 0)	/* dump node addresses */
     50  1.1  mrg #define TDF_SLIM	(1 << 1)	/* don't go wild following links */
     51  1.1  mrg #define TDF_RAW  	(1 << 2)	/* don't unparse the function */
     52  1.1  mrg #define TDF_DETAILS	(1 << 3)	/* show more detailed info about
     53  1.1  mrg 					   each pass */
     54  1.1  mrg #define TDF_STATS	(1 << 4)	/* dump various statistics about
     55  1.1  mrg 					   each pass */
     56  1.1  mrg #define TDF_BLOCKS	(1 << 5)	/* display basic block boundaries */
     57  1.1  mrg #define TDF_VOPS	(1 << 6)	/* display virtual operands */
     58  1.1  mrg #define TDF_LINENO	(1 << 7)	/* display statement line numbers */
     59  1.1  mrg #define TDF_UID		(1 << 8)	/* display decl UIDs */
     60  1.1  mrg 
     61  1.1  mrg #define TDF_TREE	(1 << 9)	/* is a tree dump */
     62  1.1  mrg #define TDF_RTL		(1 << 10)	/* is a RTL dump */
     63  1.1  mrg #define TDF_IPA		(1 << 11)	/* is an IPA dump */
     64  1.1  mrg #define TDF_STMTADDR	(1 << 12)	/* Address of stmt.  */
     65  1.1  mrg 
     66  1.1  mrg #define TDF_GRAPH	(1 << 13)	/* a graph dump is being emitted */
     67  1.1  mrg #define TDF_MEMSYMS	(1 << 14)	/* display memory symbols in expr.
     68  1.1  mrg                                            Implies TDF_VOPS.  */
     69  1.1  mrg 
     70  1.1  mrg #define TDF_DIAGNOSTIC	(1 << 15)	/* A dump to be put in a diagnostic
     71  1.1  mrg 					   message.  */
     72  1.1  mrg #define TDF_VERBOSE     (1 << 16)       /* A dump that uses the full tree
     73  1.1  mrg 					   dumper to print stmts.  */
     74  1.1  mrg #define TDF_RHS_ONLY	(1 << 17)	/* a flag to only print the RHS of
     75  1.1  mrg 					   a gimple stmt.  */
     76  1.1  mrg #define TDF_ASMNAME	(1 << 18)	/* display asm names of decls  */
     77  1.1  mrg #define TDF_EH		(1 << 19)	/* display EH region number
     78  1.1  mrg 					   holding this gimple statement.  */
     79  1.1  mrg #define TDF_NOUID	(1 << 20)	/* omit UIDs from dumps.  */
     80  1.1  mrg #define TDF_ALIAS	(1 << 21)	/* display alias information  */
     81  1.1  mrg #define TDF_ENUMERATE_LOCALS (1 << 22)	/* Enumerate locals by uid.  */
     82  1.1  mrg #define TDF_CSELIB	(1 << 23)	/* Dump cselib details.  */
     83  1.1  mrg #define TDF_SCEV	(1 << 24)	/* Dump SCEV details.  */
     84  1.1  mrg #define TDF_COMMENT	(1 << 25)	/* Dump lines with prefix ";;"  */
     85  1.1  mrg #define MSG_OPTIMIZED_LOCATIONS  (1 << 26)  /* -fopt-info optimized sources */
     86  1.1  mrg #define MSG_MISSED_OPTIMIZATION  (1 << 27)  /* missed opportunities */
     87  1.1  mrg #define MSG_NOTE                 (1 << 28)  /* general optimization info */
     88  1.1  mrg #define MSG_ALL         (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
     89  1.1  mrg                          | MSG_NOTE)
     90  1.1  mrg 
     91  1.1  mrg 
     92  1.1  mrg /* Flags to control high-level -fopt-info dumps.  Usually these flags
     93  1.1  mrg    define a group of passes.  An optimization pass can be part of
     94  1.1  mrg    multiple groups.  */
     95  1.1  mrg #define OPTGROUP_NONE        (0)
     96  1.1  mrg #define OPTGROUP_IPA         (1 << 1)   /* IPA optimization passes */
     97  1.1  mrg #define OPTGROUP_LOOP        (1 << 2)   /* Loop optimization passes */
     98  1.1  mrg #define OPTGROUP_INLINE      (1 << 3)   /* Inlining passes */
     99  1.1  mrg #define OPTGROUP_VEC         (1 << 4)   /* Vectorization passes */
    100  1.1  mrg #define OPTGROUP_ALL	     (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
    101  1.1  mrg                               | OPTGROUP_VEC)
    102  1.1  mrg 
    103  1.1  mrg /* Define a tree dump switch.  */
    104  1.1  mrg struct dump_file_info
    105  1.1  mrg {
    106  1.1  mrg   const char *suffix;           /* suffix to give output file.  */
    107  1.1  mrg   const char *swtch;            /* command line dump switch */
    108  1.1  mrg   const char *glob;             /* command line glob  */
    109  1.1  mrg   const char *pfilename;        /* filename for the pass-specific stream  */
    110  1.1  mrg   const char *alt_filename;     /* filename for the -fopt-info stream  */
    111  1.1  mrg   FILE *pstream;                /* pass-specific dump stream  */
    112  1.1  mrg   FILE *alt_stream;             /* -fopt-info stream */
    113  1.1  mrg   int pflags;                   /* dump flags */
    114  1.1  mrg   int optgroup_flags;           /* optgroup flags for -fopt-info */
    115  1.1  mrg   int alt_flags;                /* flags for opt-info */
    116  1.1  mrg   int pstate;                   /* state of pass-specific stream */
    117  1.1  mrg   int alt_state;                /* state of the -fopt-info stream */
    118  1.1  mrg   int num;                      /* dump file number */
    119  1.1  mrg };
    120  1.1  mrg 
    121  1.1  mrg /* In dumpfile.c */
    122  1.1  mrg extern char *get_dump_file_name (int);
    123  1.1  mrg extern int dump_initialized_p (int);
    124  1.1  mrg extern FILE *dump_begin (int, int *);
    125  1.1  mrg extern void dump_end (int, FILE *);
    126  1.1  mrg extern int dump_start (int, int *);
    127  1.1  mrg extern void dump_finish (int);
    128  1.1  mrg extern void dump_node (const_tree, int, FILE *);
    129  1.1  mrg extern int dump_switch_p (const char *);
    130  1.1  mrg extern int opt_info_switch_p (const char *);
    131  1.1  mrg extern const char *dump_flag_name (int);
    132  1.1  mrg extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2;
    133  1.1  mrg extern void dump_printf_loc (int, source_location,
    134  1.1  mrg                              const char *, ...) ATTRIBUTE_PRINTF_3;
    135  1.1  mrg extern void dump_basic_block (int, basic_block, int);
    136  1.1  mrg extern void dump_generic_expr_loc (int, source_location, int, tree);
    137  1.1  mrg extern void dump_generic_expr (int, int, tree);
    138  1.1  mrg extern void dump_gimple_stmt_loc (int, source_location, int, gimple, int);
    139  1.1  mrg extern void dump_gimple_stmt (int, int, gimple, int);
    140  1.1  mrg extern void print_combine_total_stats (void);
    141  1.1  mrg extern unsigned int dump_register (const char *, const char *, const char *,
    142  1.1  mrg                                    int, int);
    143  1.1  mrg extern bool enable_rtl_dump_file (void);
    144  1.1  mrg 
    145  1.1  mrg /* In combine.c  */
    146  1.1  mrg extern void dump_combine_total_stats (FILE *);
    147  1.1  mrg /* In cfghooks.c  */
    148  1.1  mrg extern void dump_bb (FILE *, basic_block, int, int);
    149  1.1  mrg 
    150  1.1  mrg /* Global variables used to communicate with passes.  */
    151  1.1  mrg extern FILE *dump_file;
    152  1.1  mrg extern FILE *alt_dump_file;
    153  1.1  mrg extern int dump_flags;
    154  1.1  mrg extern const char *dump_file_name;
    155  1.1  mrg 
    156  1.1  mrg /* Return the dump_file_info for the given phase.  */
    157  1.1  mrg extern struct dump_file_info *get_dump_file_info (int);
    158  1.1  mrg 
    159  1.1  mrg /* Return true if any of the dumps is enabled, false otherwise. */
    160  1.1  mrg static inline bool
    161  1.1  mrg dump_enabled_p (void)
    162  1.1  mrg {
    163  1.1  mrg   return (dump_file || alt_dump_file);
    164  1.1  mrg }
    165  1.1  mrg 
    166  1.1  mrg #endif /* GCC_DUMPFILE_H */
    167