self@BAYES.ARC.NASA.GOV (Matthew Self) (03/18/89)
Here are some additions to the rtl printer which cause NOTE insn's and REG_NOTE's in EXPR_LIST insn's to print in a more readable manner. Here is an example: >>>> (note 1 0 2 "" NOTE_INSN_DELETED) (insn 2 1 3 (set (reg/v:SI 56) (mem:SI (plus:SI (reg:SI 14) (const_int 8)))) -1 (nil) >>>> (expr_list:REG_WAS_0 (mem:SI (plus:SI (reg:SI 14) (const_int 8))) (nil))) These diffs are to 1.34: *** gcc/rtl.h Wed Feb 22 09:28:38 1989 --- gcc-pld/rtl.h Fri Mar 17 14:59:13 1989 *************** *** 283,286 **** --- 283,292 ---- #define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK)) + /* Added print names for REG_NOTE's in EXPR_LIST insn's. + March 17, 1989 -- self@bayes.arc.nasa.gov */ + + extern char *reg_note_name[]; + #define REG_NOTE_NAME(INSN) (reg_note_name[(int)(GET_MODE (INSN))]) + /* The label-number of a code-label. The assembler label is made from `L' and the label-number printed in decimal. *************** *** 323,326 **** --- 329,338 ---- #define NOTE_DECL_TYPE(INSN) ((INSN)->fld[7].rtint) + /* Added print names for NOTE insn's. + March 17, 1989 -- self@bayes.arc.nasa.gov */ + + extern char *note_insn_name[]; + #define NOTE_INSN_NAME(INSN) (note_insn_name[- NOTE_LINE_NUMBER (INSN)]) + /* In jump.c, each label contains a count of the number of LABEL_REFs that point at it, so unused labels can be deleted. */ *** gcc/rtl.c Wed Feb 22 09:28:41 1989 --- gcc-pld/rtl.c Fri Mar 17 16:14:45 1989 *************** *** 133,136 **** --- 133,147 ---- #undef DEF_RTL_EXPR }; + + /* Added print names for NOTE's and REG_NOTE's + March 17, 1989 -- self@bayes.arc.nasa.gov */ + + char *note_insn_name[] = { "NOTE_INSN_FUNCTION_BEG", "NOTE_INSN_DELETED", + "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END", + "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END" }; + + char *reg_note_name[] = { "REG_DEAD", "REG_INC", "REG_EQUIV", "REG_WAS_0", + "REG_EQUAL", "REG_RETVAL", "REG_LIBCALL", + "REG_NONNEG", "REG_ASM_LINE", "REG_ASM_FILE" }; /* Allocate an rtx vector of N elements. *************** *** 822,827 **** fprintf (outfile, "/i"); ! if (GET_MODE (in_rtx) != VOIDmode) fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx))); format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx)); --- 833,875 ---- fprintf (outfile, "/i"); ! /* print REG_NOTE names rather than MODE names for EXPR_LIST insn's. ! March 17, 1989 -- self@bayes.arc.nasa.gov */ ! ! if (GET_CODE (in_rtx) == EXPR_LIST) ! fprintf (outfile, ":%s", REG_NOTE_NAME (in_rtx)); ! ! else if (GET_MODE (in_rtx) != VOIDmode) fprintf (outfile, ":%s", GET_MODE_NAME (GET_MODE (in_rtx))); + + /* print NOTE_INSN_NAME rather than NOTE_LINE_NUMBER for NOTE insn's + if NOTE_LINE_NUMBER <= 0. (NOTE format is "iuusi".) + March 17, 1989 -- self@bayes.arc.nasa.gov */ + + if (GET_CODE (in_rtx) == NOTE && NOTE_LINE_NUMBER (in_rtx) <= 0) + { + fprintf (outfile, " %d", XINT (in_rtx, 0)); + + if (XEXP (in_rtx, 1) != NULL) + fprintf(outfile, " %d", INSN_UID (XEXP (in_rtx, 1))); + else + fprintf(outfile, " 0"); + + if (XEXP (in_rtx, 2) != NULL) + fprintf(outfile, " %d", INSN_UID (XEXP (in_rtx, 2))); + else + fprintf(outfile, " 0"); + + if (XSTR (in_rtx, 3) == 0) + fprintf (outfile, " \"\""); + else + fprintf (outfile, " (\"%s\")", XSTR (in_rtx, 4)); + + fprintf (outfile, " %s", NOTE_INSN_NAME (in_rtx)); + + fprintf (outfile, ")"); + sawclose = 1; + + return; + } format_ptr = GET_RTX_FORMAT (GET_CODE (in_rtx));