void pp_c_init_declarator (c_pretty_printer *pp, tree t) { pp_declarator (pp, t); /* We don't want to output function definitions here. There are handled elsewhere (and the syntactic form is bogus anyway). */ if (TREE_CODE (t) != FUNCTION_DECL && DECL_INITIAL (t)) { tree init = DECL_INITIAL (t); /* This C++ bit is handled here because it is easier to do so. In templates, the C++ parser builds a TREE_LIST for a direct-initialization; the TREE_PURPOSE is the variable to initialize and the TREE_VALUE is the initializer. */ if (TREE_CODE (init) == TREE_LIST) { pp_c_left_paren (pp); pp_expression (pp, TREE_VALUE (init)); pp_right_paren (pp); } else { pp_space (pp); pp_equal (pp); pp_space (pp); pp_c_initializer (pp, init); } } }
static void pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e) { switch (TREE_CODE (e)) { case MODIFY_EXPR: case INIT_EXPR: pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0)); pp_space (pp); pp_equal (pp); pp_space (pp); pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 1)); break; case THROW_EXPR: pp_cxx_identifier (pp, "throw"); if (TREE_OPERAND (e, 0)) pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0)); break; case MODOP_EXPR: pp_c_logical_or_expression (pp_c_base (pp), TREE_OPERAND (e, 0)); pp_cxx_assignment_operator (pp, TREE_OPERAND (e, 1)); pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 2)); break; default: pp_cxx_conditional_expression (pp, e); break; } }
static void pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t) { tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t); tree types = TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t); const bool abstract = args == NULL || pp_c_base (pp)->flags & pp_c_flag_abstract; bool first = true; /* Skip artificial parameter for nonstatic member functions. */ if (TREE_CODE (t) == METHOD_TYPE) types = TREE_CHAIN (types); pp_cxx_left_paren (pp); for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types)) { if (!first) pp_cxx_separate_with (pp, ','); first = false; pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args); if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument) { pp_cxx_whitespace (pp); pp_equal (pp); pp_cxx_whitespace (pp); pp_cxx_assignment_expression (pp, TREE_PURPOSE (types)); } } pp_cxx_right_paren (pp); }
static void pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t) { pp_cxx_identifier (pp, "namespace"); pp_cxx_unqualified_id (pp, t); pp_cxx_whitespace (pp); pp_equal (pp); pp_cxx_whitespace (pp); pp_cxx_qualified_id (pp, DECL_NAMESPACE_ALIAS (t)); pp_cxx_semicolon (pp); }
void print_pattern (pretty_printer *pp, const_rtx x, int verbose) { if (! x) { pp_string (pp, "(nil)"); return; } switch (GET_CODE (x)) { case SET: print_value (pp, SET_DEST (x), verbose); pp_equal (pp); print_value (pp, SET_SRC (x), verbose); break; case RETURN: case SIMPLE_RETURN: case EH_RETURN: pp_string (pp, GET_RTX_NAME (GET_CODE (x))); break; case CALL: print_exp (pp, x, verbose); break; case CLOBBER: case USE: pp_printf (pp, "%s ", GET_RTX_NAME (GET_CODE (x))); print_value (pp, XEXP (x, 0), verbose); break; case VAR_LOCATION: pp_string (pp, "loc "); print_value (pp, PAT_VAR_LOCATION_LOC (x), verbose); break; case COND_EXEC: pp_left_paren (pp); if (GET_CODE (COND_EXEC_TEST (x)) == NE && XEXP (COND_EXEC_TEST (x), 1) == const0_rtx) print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose); else if (GET_CODE (COND_EXEC_TEST (x)) == EQ && XEXP (COND_EXEC_TEST (x), 1) == const0_rtx) { pp_exclamation (pp); print_value (pp, XEXP (COND_EXEC_TEST (x), 0), verbose); } else print_value (pp, COND_EXEC_TEST (x), verbose); pp_string (pp, ") "); print_pattern (pp, COND_EXEC_CODE (x), verbose); break; case PARALLEL: { int i; pp_left_brace (pp); for (i = 0; i < XVECLEN (x, 0); i++) { print_pattern (pp, XVECEXP (x, 0, i), verbose); pp_semicolon (pp); } pp_right_brace (pp); } break; case SEQUENCE: { pp_string (pp, "sequence{"); if (INSN_P (XVECEXP (x, 0, 0))) { /* Print the sequence insns indented. */ const char * save_print_rtx_head = print_rtx_head; char indented_print_rtx_head[32]; pp_newline (pp); gcc_assert (strlen (print_rtx_head) < sizeof (indented_print_rtx_head) - 4); snprintf (indented_print_rtx_head, sizeof (indented_print_rtx_head), "%s ", print_rtx_head); print_rtx_head = indented_print_rtx_head; for (int i = 0; i < XVECLEN (x, 0); i++) print_insn_with_notes (pp, XVECEXP (x, 0, i)); pp_printf (pp, "%s ", save_print_rtx_head); print_rtx_head = save_print_rtx_head; } else { for (int i = 0; i < XVECLEN (x, 0); i++) { print_pattern (pp, XVECEXP (x, 0, i), verbose); pp_semicolon (pp); } } pp_right_brace (pp); } break; case ASM_INPUT: pp_printf (pp, "asm {%s}", XSTR (x, 0)); break; case ADDR_VEC: /* Fall through. */ case ADDR_DIFF_VEC: print_value (pp, XEXP (x, 0), verbose); break; case TRAP_IF: pp_string (pp, "trap_if "); print_value (pp, TRAP_CONDITION (x), verbose); break; case UNSPEC: case UNSPEC_VOLATILE: /* Fallthru -- leave UNSPECs to print_exp. */ default: print_value (pp, x, verbose); } } /* print_pattern */
static void pp_c_initializer_list (c_pretty_printer *pp, tree e) { tree type = TREE_TYPE (e); const enum tree_code code = TREE_CODE (type); switch (code) { case RECORD_TYPE: case UNION_TYPE: case ARRAY_TYPE: { tree init = TREE_OPERAND (e, 0); for (; init != NULL_TREE; init = TREE_CHAIN (init)) { if (code == RECORD_TYPE || code == UNION_TYPE) { pp_c_dot (pp); pp_c_primary_expression (pp, TREE_PURPOSE (init)); } else { pp_c_left_bracket (pp); if (TREE_PURPOSE (init)) pp_c_constant (pp, TREE_PURPOSE (init)); pp_c_right_bracket (pp); } pp_c_whitespace (pp); pp_equal (pp); pp_c_whitespace (pp); pp_initializer (pp, TREE_VALUE (init)); if (TREE_CHAIN (init)) pp_separate_with (pp, ','); } } return; case VECTOR_TYPE: if (TREE_CODE (e) == VECTOR_CST) pp_c_expression_list (pp, TREE_VECTOR_CST_ELTS (e)); else if (TREE_CODE (e) == CONSTRUCTOR) pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else break; return; case COMPLEX_TYPE: if (TREE_CODE (e) == CONSTRUCTOR) pp_c_constructor_elts (pp, CONSTRUCTOR_ELTS (e)); else if (TREE_CODE (e) == COMPLEX_CST || TREE_CODE (e) == COMPLEX_EXPR) { const bool cst = TREE_CODE (e) == COMPLEX_CST; pp_expression (pp, cst ? TREE_REALPART (e) : TREE_OPERAND (e, 0)); pp_separate_with (pp, ','); pp_expression (pp, cst ? TREE_IMAGPART (e) : TREE_OPERAND (e, 1)); } else break; return; default: break; } pp_unsupported_tree (pp, type); }