+2004-07-01 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * tree-pretty-print.c (dump_generic_node, case ARRAY_REF): Use
+ access functions for lower bound and element size and only output
+ if lower bound nonzero or element size not same as that of type.
+ (dump_generic_node, case COMPONENT_REF): Use access func. for offset.
+
2004-07-01 Paolo Bonzini <bonzini@gnu.org>
* c-pretty-print.c (pp_c_postfix_expression): Fix pasto.
pp_character (buffer, ')');
pp_string (buffer, str);
dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
- if (TREE_OPERAND (node, 2)
- && TREE_CODE (TREE_OPERAND (node, 2)) != INTEGER_CST)
+
+ op0 = component_ref_field_offset (node);
+ if (op0 && TREE_CODE (op0) != INTEGER_CST)
{
pp_string (buffer, "{off: ");
- dump_generic_node (buffer, TREE_OPERAND (node, 2),
- spc, flags, false);
+ dump_generic_node (buffer, op0, spc, flags, false);
pp_character (buffer, '}');
}
break;
pp_string (buffer, " ...");
pp_character (buffer, ']');
- if ((TREE_OPERAND (node, 2)
- && TREE_CODE (TREE_OPERAND (node, 2)) != INTEGER_CST)
- || (TREE_OPERAND (node, 3)
- && TREE_CODE (TREE_OPERAND (node, 3)) != INTEGER_CST))
+ op0 = array_ref_low_bound (node);
+ op1 = array_ref_element_size (node);
+
+ if (!integer_zerop (op0)
+ || (TYPE_SIZE_UNIT (TREE_TYPE (node))
+ && !operand_equal_p (op1, TYPE_SIZE_UNIT (TREE_TYPE (node)), 0)))
{
pp_string (buffer, "{lb: ");
- dump_generic_node (buffer, TREE_OPERAND (node, 2),
- spc, flags, false);
+ dump_generic_node (buffer, op0, spc, flags, false);
pp_string (buffer, " sz: ");
- dump_generic_node (buffer, TREE_OPERAND (node, 3),
- spc, flags, false);
+ dump_generic_node (buffer, op1, spc, flags, false);
pp_character (buffer, '}');
}
break;