static void dump_fixed (dump_info_p di, const char *field, const FIXED_VALUE_TYPE *f) { char buf[32]; fixed_to_decimal (buf, f, sizeof (buf)); dump_maybe_newline (di); fprintf (di->stream, "%-4s: %s ", field, buf); di->column += strlen (buf) + 7; }
void print_node_brief (FILE *file, const char *prefix, const_tree node, int indent) { enum tree_code_class tclass; if (node == 0) return; tclass = TREE_CODE_CLASS (TREE_CODE (node)); /* Always print the slot this node is in, and its code, address and name if any. */ if (indent > 0) fprintf (file, " "); fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node))); dump_addr (file, " ", node); if (tclass == tcc_declaration) { if (DECL_NAME (node)) fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node))); else if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1) { if (dump_flags & TDF_NOUID) fprintf (file, " L.xxxx"); else fprintf (file, " L.%d", (int) LABEL_DECL_UID (node)); } else { if (dump_flags & TDF_NOUID) fprintf (file, " %c.xxxx", TREE_CODE (node) == CONST_DECL ? 'C' : 'D'); else fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D', DECL_UID (node)); } } else if (tclass == tcc_type) { if (TYPE_NAME (node)) { if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL && DECL_NAME (TYPE_NAME (node))) fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); } if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node))) fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node)); } if (TREE_CODE (node) == IDENTIFIER_NODE) fprintf (file, " %s", IDENTIFIER_POINTER (node)); /* We might as well always print the value of an integer or real. */ if (TREE_CODE (node) == INTEGER_CST) { if (TREE_OVERFLOW (node)) fprintf (file, " overflow"); fprintf (file, " "); print_dec (node, file, TYPE_SIGN (TREE_TYPE (node))); } if (TREE_CODE (node) == REAL_CST) { REAL_VALUE_TYPE d; if (TREE_OVERFLOW (node)) fprintf (file, " overflow"); d = TREE_REAL_CST (node); if (REAL_VALUE_ISINF (d)) fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf"); else if (REAL_VALUE_ISNAN (d)) fprintf (file, " Nan"); else { char string[60]; real_to_decimal (string, &d, sizeof (string), 0, 1); fprintf (file, " %s", string); } } if (TREE_CODE (node) == FIXED_CST) { FIXED_VALUE_TYPE f; char string[60]; if (TREE_OVERFLOW (node)) fprintf (file, " overflow"); f = TREE_FIXED_CST (node); fixed_to_decimal (string, &f, sizeof (string)); fprintf (file, " %s", string); } fprintf (file, ">"); }
void print_value (pretty_printer *pp, const_rtx x, int verbose) { char tmp[1024]; if (!x) { pp_string (pp, "(nil)"); return; } switch (GET_CODE (x)) { case CONST_INT: pp_scalar (pp, HOST_WIDE_INT_PRINT_HEX, (unsigned HOST_WIDE_INT) INTVAL (x)); break; case CONST_DOUBLE: if (FLOAT_MODE_P (GET_MODE (x))) { real_to_decimal (tmp, CONST_DOUBLE_REAL_VALUE (x), sizeof (tmp), 0, 1); pp_string (pp, tmp); } else pp_printf (pp, "<%wx,%wx>", (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x), (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x)); break; case CONST_FIXED: fixed_to_decimal (tmp, CONST_FIXED_VALUE (x), sizeof (tmp)); pp_string (pp, tmp); break; case CONST_STRING: pp_printf (pp, "\"%s\"", XSTR (x, 0)); break; case SYMBOL_REF: pp_printf (pp, "`%s'", XSTR (x, 0)); break; case LABEL_REF: pp_printf (pp, "L%d", INSN_UID (XEXP (x, 0))); break; case CONST: case HIGH: case STRICT_LOW_PART: pp_printf (pp, "%s(", GET_RTX_NAME (GET_CODE (x))); print_value (pp, XEXP (x, 0), verbose); pp_right_paren (pp); break; case REG: if (REGNO (x) < FIRST_PSEUDO_REGISTER) { if (ISDIGIT (reg_names[REGNO (x)][0])) pp_modulo (pp); pp_string (pp, reg_names[REGNO (x)]); } else pp_printf (pp, "r%d", REGNO (x)); if (verbose) pp_printf (pp, ":%s", GET_MODE_NAME (GET_MODE (x))); break; case SUBREG: print_value (pp, SUBREG_REG (x), verbose); pp_printf (pp, "#%d", SUBREG_BYTE (x)); break; case SCRATCH: case CC0: case PC: pp_string (pp, GET_RTX_NAME (GET_CODE (x))); break; case MEM: pp_left_bracket (pp); print_value (pp, XEXP (x, 0), verbose); pp_right_bracket (pp); break; case DEBUG_EXPR: pp_printf (pp, "D#%i", DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))); break; default: print_exp (pp, x, verbose); break; } } /* print_value */
void print_value (char *buf, const_rtx x, int verbose) { char t[BUF_LEN]; char *cur = buf; if (!x) { safe_concat (buf, buf, "(nil)"); return; } switch (GET_CODE (x)) { case CONST_INT: sprintf (t, HOST_WIDE_INT_PRINT_HEX, (unsigned HOST_WIDE_INT) INTVAL (x)); cur = safe_concat (buf, cur, t); break; case CONST_DOUBLE: if (FLOAT_MODE_P (GET_MODE (x))) real_to_decimal (t, CONST_DOUBLE_REAL_VALUE (x), sizeof (t), 0, 1); else sprintf (t, "<" HOST_WIDE_INT_PRINT_HEX "," HOST_WIDE_INT_PRINT_HEX ">", (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x), (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x)); cur = safe_concat (buf, cur, t); break; case CONST_FIXED: fixed_to_decimal (t, CONST_FIXED_VALUE (x), sizeof (t)); cur = safe_concat (buf, cur, t); break; case CONST_STRING: cur = safe_concat (buf, cur, "\""); cur = safe_concat (buf, cur, XSTR (x, 0)); cur = safe_concat (buf, cur, "\""); break; case SYMBOL_REF: cur = safe_concat (buf, cur, "`"); cur = safe_concat (buf, cur, XSTR (x, 0)); cur = safe_concat (buf, cur, "'"); break; case LABEL_REF: sprintf (t, "L%d", INSN_UID (XEXP (x, 0))); cur = safe_concat (buf, cur, t); break; case CONST: print_value (t, XEXP (x, 0), verbose); cur = safe_concat (buf, cur, "const("); cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, ")"); break; case HIGH: print_value (t, XEXP (x, 0), verbose); cur = safe_concat (buf, cur, "high("); cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, ")"); break; case REG: if (REGNO (x) < FIRST_PSEUDO_REGISTER) { int c = reg_names[REGNO (x)][0]; if (ISDIGIT (c)) cur = safe_concat (buf, cur, "%"); cur = safe_concat (buf, cur, reg_names[REGNO (x)]); } else { sprintf (t, "r%d", REGNO (x)); cur = safe_concat (buf, cur, t); } if (verbose #ifdef INSN_SCHEDULING && !current_sched_info #endif ) { sprintf (t, ":%s", GET_MODE_NAME (GET_MODE (x))); cur = safe_concat (buf, cur, t); } break; case SUBREG: print_value (t, SUBREG_REG (x), verbose); cur = safe_concat (buf, cur, t); sprintf (t, "#%d", SUBREG_BYTE (x)); cur = safe_concat (buf, cur, t); break; case STRICT_LOW_PART: print_value (t, XEXP (x, 0), verbose); cur = safe_concat (buf, cur, "strict_low_part("); cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, ")"); break; case SCRATCH: cur = safe_concat (buf, cur, "scratch"); break; case CC0: cur = safe_concat (buf, cur, "cc0"); break; case PC: cur = safe_concat (buf, cur, "pc"); break; case MEM: print_value (t, XEXP (x, 0), verbose); cur = safe_concat (buf, cur, "["); cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, "]"); break; case DEBUG_EXPR: sprintf (t, "D#%i", DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))); cur = safe_concat (buf, cur, t); break; default: print_exp (t, x, verbose); cur = safe_concat (buf, cur, t); break; } } /* print_value */