aboutsummaryrefslogtreecommitdiff
path: root/gcc/genoutput.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-03-17 17:31:58 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-03-17 12:31:58 -0500
commit665f250366b2cd1528c32b0d7d2fea6aae006e85 (patch)
tree0d31e5a8b4d8432cfb9d20e84ce3b4a97056fdf0 /gcc/genoutput.c
parent63f034bfe3afe558171d79c95166e3e86ee2c515 (diff)
downloadgcc-665f250366b2cd1528c32b0d7d2fea6aae006e85.zip
gcc-665f250366b2cd1528c32b0d7d2fea6aae006e85.tar.gz
gcc-665f250366b2cd1528c32b0d7d2fea6aae006e85.tar.bz2
* 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. From-SVN: r32607
Diffstat (limited to 'gcc/genoutput.c')
-rw-r--r--gcc/genoutput.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index 2935f66..d581da2 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -103,8 +103,8 @@ struct obstack *rtl_obstack = &obstack;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-static int n_occurrences PARAMS ((int, const char *));
-static void strip_whitespace PARAMS ((char *));
+static int n_occurrences PARAMS ((int, const char *));
+static const char *strip_whitespace PARAMS ((const char *));
/* insns in the machine description are assigned sequential code numbers
that are used by insn-recog.c (produced by genrecog) to communicate
@@ -438,13 +438,9 @@ scan_operands (d, part, this_address_p, this_strict_low)
d->operand[opno].mode = GET_MODE (part);
d->operand[opno].strict_low = this_strict_low;
d->operand[opno].predicate = XSTR (part, 1);
- d->operand[opno].constraint = XSTR (part, 2);
- if (XSTR (part, 2) != NULL && *XSTR (part, 2) != 0)
- {
- strip_whitespace (XSTR (part, 2));
- d->operand[opno].n_alternatives
- = n_occurrences (',', XSTR (part, 2)) + 1;
- }
+ d->operand[opno].constraint = strip_whitespace (XSTR (part, 2));
+ d->operand[opno].n_alternatives
+ = n_occurrences (',', d->operand[opno].constraint) + 1;
d->operand[opno].address_p = this_address_p;
d->operand[opno].eliminable = 1;
return;
@@ -466,13 +462,9 @@ scan_operands (d, part, this_address_p, this_strict_low)
d->operand[opno].mode = GET_MODE (part);
d->operand[opno].strict_low = 0;
d->operand[opno].predicate = "scratch_operand";
- d->operand[opno].constraint = XSTR (part, 1);
- if (XSTR (part, 1) != NULL && *XSTR (part, 1) != 0)
- {
- strip_whitespace (XSTR (part, 1));
- d->operand[opno].n_alternatives
- = n_occurrences (',', XSTR (part, 1)) + 1;
- }
+ d->operand[opno].constraint = strip_whitespace (XSTR (part, 1));
+ d->operand[opno].n_alternatives
+ = n_occurrences (',', d->operand[opno].constraint) + 1;
d->operand[opno].address_p = 0;
d->operand[opno].eliminable = 0;
return;
@@ -965,28 +957,43 @@ main (argc, argv)
? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
}
+/* Return the number of occurrences of character C in string S or
+ -1 if S is the null string. */
+
static int
n_occurrences (c, s)
int c;
const char *s;
{
int n = 0;
+
+ if (s == 0 || *s == '\0')
+ return -1;
+
while (*s)
n += (*s++ == c);
+
return n;
}
-/* Remove whitespace in `s' by moving up characters until the end. */
-static void
+/* Remove whitespace in `s' by moving up characters until the end.
+ Return a new string. */
+
+static const char *
strip_whitespace (s)
- char *s;
+ const char *s;
{
- char *p = s;
- int ch;
+ char *p, *q;
+ char ch;
+
+ if (s == 0)
+ return 0;
+ p = q = xmalloc (strlen (s) + 1);
while ((ch = *s++) != '\0')
if (! ISSPACE (ch))
*p++ = ch;
*p = '\0';
+ return q;
}