summaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r--gcc/tree-pretty-print.c339
1 files changed, 187 insertions, 152 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 7745f73210b..69e40060727 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "predict.h"
+#include <new> // For placement-new.
+
/* Local functions, macros and variables. */
static const char *op_symbol (const_tree);
static void pretty_print_string (pretty_printer *, const char*);
@@ -229,7 +231,7 @@ dump_function_declaration (pretty_printer *buffer, tree node,
tree arg;
pp_space (buffer);
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
/* Print the argument types. */
arg = TYPE_ARG_TYPES (node);
@@ -237,7 +239,7 @@ dump_function_declaration (pretty_printer *buffer, tree node,
{
if (wrote_arg)
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
wrote_arg = true;
@@ -253,7 +255,7 @@ dump_function_declaration (pretty_printer *buffer, tree node,
pp_string (buffer, ", ...");
/* Avoid printing any arg for unprototyped functions. */
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
/* Dump the domain associated with an array. */
@@ -261,7 +263,7 @@ dump_function_declaration (pretty_printer *buffer, tree node,
static void
dump_array_domain (pretty_printer *buffer, tree domain, int spc, int flags)
{
- pp_character (buffer, '[');
+ pp_left_bracket (buffer);
if (domain)
{
tree min = TYPE_MIN_VALUE (domain);
@@ -275,14 +277,14 @@ dump_array_domain (pretty_printer *buffer, tree domain, int spc, int flags)
{
if (min)
dump_generic_node (buffer, min, spc, flags, false);
- pp_character (buffer, ':');
+ pp_colon (buffer);
if (max)
dump_generic_node (buffer, max, spc, flags, false);
}
}
else
pp_string (buffer, "<unknown>");
- pp_character (buffer, ']');
+ pp_right_bracket (buffer);
}
@@ -314,35 +316,38 @@ dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
case OMP_CLAUSE_COPYPRIVATE:
name = "copyprivate";
goto print_remap;
+ case OMP_CLAUSE_UNIFORM:
+ name = "uniform";
+ goto print_remap;
print_remap:
pp_string (buffer, name);
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
- spc, flags, false);
- pp_character (buffer, ')');
+ spc, flags, false);
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_REDUCTION:
pp_string (buffer, "reduction(");
pp_string (buffer, op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
- pp_character (buffer, ':');
+ pp_colon (buffer);
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_IF:
pp_string (buffer, "if(");
dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_NUM_THREADS:
pp_string (buffer, "num_threads(");
dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_NOWAIT:
@@ -373,7 +378,7 @@ dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
default:
gcc_unreachable ();
}
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_SCHEDULE:
@@ -400,12 +405,12 @@ dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
}
if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
dump_generic_node (buffer,
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
spc, flags, false);
}
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_UNTIED:
@@ -417,20 +422,44 @@ dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
dump_generic_node (buffer,
OMP_CLAUSE_COLLAPSE_EXPR (clause),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_FINAL:
pp_string (buffer, "final(");
dump_generic_node (buffer, OMP_CLAUSE_FINAL_EXPR (clause),
spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case OMP_CLAUSE_MERGEABLE:
pp_string (buffer, "mergeable");
break;
+ case OMP_CLAUSE_LINEAR:
+ pp_string (buffer, "linear(");
+ dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ':');
+ dump_generic_node (buffer, OMP_CLAUSE_LINEAR_STEP (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE_SAFELEN:
+ pp_string (buffer, "safelen(");
+ dump_generic_node (buffer, OMP_CLAUSE_SAFELEN_EXPR (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
+ case OMP_CLAUSE__SIMDUID_:
+ pp_string (buffer, "_simduid_(");
+ dump_generic_node (buffer, OMP_CLAUSE__SIMDUID__DECL (clause),
+ spc, flags, false);
+ pp_character (buffer, ')');
+ break;
+
default:
/* Should never happen. */
dump_generic_node (buffer, clause, spc, flags, false);
@@ -467,7 +496,7 @@ dump_location (pretty_printer *buffer, location_t loc)
{
expanded_location xloc = expand_location (loc);
- pp_character (buffer, '[');
+ pp_left_bracket (buffer);
if (xloc.file)
{
pp_string (buffer, xloc.file);
@@ -519,7 +548,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
- pp_string (buffer, " ");
+ pp_space (buffer);
}
newline_and_indent (buffer, spc + 2);
}
@@ -530,7 +559,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
- pp_string (buffer, " ");
+ pp_space (buffer);
}
newline_and_indent (buffer, spc + 2);
}
@@ -541,7 +570,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags, false);
- pp_string (buffer, " ");
+ pp_space (buffer);
}
newline_and_indent (buffer, spc + 2);
}
@@ -555,7 +584,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
FOR_EACH_VEC_ELT (*nlv, i, t)
{
dump_generic_node (buffer, t, 0, flags, false);
- pp_string (buffer, " ");
+ pp_space (buffer);
}
newline_and_indent (buffer, spc + 2);
}
@@ -582,7 +611,7 @@ dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
- pp_string (buffer, " ");
+ pp_space (buffer);
}
newline_and_indent (buffer, spc + 2);
}
@@ -638,7 +667,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
node = TREE_CHAIN (node);
if (node && TREE_CODE (node) == TREE_LIST)
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
}
@@ -658,7 +687,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
dump_generic_node (buffer, TREE_VEC_ELT (node, i), spc, flags,
false);
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
dump_generic_node (buffer, TREE_VEC_ELT (node, len - 1), spc,
@@ -717,7 +746,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
else if (TREE_CODE (node) == VECTOR_TYPE)
{
pp_string (buffer, "vector");
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
pp_wide_integer (buffer, TYPE_VECTOR_SUBPARTS (node));
pp_string (buffer, ") ");
dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
@@ -757,7 +786,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
? "<unnamed-unsigned:"
: "<unnamed-signed:"));
pp_decimal_int (buffer, TYPE_PRECISION (node));
- pp_string (buffer, ">");
+ pp_greater (buffer);
}
}
else if (TREE_CODE (node) == COMPLEX_TYPE)
@@ -769,14 +798,14 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
pp_string (buffer, "<float:");
pp_decimal_int (buffer, TYPE_PRECISION (node));
- pp_string (buffer, ">");
+ pp_greater (buffer);
}
else if (TREE_CODE (node) == FIXED_POINT_TYPE)
{
pp_string (buffer, "<fixed-point-");
pp_string (buffer, TYPE_SATURATING (node) ? "sat:" : "nonsat:");
pp_decimal_int (buffer, TYPE_PRECISION (node));
- pp_string (buffer, ">");
+ pp_greater (buffer);
}
else if (TREE_CODE (node) == VOID_TYPE)
pp_string (buffer, "void");
@@ -801,7 +830,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_TYPE (fnode), spc, flags, false);
pp_space (buffer);
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
pp_string (buffer, str);
if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
dump_decl_name (buffer, TYPE_NAME (node), flags);
@@ -810,7 +839,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
else
pp_printf (buffer, "<T%x>", TYPE_UID (node));
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
dump_function_declaration (buffer, fnode, spc, flags);
}
else
@@ -832,7 +861,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
pp_string (buffer, " <address-space-");
pp_decimal_int (buffer, TYPE_ADDR_SPACE (node));
- pp_string (buffer, ">");
+ pp_greater (buffer);
}
if (TYPE_REF_CAN_ALIAS_ALL (node))
@@ -868,7 +897,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
{
- pp_string (buffer, "*");
+ pp_star (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 0),
spc, flags, false);
}
@@ -882,11 +911,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
tree ptype;
pp_string (buffer, "MEM[");
- pp_string (buffer, "(");
+ pp_left_paren (buffer);
ptype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)));
dump_generic_node (buffer, ptype,
spc, flags | TDF_SLIM, false);
- pp_string (buffer, ")");
+ pp_right_paren (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 0),
spc, flags, false);
if (!integer_zerop (TREE_OPERAND (node, 1)))
@@ -895,7 +924,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 1),
spc, flags, false);
}
- pp_string (buffer, "]");
+ pp_right_bracket (buffer);
}
break;
}
@@ -954,7 +983,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_string (buffer, "offset: ");
dump_generic_node (buffer, tmp, spc, flags, false);
}
- pp_string (buffer, "]");
+ pp_right_bracket (buffer);
}
break;
@@ -1045,7 +1074,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (tree_int_cst_sgn (val) < 0)
{
- pp_character (buffer, '-');
+ pp_minus (buffer);
high = ~high + !low;
low = -low;
}
@@ -1102,7 +1131,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_REALPART (node), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_IMAGPART (node), spc, flags, false);
- pp_string (buffer, ")");
+ pp_right_paren (buffer);
break;
case STRING_CST:
@@ -1137,7 +1166,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
flags);
else
pp_string (buffer, "<null method basetype>");
- pp_string (buffer, "::");
+ pp_colon_colon (buffer);
}
if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
dump_decl_name (buffer, TYPE_NAME (node), flags);
@@ -1241,10 +1270,10 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
str = "->";
}
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, op0, spc, flags, false);
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
pp_string (buffer, str);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
op0 = component_ref_field_offset (node);
@@ -1252,7 +1281,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
pp_string (buffer, "{off: ");
dump_generic_node (buffer, op0, spc, flags, false);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
break;
@@ -1263,22 +1292,22 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case ARRAY_REF:
case ARRAY_RANGE_REF:
op0 = TREE_OPERAND (node, 0);
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, op0, spc, flags, false);
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, ')');
- pp_character (buffer, '[');
+ pp_right_paren (buffer);
+ pp_left_bracket (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
if (TREE_CODE (node) == ARRAY_RANGE_REF)
pp_string (buffer, " ...");
- pp_character (buffer, ']');
+ pp_right_bracket (buffer);
op0 = array_ref_low_bound (node);
op1 = array_ref_element_size (node);
@@ -1291,7 +1320,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, op0, spc, flags, false);
pp_string (buffer, " sz: ");
dump_generic_node (buffer, op1, spc, flags, false);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
break;
@@ -1302,7 +1331,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
bool is_struct_init = false;
bool is_array_init = false;
double_int curidx = double_int_zero;
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
if (TREE_CLOBBER_P (node))
pp_string (buffer, "CLOBBER");
else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
@@ -1324,15 +1353,15 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
if (is_struct_init)
{
- pp_character (buffer, '.');
+ pp_dot (buffer);
dump_generic_node (buffer, field, spc, flags, false);
- pp_character (buffer, '=');
+ pp_equal (buffer);
}
else if (is_array_init
&& (TREE_CODE (field) != INTEGER_CST
|| tree_to_double_int (field) != curidx))
{
- pp_character (buffer, '[');
+ pp_left_bracket (buffer);
if (TREE_CODE (field) == RANGE_EXPR)
{
dump_generic_node (buffer, TREE_OPERAND (field, 0), spc,
@@ -1361,11 +1390,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, val, spc, flags, false);
if (ix != vec_safe_length (CONSTRUCTOR_ELTS (node)) - 1)
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
}
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
break;
@@ -1384,7 +1413,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc);
else
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
@@ -1398,7 +1427,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc);
else
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
}
@@ -1434,7 +1463,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags,
false);
pp_space (buffer);
- pp_character (buffer, '=');
+ pp_equal (buffer);
pp_space (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags,
false);
@@ -1443,10 +1472,10 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case TARGET_EXPR:
pp_string (buffer, "TARGET_EXPR <");
dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
dump_generic_node (buffer, TARGET_EXPR_INITIAL (node), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case DECL_EXPR:
@@ -1459,7 +1488,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
pp_string (buffer, "if (");
dump_generic_node (buffer, COND_EXPR_COND (node), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
/* The lowered cond_exprs should always be printed in full. */
if (COND_EXPR_THEN (node)
&& (IS_EMPTY_STMT (COND_EXPR_THEN (node))
@@ -1484,12 +1513,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (COND_EXPR_THEN (node))
{
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, COND_EXPR_THEN (node), spc+4,
flags, true);
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
/* Output COND_EXPR_ELSE. */
@@ -1499,12 +1528,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc);
pp_string (buffer, "else");
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, COND_EXPR_ELSE (node), spc+4,
flags, true);
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
}
is_expr = false;
@@ -1513,18 +1542,18 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_space (buffer);
- pp_character (buffer, '?');
+ pp_question (buffer);
pp_space (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
pp_space (buffer);
- pp_character (buffer, ':');
+ pp_colon (buffer);
pp_space (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
}
break;
case BIND_EXPR:
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
if (!(flags & TDF_SLIM))
{
if (BIND_EXPR_VARS (node))
@@ -1541,7 +1570,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc+2);
dump_generic_node (buffer, BIND_EXPR_BODY (node), spc+2, flags, true);
newline_and_indent (buffer, spc);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
is_expr = false;
break;
@@ -1551,7 +1580,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
/* Print parameters. */
pp_space (buffer);
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
{
tree arg;
call_expr_arg_iterator iter;
@@ -1560,7 +1589,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, arg, spc, flags, false);
if (more_call_expr_args_p (&iter))
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
}
@@ -1569,19 +1598,19 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
if (call_expr_nargs (node) > 0)
{
- pp_character (buffer, ',');
+ pp_comma (buffer);
pp_space (buffer);
}
pp_string (buffer, "__builtin_va_arg_pack ()");
}
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
op1 = CALL_EXPR_STATIC_CHAIN (node);
if (op1)
{
pp_string (buffer, " [static-chain: ");
dump_generic_node (buffer, op1, spc, flags, false);
- pp_character (buffer, ']');
+ pp_right_bracket (buffer);
}
if (CALL_EXPR_RETURN_SLOT_OPT (node))
@@ -1603,7 +1632,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case PLACEHOLDER_EXPR:
pp_string (buffer, "<PLACEHOLDER_EXPR ");
dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
/* Binary arithmetic and logic expressions. */
@@ -1662,9 +1691,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
keep semantics of the tree representation. */
if (op_prio (op0) <= op_prio (node))
{
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, op0, spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
else
dump_generic_node (buffer, op0, spc, flags, false);
@@ -1677,9 +1706,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
keep semantics of the tree representation. */
if (op_prio (op1) <= op_prio (node))
{
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, op1, spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
else
dump_generic_node (buffer, op1, spc, flags, false);
@@ -1703,9 +1732,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
{
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
else
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
@@ -1715,9 +1744,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case POSTINCREMENT_EXPR:
if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
{
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
else
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
@@ -1729,7 +1758,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case MAX_EXPR:
@@ -1737,13 +1766,13 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case ABS_EXPR:
pp_string (buffer, "ABS_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case RANGE_EXPR:
@@ -1759,15 +1788,15 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
op0 = TREE_OPERAND (node, 0);
if (type != TREE_TYPE (op0))
{
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, type, spc, flags, false);
pp_string (buffer, ") ");
}
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, op0, spc, flags, false);
if (op_prio (op0) < op_prio (node))
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case VIEW_CONVERT_EXPR:
@@ -1775,7 +1804,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
pp_string (buffer, ">(");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case PAREN_EXPR:
@@ -1787,13 +1816,13 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case NON_LVALUE_EXPR:
pp_string (buffer, "NON_LVALUE_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case SAVE_EXPR:
pp_string (buffer, "SAVE_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, '>');
+ pp_greater (buffer);
break;
case COMPLEX_EXPR:
@@ -1801,64 +1830,64 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case CONJ_EXPR:
pp_string (buffer, "CONJ_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case REALPART_EXPR:
pp_string (buffer, "REALPART_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case IMAGPART_EXPR:
pp_string (buffer, "IMAGPART_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case VA_ARG_EXPR:
pp_string (buffer, "VA_ARG_EXPR <");
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case TRY_FINALLY_EXPR:
case TRY_CATCH_EXPR:
pp_string (buffer, "try");
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "{");
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc+4, flags, true);
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "}");
+ pp_right_brace (buffer);
newline_and_indent (buffer, spc);
pp_string (buffer,
(TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "{");
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc+4, flags, true);
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "}");
+ pp_right_brace (buffer);
is_expr = false;
break;
case CATCH_EXPR:
pp_string (buffer, "catch (");
dump_generic_node (buffer, CATCH_TYPES (node), spc+2, flags, false);
- pp_string (buffer, ")");
+ pp_right_paren (buffer);
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "{");
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, CATCH_BODY (node), spc+4, flags, true);
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "}");
+ pp_right_brace (buffer);
is_expr = false;
break;
@@ -1867,11 +1896,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, EH_FILTER_TYPES (node), spc+2, flags, false);
pp_string (buffer, ")>>>");
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "{");
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, EH_FILTER_FAILURE (node), spc+4, flags, true);
newline_and_indent (buffer, spc+2);
- pp_string (buffer, "}");
+ pp_right_brace (buffer);
is_expr = false;
break;
@@ -1886,7 +1915,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
break;
}
dump_generic_node (buffer, op0, spc, flags, false);
- pp_character (buffer, ':');
+ pp_colon (buffer);
if (DECL_NONLOCAL (op0))
pp_string (buffer, " [non-local]");
break;
@@ -1896,11 +1925,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (!(flags & TDF_SLIM))
{
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc+4);
dump_generic_node (buffer, LOOP_EXPR_BODY (node), spc+4, flags, true);
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
is_expr = false;
break;
@@ -1938,11 +1967,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case SWITCH_EXPR:
pp_string (buffer, "switch (");
dump_generic_node (buffer, SWITCH_COND (node), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
if (!(flags & TDF_SLIM))
{
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
if (SWITCH_BODY (node))
{
newline_and_indent (buffer, spc+4);
@@ -1970,7 +1999,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
}
}
newline_and_indent (buffer, spc+2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
is_expr = false;
break;
@@ -1995,18 +2024,18 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_string (buffer, "__asm__");
if (ASM_VOLATILE_P (node))
pp_string (buffer, " __volatile__");
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, ASM_STRING (node), spc, flags, false);
- pp_character (buffer, ':');
+ pp_colon (buffer);
dump_generic_node (buffer, ASM_OUTPUTS (node), spc, flags, false);
- pp_character (buffer, ':');
+ pp_colon (buffer);
dump_generic_node (buffer, ASM_INPUTS (node), spc, flags, false);
if (ASM_CLOBBERS (node))
{
- pp_character (buffer, ':');
+ pp_colon (buffer);
dump_generic_node (buffer, ASM_CLOBBERS (node), spc, flags, false);
}
- pp_string (buffer, ")");
+ pp_right_paren (buffer);
break;
case CASE_LABEL_EXPR:
@@ -2024,25 +2053,24 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
}
else
pp_string (buffer, "default");
- pp_character (buffer, ':');
+ pp_colon (buffer);
break;
case OBJ_TYPE_REF:
pp_string (buffer, "OBJ_TYPE_REF(");
dump_generic_node (buffer, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
- pp_character (buffer, ';');
+ pp_semicolon (buffer);
dump_generic_node (buffer, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
- pp_character (buffer, '-');
- pp_character (buffer, '>');
+ pp_arrow (buffer);
dump_generic_node (buffer, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
break;
case SSA_NAME:
if (SSA_NAME_IDENTIFIER (node))
dump_generic_node (buffer, SSA_NAME_IDENTIFIER (node),
spc, flags, false);
- pp_string (buffer, "_");
+ pp_underscore (buffer);
pp_decimal_int (buffer, SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
pp_string (buffer, "(ab)");
@@ -2055,7 +2083,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case ASSERT_EXPR:
@@ -2063,7 +2091,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, ASSERT_EXPR_VAR (node), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, ASSERT_EXPR_COND (node), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case SCEV_KNOWN:
@@ -2075,7 +2103,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
break;
case POLYNOMIAL_CHREC:
- pp_string (buffer, "{");
+ pp_left_brace (buffer);
dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
pp_string (buffer, ", +, ");
dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
@@ -2091,7 +2119,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
- pp_string (buffer, ">");
+ pp_greater (buffer);
break;
case VEC_COND_EXPR:
@@ -2162,11 +2190,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (!(flags & TDF_SLIM) && OMP_BODY (node))
{
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc + 4);
dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
is_expr = false;
break;
@@ -2178,6 +2206,13 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case OMP_FOR:
pp_string (buffer, "#pragma omp for");
+ goto dump_omp_loop;
+
+ case OMP_SIMD:
+ pp_string (buffer, "#pragma omp simd");
+ goto dump_omp_loop;
+
+ dump_omp_loop:
dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
if (!(flags & TDF_SLIM))
@@ -2187,7 +2222,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (OMP_FOR_PRE_BODY (node))
{
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
spc += 4;
newline_and_indent (buffer, spc);
dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
@@ -2207,24 +2242,24 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_string (buffer, "; ");
dump_generic_node (buffer, TREE_VEC_ELT (OMP_FOR_INCR (node), i),
spc, flags, false);
- pp_string (buffer, ")");
+ pp_right_paren (buffer);
}
if (OMP_FOR_BODY (node))
{
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc + 4);
dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
false);
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
if (OMP_FOR_PRE_BODY (node))
{
spc -= 4;
newline_and_indent (buffer, spc + 2);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
}
is_expr = false;
@@ -2252,10 +2287,10 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (OMP_CRITICAL_NAME (node))
{
pp_space (buffer);
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
goto dump_omp_body;
@@ -2264,7 +2299,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc + 2);
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_space (buffer);
- pp_character (buffer, '=');
+ pp_equal (buffer);
pp_space (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
break;
@@ -2282,7 +2317,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
newline_and_indent (buffer, spc + 2);
dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
pp_space (buffer);
- pp_character (buffer, '=');
+ pp_equal (buffer);
pp_space (buffer);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
break;
@@ -2307,12 +2342,12 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
{
newline_and_indent (buffer, spc);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
newline_and_indent (buffer, spc + 2);
dump_generic_node (buffer, TRANSACTION_EXPR_BODY (node),
spc + 2, flags, false);
newline_and_indent (buffer, spc);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
is_expr = false;
break;
@@ -2341,7 +2376,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case VEC_WIDEN_MULT_ODD_EXPR:
case VEC_WIDEN_LSHIFT_HI_EXPR:
case VEC_WIDEN_LSHIFT_LO_EXPR:
- pp_character (buffer, ' ');
+ pp_space (buffer);
for (str = tree_code_name [code]; *str; str++)
pp_character (buffer, TOUPPER (*str));
pp_string (buffer, " < ");
@@ -2474,9 +2509,9 @@ print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
{
pp_string (buffer, " __asm__ ");
- pp_character (buffer, '(');
+ pp_left_paren (buffer);
dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
- pp_character (buffer, ')');
+ pp_right_paren (buffer);
}
/* The initial value of a function serves to determine whether the function
@@ -2488,7 +2523,7 @@ print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
if (DECL_INITIAL (t))
{
pp_space (buffer);
- pp_character (buffer, '=');
+ pp_equal (buffer);
pp_space (buffer);
dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
}
@@ -2498,10 +2533,10 @@ print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
{
pp_string (buffer, " [value-expr: ");
dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
- pp_character (buffer, ']');
+ pp_right_bracket (buffer);
}
- pp_character (buffer, ';');
+ pp_semicolon (buffer);
}
@@ -2527,7 +2562,7 @@ print_struct_decl (pretty_printer *buffer, const_tree node, int spc, int flags)
/* Print the contents of the structure. */
pp_newline (buffer);
INDENT (spc);
- pp_character (buffer, '{');
+ pp_left_brace (buffer);
pp_newline (buffer);
/* Print the fields of the structure. */
@@ -2552,7 +2587,7 @@ print_struct_decl (pretty_printer *buffer, const_tree node, int spc, int flags)
}
}
INDENT (spc);
- pp_character (buffer, '}');
+ pp_right_brace (buffer);
}
/* Return the priority of the operator CODE.
@@ -2936,7 +2971,7 @@ print_call_name (pretty_printer *buffer, tree node, int flags)
goto again;
case COND_EXPR:
- pp_string (buffer, "(");
+ pp_left_paren (buffer);
dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
pp_string (buffer, ") ? ");
dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
@@ -3060,7 +3095,7 @@ maybe_init_pretty_print (FILE *file)
{
if (!initialized)
{
- pp_construct (&buffer, /* prefix */NULL, /* line-width */0);
+ new (&buffer) pretty_printer ();
pp_needs_newline (&buffer) = true;
pp_translate_identifiers (&buffer) = false;
initialized = 1;
@@ -3113,7 +3148,7 @@ percent_K_format (text_info *text)
/* Print the identifier ID to PRETTY-PRINTER. */
void
-pp_base_tree_identifier (pretty_printer *pp, tree id)
+pp_tree_identifier (pretty_printer *pp, tree id)
{
if (pp_translate_identifiers (pp))
{