1*e4b17023SJohn Marino /* Instruction scheduling pass. Log dumping infrastructure. 2*e4b17023SJohn Marino Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc. 3*e4b17023SJohn Marino 4*e4b17023SJohn Marino This file is part of GCC. 5*e4b17023SJohn Marino 6*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under 7*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free 8*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later 9*e4b17023SJohn Marino version. 10*e4b17023SJohn Marino 11*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY 12*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or 13*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14*e4b17023SJohn Marino for more details. 15*e4b17023SJohn Marino 16*e4b17023SJohn Marino You should have received a copy of the GNU General Public License 17*e4b17023SJohn Marino along with GCC; see the file COPYING3. If not see 18*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */ 19*e4b17023SJohn Marino 20*e4b17023SJohn Marino 21*e4b17023SJohn Marino #ifndef GCC_SEL_SCHED_DUMP_H 22*e4b17023SJohn Marino #define GCC_SEL_SCHED_DUMP_H 23*e4b17023SJohn Marino 24*e4b17023SJohn Marino #include "sel-sched-ir.h" 25*e4b17023SJohn Marino 26*e4b17023SJohn Marino 27*e4b17023SJohn Marino /* These values control the dumping of control flow graph to the .dot file. */ 28*e4b17023SJohn Marino enum sel_dump_cfg_def 29*e4b17023SJohn Marino { 30*e4b17023SJohn Marino /* Dump only current region. */ 31*e4b17023SJohn Marino SEL_DUMP_CFG_CURRENT_REGION = 2, 32*e4b17023SJohn Marino 33*e4b17023SJohn Marino /* Dump note_list for this bb. */ 34*e4b17023SJohn Marino SEL_DUMP_CFG_BB_NOTES_LIST = 4, 35*e4b17023SJohn Marino 36*e4b17023SJohn Marino /* Dump availability set from the bb header. */ 37*e4b17023SJohn Marino SEL_DUMP_CFG_AV_SET = 8, 38*e4b17023SJohn Marino 39*e4b17023SJohn Marino /* Dump liveness set from the bb header. */ 40*e4b17023SJohn Marino SEL_DUMP_CFG_LV_SET = 16, 41*e4b17023SJohn Marino 42*e4b17023SJohn Marino /* Dump insns of the given block. */ 43*e4b17023SJohn Marino SEL_DUMP_CFG_BB_INSNS = 32, 44*e4b17023SJohn Marino 45*e4b17023SJohn Marino /* Show current fences when dumping cfg. */ 46*e4b17023SJohn Marino SEL_DUMP_CFG_FENCES = 64, 47*e4b17023SJohn Marino 48*e4b17023SJohn Marino /* Show insn's seqnos when dumping cfg. */ 49*e4b17023SJohn Marino SEL_DUMP_CFG_INSN_SEQNO = 128, 50*e4b17023SJohn Marino 51*e4b17023SJohn Marino /* Dump function name when dumping cfg. */ 52*e4b17023SJohn Marino SEL_DUMP_CFG_FUNCTION_NAME = 256, 53*e4b17023SJohn Marino 54*e4b17023SJohn Marino /* Dump loop father number of the given bb. */ 55*e4b17023SJohn Marino SEL_DUMP_CFG_BB_LOOP = 512, 56*e4b17023SJohn Marino 57*e4b17023SJohn Marino /* The default flags for cfg dumping. */ 58*e4b17023SJohn Marino SEL_DUMP_CFG_FLAGS = (SEL_DUMP_CFG_CURRENT_REGION 59*e4b17023SJohn Marino | SEL_DUMP_CFG_BB_NOTES_LIST 60*e4b17023SJohn Marino | SEL_DUMP_CFG_AV_SET 61*e4b17023SJohn Marino | SEL_DUMP_CFG_LV_SET 62*e4b17023SJohn Marino | SEL_DUMP_CFG_BB_INSNS 63*e4b17023SJohn Marino | SEL_DUMP_CFG_FENCES 64*e4b17023SJohn Marino | SEL_DUMP_CFG_INSN_SEQNO 65*e4b17023SJohn Marino | SEL_DUMP_CFG_BB_LOOP) 66*e4b17023SJohn Marino }; 67*e4b17023SJohn Marino 68*e4b17023SJohn Marino /* These values control the dumping of insns containing in expressions. */ 69*e4b17023SJohn Marino enum dump_insn_rtx_def 70*e4b17023SJohn Marino { 71*e4b17023SJohn Marino /* Dump insn's UID. */ 72*e4b17023SJohn Marino DUMP_INSN_RTX_UID = 2, 73*e4b17023SJohn Marino 74*e4b17023SJohn Marino /* Dump insn's pattern. */ 75*e4b17023SJohn Marino DUMP_INSN_RTX_PATTERN = 4, 76*e4b17023SJohn Marino 77*e4b17023SJohn Marino /* Dump insn's basic block number. */ 78*e4b17023SJohn Marino DUMP_INSN_RTX_BBN = 8, 79*e4b17023SJohn Marino 80*e4b17023SJohn Marino /* Dump all of the above. */ 81*e4b17023SJohn Marino DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN 82*e4b17023SJohn Marino | DUMP_INSN_RTX_BBN) 83*e4b17023SJohn Marino }; 84*e4b17023SJohn Marino 85*e4b17023SJohn Marino extern void dump_insn_rtx_1 (rtx, int); 86*e4b17023SJohn Marino extern void dump_insn_rtx (rtx); 87*e4b17023SJohn Marino extern void debug_insn_rtx (rtx); 88*e4b17023SJohn Marino 89*e4b17023SJohn Marino /* These values control dumping of vinsns. The meaning of different fields 90*e4b17023SJohn Marino of a vinsn is explained in sel-sched-ir.h. */ 91*e4b17023SJohn Marino enum dump_vinsn_def 92*e4b17023SJohn Marino { 93*e4b17023SJohn Marino /* Dump the insn behind this vinsn. */ 94*e4b17023SJohn Marino DUMP_VINSN_INSN_RTX = 2, 95*e4b17023SJohn Marino 96*e4b17023SJohn Marino /* Dump vinsn's type. */ 97*e4b17023SJohn Marino DUMP_VINSN_TYPE = 4, 98*e4b17023SJohn Marino 99*e4b17023SJohn Marino /* Dump vinsn's count. */ 100*e4b17023SJohn Marino DUMP_VINSN_COUNT = 8, 101*e4b17023SJohn Marino 102*e4b17023SJohn Marino /* Dump the cost (default latency) of the insn behind this vinsn. */ 103*e4b17023SJohn Marino DUMP_VINSN_COST = 16, 104*e4b17023SJohn Marino 105*e4b17023SJohn Marino /* Dump all of the above. */ 106*e4b17023SJohn Marino DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT 107*e4b17023SJohn Marino | DUMP_VINSN_COST) 108*e4b17023SJohn Marino }; 109*e4b17023SJohn Marino 110*e4b17023SJohn Marino extern void dump_vinsn_1 (vinsn_t, int); 111*e4b17023SJohn Marino extern void dump_vinsn (vinsn_t); 112*e4b17023SJohn Marino extern void debug_vinsn (vinsn_t); 113*e4b17023SJohn Marino 114*e4b17023SJohn Marino /* These values control dumping of expressions. The meaning of the fields 115*e4b17023SJohn Marino is explained in sel-sched-ir.h. */ 116*e4b17023SJohn Marino enum dump_expr_def 117*e4b17023SJohn Marino { 118*e4b17023SJohn Marino /* Dump the vinsn behind this expression. */ 119*e4b17023SJohn Marino DUMP_EXPR_VINSN = 2, 120*e4b17023SJohn Marino 121*e4b17023SJohn Marino /* Dump expression's SPEC parameter. */ 122*e4b17023SJohn Marino DUMP_EXPR_SPEC = 4, 123*e4b17023SJohn Marino 124*e4b17023SJohn Marino /* Dump expression's priority. */ 125*e4b17023SJohn Marino DUMP_EXPR_PRIORITY = 8, 126*e4b17023SJohn Marino 127*e4b17023SJohn Marino /* Dump the number of times this expression was scheduled. */ 128*e4b17023SJohn Marino DUMP_EXPR_SCHED_TIMES = 16, 129*e4b17023SJohn Marino 130*e4b17023SJohn Marino /* Dump speculative status of the expression. */ 131*e4b17023SJohn Marino DUMP_EXPR_SPEC_DONE_DS = 32, 132*e4b17023SJohn Marino 133*e4b17023SJohn Marino /* Dump the basic block number which originated this expression. */ 134*e4b17023SJohn Marino DUMP_EXPR_ORIG_BB = 64, 135*e4b17023SJohn Marino 136*e4b17023SJohn Marino /* Dump expression's usefulness. */ 137*e4b17023SJohn Marino DUMP_EXPR_USEFULNESS = 128, 138*e4b17023SJohn Marino 139*e4b17023SJohn Marino /* Dump all of the above. */ 140*e4b17023SJohn Marino DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY 141*e4b17023SJohn Marino | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS 142*e4b17023SJohn Marino | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS) 143*e4b17023SJohn Marino }; 144*e4b17023SJohn Marino 145*e4b17023SJohn Marino extern void dump_expr_1 (expr_t, int); 146*e4b17023SJohn Marino extern void dump_expr (expr_t); 147*e4b17023SJohn Marino extern void debug_expr (expr_t); 148*e4b17023SJohn Marino 149*e4b17023SJohn Marino /* A enumeration for dumping flags of an insn. The difference from 150*e4b17023SJohn Marino dump_insn_rtx_def is that these fields are for insns in stream only. */ 151*e4b17023SJohn Marino enum dump_insn_def 152*e4b17023SJohn Marino { 153*e4b17023SJohn Marino /* Dump expression of this insn. */ 154*e4b17023SJohn Marino DUMP_INSN_EXPR = 2, 155*e4b17023SJohn Marino 156*e4b17023SJohn Marino /* Dump insn's seqno. */ 157*e4b17023SJohn Marino DUMP_INSN_SEQNO = 4, 158*e4b17023SJohn Marino 159*e4b17023SJohn Marino /* Dump the cycle on which insn was scheduled. */ 160*e4b17023SJohn Marino DUMP_INSN_SCHED_CYCLE = 8, 161*e4b17023SJohn Marino 162*e4b17023SJohn Marino /* Dump insn's UID. */ 163*e4b17023SJohn Marino DUMP_INSN_UID = 16, 164*e4b17023SJohn Marino 165*e4b17023SJohn Marino /* Dump insn's pattern. */ 166*e4b17023SJohn Marino DUMP_INSN_PATTERN = 32, 167*e4b17023SJohn Marino 168*e4b17023SJohn Marino /* Dump insn's basic block number. */ 169*e4b17023SJohn Marino DUMP_INSN_BBN = 64, 170*e4b17023SJohn Marino 171*e4b17023SJohn Marino /* Dump all of the above. */ 172*e4b17023SJohn Marino DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN 173*e4b17023SJohn Marino | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN) 174*e4b17023SJohn Marino }; 175*e4b17023SJohn Marino 176*e4b17023SJohn Marino extern void dump_insn_1 (insn_t, int); 177*e4b17023SJohn Marino extern void dump_insn (insn_t); 178*e4b17023SJohn Marino extern void debug_insn (insn_t); 179*e4b17023SJohn Marino 180*e4b17023SJohn Marino /* When this flag is on, we are dumping to the .dot file. 181*e4b17023SJohn Marino When it is off, we are dumping to log. */ 182*e4b17023SJohn Marino extern bool sched_dump_to_dot_p; 183*e4b17023SJohn Marino 184*e4b17023SJohn Marino 185*e4b17023SJohn Marino /* Functions from sel-sched-dump.c. */ 186*e4b17023SJohn Marino extern void sel_print (const char *fmt, ...) ATTRIBUTE_PRINTF_1; 187*e4b17023SJohn Marino extern const char * sel_print_insn (const_rtx, int); 188*e4b17023SJohn Marino extern void free_sel_dump_data (void); 189*e4b17023SJohn Marino 190*e4b17023SJohn Marino extern void block_start (void); 191*e4b17023SJohn Marino extern void block_finish (void); 192*e4b17023SJohn Marino extern int get_print_blocks_num (void); 193*e4b17023SJohn Marino extern void line_start (void); 194*e4b17023SJohn Marino extern void line_finish (void); 195*e4b17023SJohn Marino 196*e4b17023SJohn Marino extern void sel_print_rtl (rtx x); 197*e4b17023SJohn Marino extern void dump_insn_1 (insn_t, int); 198*e4b17023SJohn Marino extern void dump_insn (insn_t); 199*e4b17023SJohn Marino extern void dump_insn_vector (rtx_vec_t); 200*e4b17023SJohn Marino extern void dump_expr (expr_t); 201*e4b17023SJohn Marino extern void dump_used_regs (bitmap); 202*e4b17023SJohn Marino extern void dump_av_set (av_set_t); 203*e4b17023SJohn Marino extern void dump_lv_set (regset); 204*e4b17023SJohn Marino extern void dump_blist (blist_t); 205*e4b17023SJohn Marino extern void dump_flist (flist_t); 206*e4b17023SJohn Marino extern void dump_hard_reg_set (const char *, HARD_REG_SET); 207*e4b17023SJohn Marino extern void sel_debug_cfg_1 (int); 208*e4b17023SJohn Marino extern void sel_debug_cfg (void); 209*e4b17023SJohn Marino extern void setup_dump_cfg_params (void); 210*e4b17023SJohn Marino 211*e4b17023SJohn Marino /* Debug functions. */ 212*e4b17023SJohn Marino extern void debug_expr (expr_t); 213*e4b17023SJohn Marino extern void debug_av_set (av_set_t); 214*e4b17023SJohn Marino extern void debug_lv_set (regset); 215*e4b17023SJohn Marino extern void debug_ilist (ilist_t); 216*e4b17023SJohn Marino extern void debug_blist (blist_t); 217*e4b17023SJohn Marino extern void debug_insn_vector (rtx_vec_t); 218*e4b17023SJohn Marino extern void debug_hard_reg_set (HARD_REG_SET); 219*e4b17023SJohn Marino extern rtx debug_mem_addr_value (rtx); 220*e4b17023SJohn Marino #endif 221