diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-10 22:05:40 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-02-10 22:05:40 +0000 |
commit | fe352cf15668898c63d58d23e193c30a091417c0 (patch) | |
tree | 6986eb3ff22851f6ba40b08e9a2247fb26755e79 /gcc/tree.c | |
parent | ee2ba10cd96f6be420dcc72b8d3711ad44882ac0 (diff) | |
download | gcc-fe352cf15668898c63d58d23e193c30a091417c0.tar.gz |
* combine.c (make_extraction, force_to_mode): Avoid warning on
mixed-signedness conditionals.
(make_field_assignment, nonzero_bits): Likewise.
* expmed.c (store_fixed_bit_field): ALIGN arg now unsigned.
(store_split_bit_field, extract_split_bit_field): Likewise.
(extract_fixed_bit_field, store_bit_field,
* expr.c: Change alignment to be unsigned everywhere.
(move_by_pieces, store_constructor_field, store_constructor):
Alignment parm is unsigned.
(emit_block_move, emit_group_load, emit_group_store): Likewise.
(clear_storage, emit_push_insn, compare_from_rtx): Likewise.
(do_compare_rtx_and_jump): Likewise.
(move_by_pieces_ninsns, clear_by_pieces): Likewise.
Compare align with GET_MODE_ALIGNMENT.
(expand_expr_unaligned): Pointer to alignment is pointer to unsigned.
(get_inner_reference): Likewise.
(copy_blkmode_from_reg, emit_push_insn): Remove unneeded casts.
(expand_assignment): Local vars for alignment now unsigned.
(store_constructor, store_field, expand_expr, do_jump): Likewise.
(do_compare_and_jump): Likewise.
(store_field): Call new function expr_align.
* expr.h (emit_block_move, emit_group_load, emit_group_store):
Alignment arg now unsigned.
(clear_storage, emit_push_insn, compare_from_rtx): Likewise.
(do_compare_rtx_and_jump, store_bit_field): Likewise.
(extract_bit_field): Likewise.
* fold-const.c (add_double): Add cast to eliminate signedness warning.
* machmode.h (GET_MODE_ALIGNMENT): Result is unsigned.
(get_best_mode): Alignment arg is unsigned.
* rtl.h (move_by_pieces): Likewise.
* store-layout.c (maximum_field_alignment, set_alignment):
Now unsigned.
(layout_decl): Alignment arg is now unsigned.
Remove unneeded casts.
(layout_record, layout_union, layout_type): Remove unneeded casts.
Local alignment variables now unsigned.
(get_best_mode): Alignment arg now unsigned.
* tree.c (expr_align): New function.
* tree.h (expr_align): Likewise.
(maximum_field_alignment, set_alignment): Now unsigned.
(get_inner_reference): Alignment argument is now pointer to unsigned.
* varasm.c (assemble_variable): Add cast to eliminate warning.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31904 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index 5dcc32b14e4..d0313c4c90b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2251,6 +2251,50 @@ int_size_in_bytes (type) return TREE_INT_CST_LOW (t); } + +/* Return the strictest alignment, in bits, that T is known to have. */ + +unsigned int +expr_align (t) + tree t; +{ + unsigned int align0, align1; + + switch (TREE_CODE (t)) + { + case NOP_EXPR: case CONVERT_EXPR: case NON_LVALUE_EXPR: + /* If we have conversions, we know that the alignment of the + object must meet each of the alignments of the types. */ + align0 = expr_align (TREE_OPERAND (t, 0)); + align1 = TYPE_ALIGN (TREE_TYPE (t)); + return MAX (align0, align1); + + case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR: + case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR: + case WITH_RECORD_EXPR: case CLEANUP_POINT_EXPR: case UNSAVE_EXPR: + /* These don't change the alignment of an object. */ + return expr_align (TREE_OPERAND (t, 0)); + + case COND_EXPR: + /* The best we can do is say that the alignment is the least aligned + of the two arms. */ + align0 = expr_align (TREE_OPERAND (t, 1)); + align1 = expr_align (TREE_OPERAND (t, 2)); + return MIN (align0, align1); + + case FUNCTION_DECL: case LABEL_DECL: case CONST_DECL: + case VAR_DECL: case PARM_DECL: case RESULT_DECL: + if (DECL_ALIGN (t) != 0) + return DECL_ALIGN (t); + break; + + default: + break; + } + + /* Otherwise take the alignment from that of the type. */ + return TYPE_ALIGN (TREE_TYPE (t)); +} /* Return, as a tree node, the number of elements for TYPE (which is an ARRAY_TYPE) minus one. This counts only elements of the top array. */ |