comparison gcc/gimple-pretty-print.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
79 } 79 }
80 80
81 81
82 /* Print the GIMPLE statement GS on stderr. */ 82 /* Print the GIMPLE statement GS on stderr. */
83 83
84 void 84 DEBUG_FUNCTION void
85 debug_gimple_stmt (gimple gs) 85 debug_gimple_stmt (gimple gs)
86 { 86 {
87 print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS); 87 print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
88 fprintf (stderr, "\n"); 88 fprintf (stderr, "\n");
89 } 89 }
145 } 145 }
146 146
147 147
148 /* Print the GIMPLE sequence SEQ on stderr. */ 148 /* Print the GIMPLE sequence SEQ on stderr. */
149 149
150 void 150 DEBUG_FUNCTION void
151 debug_gimple_seq (gimple_seq seq) 151 debug_gimple_seq (gimple_seq seq)
152 { 152 {
153 print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS); 153 print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
154 } 154 }
155 155
375 else 375 else
376 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); 376 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
377 } 377 }
378 } 378 }
379 379
380 /* Helper for dump_gimple_assign. Print the ternary RHS of the
381 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
382
383 static void
384 dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
385 {
386 const char *p;
387 enum tree_code code = gimple_assign_rhs_code (gs);
388 switch (code)
389 {
390 case WIDEN_MULT_PLUS_EXPR:
391 case WIDEN_MULT_MINUS_EXPR:
392 for (p = tree_code_name [(int) code]; *p; p++)
393 pp_character (buffer, TOUPPER (*p));
394 pp_string (buffer, " <");
395 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
396 pp_string (buffer, ", ");
397 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
398 pp_string (buffer, ", ");
399 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
400 pp_character (buffer, '>');
401 break;
402
403 case FMA_EXPR:
404 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
405 pp_string (buffer, " * ");
406 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
407 pp_string (buffer, " + ");
408 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
409 break;
410
411 default:
412 gcc_unreachable ();
413 }
414 }
415
380 416
381 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in 417 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
382 dump_gimple_stmt. */ 418 dump_gimple_stmt. */
383 419
384 static void 420 static void
417 453
418 if (gimple_num_ops (gs) == 2) 454 if (gimple_num_ops (gs) == 2)
419 dump_unary_rhs (buffer, gs, spc, flags); 455 dump_unary_rhs (buffer, gs, spc, flags);
420 else if (gimple_num_ops (gs) == 3) 456 else if (gimple_num_ops (gs) == 3)
421 dump_binary_rhs (buffer, gs, spc, flags); 457 dump_binary_rhs (buffer, gs, spc, flags);
458 else if (gimple_num_ops (gs) == 4)
459 dump_ternary_rhs (buffer, gs, spc, flags);
422 else 460 else
423 gcc_unreachable (); 461 gcc_unreachable ();
424 if (!(flags & TDF_RHS_ONLY)) 462 if (!(flags & TDF_RHS_ONLY))
425 pp_semicolon(buffer); 463 pp_semicolon(buffer);
426 } 464 }
502 bitmap_iterator bi; 540 bitmap_iterator bi;
503 unsigned i; 541 unsigned i;
504 pp_string (buffer, "{ "); 542 pp_string (buffer, "{ ");
505 EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi) 543 EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
506 { 544 {
507 struct tree_decl_minimal in; 545 tree var = referenced_var_lookup (cfun, i);
508 tree var;
509 in.uid = i;
510 var = (tree) htab_find_with_hash (gimple_referenced_vars (cfun),
511 &in, i);
512 if (var) 546 if (var)
513 { 547 {
514 dump_generic_node (buffer, var, 0, dump_flags, false); 548 dump_generic_node (buffer, var, 0, dump_flags, false);
515 if (DECL_PT_UID (var) != DECL_UID (var)) 549 if (DECL_PT_UID (var) != DECL_UID (var))
516 { 550 {
733 pp_character (buffer, '{'); 767 pp_character (buffer, '{');
734 if (!(flags & TDF_SLIM)) 768 if (!(flags & TDF_SLIM))
735 { 769 {
736 tree var; 770 tree var;
737 771
738 for (var = gimple_bind_vars (gs); var; var = TREE_CHAIN (var)) 772 for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
739 { 773 {
740 newline_and_indent (buffer, 2); 774 newline_and_indent (buffer, 2);
741 print_declaration (buffer, var, spc, flags); 775 print_declaration (buffer, var, spc, flags);
742 } 776 }
743 if (gimple_bind_vars (gs)) 777 if (gimple_bind_vars (gs))
1335 1369
1336 if (flags & TDF_ALIAS 1370 if (flags & TDF_ALIAS
1337 && POINTER_TYPE_P (TREE_TYPE (lhs)) 1371 && POINTER_TYPE_P (TREE_TYPE (lhs))
1338 && SSA_NAME_PTR_INFO (lhs)) 1372 && SSA_NAME_PTR_INFO (lhs))
1339 { 1373 {
1374 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
1340 pp_string (buffer, "PT = "); 1375 pp_string (buffer, "PT = ");
1341 pp_points_to_solution (buffer, &SSA_NAME_PTR_INFO (lhs)->pt); 1376 pp_points_to_solution (buffer, &pi->pt);
1377 newline_and_indent (buffer, spc);
1378 if (pi->align != 1)
1379 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
1380 pi->align, pi->misalign);
1342 newline_and_indent (buffer, spc); 1381 newline_and_indent (buffer, spc);
1343 pp_string (buffer, "# "); 1382 pp_string (buffer, "# ");
1344 } 1383 }
1345 1384
1346 if (flags & TDF_RAW) 1385 if (flags & TDF_RAW)
1622 tree lhs = gimple_get_lhs (gs); 1661 tree lhs = gimple_get_lhs (gs);
1623 if (TREE_CODE (lhs) == SSA_NAME 1662 if (TREE_CODE (lhs) == SSA_NAME
1624 && POINTER_TYPE_P (TREE_TYPE (lhs)) 1663 && POINTER_TYPE_P (TREE_TYPE (lhs))
1625 && SSA_NAME_PTR_INFO (lhs)) 1664 && SSA_NAME_PTR_INFO (lhs))
1626 { 1665 {
1666 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
1627 pp_string (buffer, "# PT = "); 1667 pp_string (buffer, "# PT = ");
1628 pp_points_to_solution (buffer, &SSA_NAME_PTR_INFO (lhs)->pt); 1668 pp_points_to_solution (buffer, &pi->pt);
1629 newline_and_indent (buffer, spc); 1669 newline_and_indent (buffer, spc);
1670 if (pi->align != 1)
1671 {
1672 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
1673 pi->align, pi->misalign);
1674 newline_and_indent (buffer, spc);
1675 }
1630 } 1676 }
1631 } 1677 }
1632 1678
1633 switch (gimple_code (gs)) 1679 switch (gimple_code (gs))
1634 { 1680 {
1850 pp_string (buffer, ">:"); 1896 pp_string (buffer, ">:");
1851 pp_newline (buffer); 1897 pp_newline (buffer);
1852 } 1898 }
1853 } 1899 }
1854 pp_write_text_to_stream (buffer); 1900 pp_write_text_to_stream (buffer);
1855 check_bb_profile (bb, buffer->buffer->stream); 1901 if (cfun)
1902 check_bb_profile (bb, buffer->buffer->stream);
1856 } 1903 }
1857 1904
1858 1905
1859 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT 1906 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
1860 spaces. */ 1907 spaces. */
1936 static void 1983 static void
1937 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, 1984 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
1938 int flags) 1985 int flags)
1939 { 1986 {
1940 edge e; 1987 edge e;
1941 edge_iterator ei;
1942 gimple stmt; 1988 gimple stmt;
1943 1989
1944 stmt = last_stmt (bb); 1990 stmt = last_stmt (bb);
1945 1991
1946 if (stmt && gimple_code (stmt) == GIMPLE_COND) 1992 if (stmt && gimple_code (stmt) == GIMPLE_COND)
1964 return; 2010 return;
1965 } 2011 }
1966 2012
1967 /* If there is a fallthru edge, we may need to add an artificial 2013 /* If there is a fallthru edge, we may need to add an artificial
1968 goto to the dump. */ 2014 goto to the dump. */
1969 FOR_EACH_EDGE (e, ei, bb->succs) 2015 e = find_fallthru_edge (bb->succs);
1970 if (e->flags & EDGE_FALLTHRU)
1971 break;
1972 2016
1973 if (e && e->dest != bb->next_bb) 2017 if (e && e->dest != bb->next_bb)
1974 { 2018 {
1975 INDENT (indent); 2019 INDENT (indent);
1976 2020