aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarfout.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-17 17:31:58 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-17 17:31:58 +0000
commit5d844ba2d923b9651a3a24a6bd82038ab70b41b2 (patch)
tree0d31e5a8b4d8432cfb9d20e84ce3b4a97056fdf0 /gcc/dwarfout.c
parentc61a2574658da2d5a4cf3da8af18f143e5b9dd1d (diff)
* Clean up usages of TREE_INT_CST_LOW.
* c-parse.in (RESTORE_WARN_FLAGS): Use tree_low_cst. * c-parse.y, c-parse.c, objc/objc-parse.y, objc/objc-parse.c: Regenerated. * c-tree.h (min_precision): Move declaration to here. * c-typeck.c (build_binary_op): Use host_integerp and tree_low_cst. (build_unary_op, add_pending_init): Use bit_position. (pending_init_member, process_init_element): Likewise. (really_start_incremental_init, push_init_level, pop_init_level): Don't make copies of nodes or modify them in place, use consistent types when tracking positions, and use tree routines computations. (set_init_index, output_init_element): Likewise. (output_pending_init_elements, process_init_element): Likewise. * dbxout.c (dbxout_type_fields): Use bit_position, host_integerp, tree_low_cst and int_bit_position; also minor cleanup. (dbxout_type_method_1, dbxout_range_type, dbxout_type): Likewise. (print_cst_octal): Precision is unsigned. (dbxout_symbol): Ensure DECL_INITIAL is in-range and use tree_low_cst. * dwarf2out.c (ceiling): Input and output are unsigned HOST_WIDE_INT. (simple_type_align_in_bits): Result is unsigned int. Use tree_int_low_cst and host_integerp. (simple_type_size_in_bits): Result is unsigned HOST_WIDE_INT. (field_byte_offset): Result is HOST_WIDE_INT. Change types of internal variables so alignments are unsigned int, offsets are HOST_WIDE_INT and sizes are unsigned HOST_WIDE_INT. Use host_integerp, tree_low_cst, and int_bit_position. (add_bit_offset_attribute): Likewise. (add_data_member_location_attribute): Use tree_cst_low. (add_bound_info): Use host_integerp, integer_zerop, and integer_onep. (add_bit_size_attribute): Use tree_low_cst. (add_pure_or_virtual_attribute, gen_enumeration_type_die): Likewise. * dwarfout.c: Similar changes to dwarf2out.c. * expr.c (expand_expr, case ARRAY_REF): Remove redundant code. * genoutput.c (n_occurences): Return -1 for null string. (strip_whitespace): Accept null string and make into function. (scan_operands): Reflect above changes. * sdbout.c (plain_type_1): Use host_integerp and tree_low_cst. (sdbout_field_types, sdbout_one_type): Likewise; also use bit_position. * ssa.c (rename_registers): Add missing cast of arg to bzero. * tree.c (int_size_in_bytes): Check for too big to represent. (bit_position, int_bit_position, host_integerp, tree_low_cst): New fns. * tree.h (host_integerp, tree_low_cst, bit_position, int_bit_position): New declarations. (min_precision): Delete from here. * varasm.c (decode_addr_const): Use host_integerp, bit_position, and int_bit_position. * objc/objc-act.c (encode_method_prototype): Sizes are HOST_WIDE_INT. (encode_method_def): Likewise. (build_ivar_list_initializer): Use int_bit_position. (generate_shared_structures): Convert size. (encode_type, encode_complete_bitfield): Use integer_zerop. (encode_bitfield): Use tree_low_cst and int_bit_position. * ch/typeck.c (min_precision): New function. (build_chill_slice): Use host_integerp and tree_low_cst. (expand_constant_to_buffer): Likewise and also int_bit_position. LO is unsigned HOST_WIDE_INT (build_chill_array_ref_1): Make `i' be HOST_WIDE_INT; use tree_low_cst. (extract_constant_from_buffer): Sizes are now HOST_WIDE_INT. Use host_integerp and tree_low_cst. (build_chill_bin_type): Use host_integerp and tree_low_cst. (layout_chill_range_type): Use tree_int_cst_sgn, compare_tree_int, tree_low_cst, and min_precision. (apply_chill_array_layout): Cleanups for types of variables and use tree_int_cst_sgn, compare_tree_int, and tree_low_cst. (apply_chill_field_layout): Likewise. * cp/class.c (build_vbase_path): Use integer_zerop. (build_vtable_entry): Use tree_low_cst. (get_vfield_offset): Use bit_position. (dfs_modify_vtables): New variable vindex_val; `i' is HOST_WIDE_INT. Use tree_low_cst. (check_bitfield_decl): Set DECL_SIZE using convert. (build_base_field): Set DECL_SIZE and DECL_SIZE_UNIT using size_binop. (layout_virtual_bases): DSIZE is unsigned HOST_WIDE_INT. Use tree_low_cst. (finish_struct_1): Use bit_position. (dump_class_hierarchy): Use tree_low_cst. * cp/cp-tree.h (min_precision): Add declaration. * cp/decl.c (xref_tag, xref_basetypes): Use tree_low_cst. * cp/error.c (dump_type_suffix): Use host_integerp and tree_low_cst. (dump_expr): Use integer_zerop, host_integerp, and tree_low_cst. * cp/expr.c (cplus_expand_constant): Use bit_position. * cp/init.c (build_vec_init): Use host_integerp and tree_low_cst. * cp/rtti.c (get_base_offset): Use bit_position. * cp/typeck.c (build_binary_op): Use integer_zerop, compare_tree_int, host_integerp, and tree_low_cst. (pointer_int_sum): Use integer_zerop. (build_component_addr): Use bit_position. * java/class.c (make_field_value): Properly handle sizes. (get_dispatch_vector): Use tree_low_cst and host_integerp. (layout_class_method): Count using trees. * java/decl.c (push_promoted_type): Set TYPE_{MIN,MAX}_VALUE with copy_node. * java/expr.c (java_array_data_offset): Use int_bit_position. (build_newarray, build_anewarray): Use host_integerp and tree_low_cst. (build_invokevirtual): Use tree_low_cst and do computations with trees. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32607 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarfout.c')
-rw-r--r--gcc/dwarfout.c119
1 files changed, 59 insertions, 60 deletions
diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c
index 0c0b7f28b08..eab7bf54fc9 100644
--- a/gcc/dwarfout.c
+++ b/gcc/dwarfout.c
@@ -331,11 +331,11 @@ static void output_mem_loc_descriptor PARAMS ((rtx));
static void output_loc_descriptor PARAMS ((rtx));
static void output_bound_representation PARAMS ((tree, unsigned, int));
static void output_enumeral_list PARAMS ((tree));
-static inline unsigned ceiling PARAMS ((unsigned, unsigned));
+static inline HOST_WIDE_INT ceiling PARAMS ((HOST_WIDE_INT, unsigned int));
static inline tree field_type PARAMS ((tree));
-static inline unsigned simple_type_align_in_bits PARAMS ((tree));
-static inline unsigned simple_type_size_in_bits PARAMS ((tree));
-static unsigned field_byte_offset PARAMS ((tree));
+static inline unsigned int simple_type_align_in_bits PARAMS ((tree));
+static inline unsigned HOST_WIDE_INT simple_type_size_in_bits PARAMS ((tree));
+static HOST_WIDE_INT field_byte_offset PARAMS ((tree));
static inline void sibling_attribute PARAMS ((void));
static void location_attribute PARAMS ((rtx));
static void data_member_location_attribute PARAMS ((tree));
@@ -1806,8 +1806,8 @@ output_bound_representation (bound, dim_num, u_or_l)
/* All fixed-bounds are represented by INTEGER_CST nodes. */
case INTEGER_CST:
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (bound));
+ if (host_integerp (bound, 0))
+ ASM_OUTPUT_DWARF_DATA4 (asm_out_file, tree_low_cst (bound, 0));
break;
default:
@@ -1881,8 +1881,11 @@ output_enumeral_list (link)
if (link)
{
output_enumeral_list (TREE_CHAIN (link));
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (TREE_VALUE (link)));
+
+ if (host_integerp (TREE_VALUE (link), 0))
+ ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
+ tree_low_cst (TREE_VALUE (link), 0));
+
ASM_OUTPUT_DWARF_STRING_NEWLINE (asm_out_file,
IDENTIFIER_POINTER (TREE_PURPOSE (link)));
}
@@ -1891,10 +1894,10 @@ output_enumeral_list (link)
/* Given an unsigned value, round it up to the lowest multiple of `boundary'
which is not less than the value itself. */
-static inline unsigned
+static inline HOST_WIDE_INT
ceiling (value, boundary)
- register unsigned value;
- register unsigned boundary;
+ register HOST_WIDE_INT value;
+ register unsigned int boundary;
{
return (((value + boundary - 1) / boundary) * boundary);
}
@@ -1922,7 +1925,7 @@ field_type (decl)
node, return the alignment in bits for the type, or else return
BITS_PER_WORD if the node actually turns out to be an ERROR_MARK node. */
-static inline unsigned
+static inline unsigned int
simple_type_align_in_bits (type)
register tree type;
{
@@ -1935,7 +1938,7 @@ simple_type_align_in_bits (type)
constant, or else return BITS_PER_WORD if the type actually turns out
to be an ERROR_MARK node. */
-static inline unsigned
+static inline unsigned HOST_WIDE_INT
simple_type_size_in_bits (type)
register tree type;
{
@@ -1945,10 +1948,10 @@ simple_type_size_in_bits (type)
{
register tree type_size_tree = TYPE_SIZE (type);
- if (TREE_CODE (type_size_tree) != INTEGER_CST)
+ if (! host_integerp (type_size_tree, 1))
return TYPE_ALIGN (type);
- return (unsigned) TREE_INT_CST_LOW (type_size_tree);
+ return tree_low_cst (type_size_tree, 1);
}
}
@@ -1959,22 +1962,21 @@ simple_type_size_in_bits (type)
pointer to an ERROR_MARK node, or because the offset is actually variable.
(We can't handle the latter case just yet.) */
-static unsigned
+static HOST_WIDE_INT
field_byte_offset (decl)
register tree decl;
{
- register unsigned type_align_in_bytes;
- register unsigned type_align_in_bits;
- register unsigned type_size_in_bits;
- register unsigned object_offset_in_align_units;
- register unsigned object_offset_in_bits;
- register unsigned object_offset_in_bytes;
- register tree type;
- register tree bitpos_tree;
- register tree field_size_tree;
- register unsigned bitpos_int;
- register unsigned deepest_bitpos;
- register unsigned field_size_in_bits;
+ unsigned int type_align_in_bytes;
+ unsigned int type_align_in_bits;
+ unsigned HOST_WIDE_INT type_size_in_bits;
+ HOST_WIDE_INT object_offset_in_align_units;
+ HOST_WIDE_INT object_offset_in_bits;
+ HOST_WIDE_INT object_offset_in_bytes;
+ tree type;
+ tree field_size_tree;
+ HOST_WIDE_INT bitpos_int;
+ HOST_WIDE_INT deepest_bitpos;
+ unsigned HOST_WIDE_INT field_size_in_bits;
if (TREE_CODE (decl) == ERROR_MARK)
return 0;
@@ -1983,8 +1985,6 @@ field_byte_offset (decl)
abort ();
type = field_type (decl);
-
- bitpos_tree = DECL_FIELD_BITPOS (decl);
field_size_tree = DECL_SIZE (decl);
/* If there was an error, the size could be zero. */
@@ -1992,24 +1992,22 @@ field_byte_offset (decl)
{
if (errorcount)
return 0;
+
abort ();
}
-
/* We cannot yet cope with fields whose positions or sizes are variable,
so for now, when we see such things, we simply return 0. Someday,
we may be able to handle such cases, but it will be damn difficult. */
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+ if (! host_integerp (bit_position (decl), 0)
+ || ! host_integerp (field_size_tree, 1))
return 0;
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
- if (TREE_CODE (field_size_tree) != INTEGER_CST)
- return 0;
- field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree);
+ bitpos_int = int_bit_position (decl);
+ field_size_in_bits = tree_low_cst (field_size_tree, 1);
type_size_in_bits = simple_type_size_in_bits (type);
-
type_align_in_bits = simple_type_align_in_bits (type);
type_align_in_bytes = type_align_in_bits / BITS_PER_UNIT;
@@ -2058,8 +2056,7 @@ field_byte_offset (decl)
The value we deduce is then used (by the callers of this routine) to
generate AT_location and AT_bit_offset attributes for fields (both
- bit-fields and, in the case of AT_location, regular fields as well).
- */
+ bit-fields and, in the case of AT_location, regular fields as well). */
/* Figure out the bit-distance from the start of the structure to the
"deepest" bit of the bit-field. */
@@ -2201,7 +2198,7 @@ data_member_location_attribute (t)
char end_label[MAX_ARTIFICIAL_LABEL_BYTES];
if (TREE_CODE (t) == TREE_VEC)
- object_offset_in_bytes = TREE_INT_CST_LOW (BINFO_OFFSET (t));
+ object_offset_in_bytes = tree_low_cst (BINFO_OFFSET (t), 0);
else
object_offset_in_bytes = field_byte_offset (t);
@@ -2258,8 +2255,8 @@ const_value_attribute (rtl)
simplicity we always just output CONST_DOUBLEs using 8 bytes. */
ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
- (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (rtl),
- (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (rtl));
+ (unsigned int) CONST_DOUBLE_HIGH (rtl),
+ (unsigned int) CONST_DOUBLE_LOW (rtl));
break;
case CONST_STRING:
@@ -2715,26 +2712,27 @@ static inline void
bit_offset_attribute (decl)
register tree decl;
{
- register unsigned object_offset_in_bytes = field_byte_offset (decl);
- register tree type = DECL_BIT_FIELD_TYPE (decl);
- register tree bitpos_tree = DECL_FIELD_BITPOS (decl);
- register unsigned bitpos_int;
- register unsigned highest_order_object_bit_offset;
- register unsigned highest_order_field_bit_offset;
- register unsigned bit_offset;
+ HOST_WIDE_INT object_offset_in_bytes = field_byte_offset (decl);
+ tree type = DECL_BIT_FIELD_TYPE (decl);
+ HOST_WIDE_INT bitpos_int;
+ HOST_WIDE_INT highest_order_object_bit_offset;
+ HOST_WIDE_INT highest_order_field_bit_offset;
+ HOST_WIDE_INT bit_offset;
/* Must be a bit field. */
if (!type
|| TREE_CODE (decl) != FIELD_DECL)
abort ();
- /* We can't yet handle bit-fields whose offsets are variable, so if we
- encounter such things, just return without generating any attribute
- whatsoever. */
+ /* We can't yet handle bit-fields whose offsets or sizes are variable, so
+ if we encounter such things, just return without generating any
+ attribute whatsoever. */
- if (TREE_CODE (bitpos_tree) != INTEGER_CST)
+ if (! host_integerp (bit_position (decl), 0)
+ || ! host_integerp (DECL_SIZE (decl), 1))
return;
- bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree);
+
+ bitpos_int = int_bit_position (decl);
/* Note that the bit offset is always the distance (in bits) from the
highest-order bit of the "containing object" to the highest-order
@@ -2747,9 +2745,7 @@ bit_offset_attribute (decl)
if (! BYTES_BIG_ENDIAN)
{
- highest_order_field_bit_offset
- += (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl));
-
+ highest_order_field_bit_offset += tree_low_cst (DECL_SIZE (decl), 1);
highest_order_object_bit_offset += simple_type_size_in_bits (type);
}
@@ -2774,9 +2770,12 @@ bit_size_attribute (decl)
|| ! DECL_BIT_FIELD_TYPE (decl))
abort ();
- ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_size);
- ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
- (unsigned) TREE_INT_CST_LOW (DECL_SIZE (decl)));
+ if (host_integerp (DECL_SIZE (decl), 1))
+ {
+ ASM_OUTPUT_DWARF_ATTRIBUTE (asm_out_file, AT_bit_size);
+ ASM_OUTPUT_DWARF_DATA4 (asm_out_file,
+ tree_low_cst (DECL_SIZE (decl), 1));
+ }
}
/* The following routine outputs the `element_list' attribute for enumeration