Commit 729a2125 by Richard Kenner Committed by Richard Kenner

combine.c (make_extraction, [...]): Avoid warning on mixed-signedness conditionals.

	* 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.

From-SVN: r31904
parent 5e4900c7
Thu Feb 10 16:26:49 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* 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.
Thu Feb 10 12:56:47 2000 Jim Wilson <wilson@cygnus.com>
* expmed.c (store_bit_field): If op0 and fieldmode are the same size,
......
......@@ -5891,7 +5891,7 @@ make_extraction (mode, inner, pos, pos_rtx, len,
new = force_to_mode (inner, tmode,
len >= HOST_BITS_PER_WIDE_INT
? GET_MODE_MASK (tmode)
: ((HOST_WIDE_INT) 1 << len) - 1,
: ((unsigned HOST_WIDE_INT) 1 << len) - 1,
NULL_RTX, 0);
/* If this extraction is going into the destination of a SET,
......@@ -6112,7 +6112,8 @@ make_extraction (mode, inner, pos, pos_rtx, len,
pos_rtx
|| len + orig_pos >= HOST_BITS_PER_WIDE_INT
? GET_MODE_MASK (wanted_inner_mode)
: (((HOST_WIDE_INT) 1 << len) - 1) << orig_pos,
: ((((unsigned HOST_WIDE_INT) 1 << len) - 1)
<< orig_pos),
NULL_RTX, 0);
}
......@@ -6583,7 +6584,8 @@ force_to_mode (x, mode, mask, reg, just_select)
if (op_mode)
fuller_mask = (GET_MODE_BITSIZE (op_mode) >= HOST_BITS_PER_WIDE_INT
? GET_MODE_MASK (op_mode)
: ((HOST_WIDE_INT) 1 << (floor_log2 (mask) + 1)) - 1);
: (((unsigned HOST_WIDE_INT) 1 << (floor_log2 (mask) + 1))
- 1));
else
fuller_mask = ~ (HOST_WIDE_INT) 0;
......@@ -7525,7 +7527,7 @@ make_field_assignment (x)
mode,
GET_MODE_BITSIZE (mode) >= HOST_BITS_PER_WIDE_INT
? GET_MODE_MASK (mode)
: ((HOST_WIDE_INT) 1 << len) - 1,
: ((unsigned HOST_WIDE_INT) 1 << len) - 1,
dest, 0);
return gen_rtx_combine (SET, VOIDmode, assign, src);
......@@ -8110,8 +8112,10 @@ nonzero_bits (x, mode)
/* If this is a typical RISC machine, we only have to worry
about the way loads are extended. */
if (LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) == SIGN_EXTEND
? (nonzero
& (1L << (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - 1)))
? (((nonzero
& (((unsigned HOST_WIDE_INT) 1
<< (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) - 1))))
!= 0))
: LOAD_EXTEND_OP (GET_MODE (SUBREG_REG (x))) != ZERO_EXTEND)
#endif
{
......
......@@ -34,15 +34,19 @@ Boston, MA 02111-1307, USA. */
#include "real.h"
#include "recog.h"
static void store_fixed_bit_field PARAMS ((rtx, int, int, int, rtx, int));
static void store_split_bit_field PARAMS ((rtx, int, int, rtx, int));
static void store_fixed_bit_field PARAMS ((rtx, int, int, int, rtx,
unsigned int));
static void store_split_bit_field PARAMS ((rtx, int, int, rtx,
unsigned int));
static rtx extract_fixed_bit_field PARAMS ((enum machine_mode, rtx, int,
int, int, rtx, int, int));
int, int, rtx, int,
unsigned int));
static rtx mask_rtx PARAMS ((enum machine_mode, int,
int, int));
static rtx lshift_value PARAMS ((enum machine_mode, rtx,
int, int));
static rtx extract_split_bit_field PARAMS ((rtx, int, int, int, int));
static rtx extract_split_bit_field PARAMS ((rtx, int, int, int,
unsigned int));
static void do_cmp_and_jump PARAMS ((rtx, rtx, enum rtx_code,
enum machine_mode, rtx));
......@@ -224,7 +228,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
int bitnum;
enum machine_mode fieldmode;
rtx value;
int align;
unsigned int align;
int total_size;
{
int unit = (GET_CODE (str_rtx) == MEM) ? BITS_PER_UNIT : BITS_PER_WORD;
......@@ -508,7 +512,7 @@ store_bit_field (str_rtx, bitsize, bitnum, fieldmode, value, align, total_size)
if (bestmode == VOIDmode
|| (SLOW_UNALIGNED_ACCESS (bestmode, align)
&& GET_MODE_SIZE (bestmode) > align))
&& GET_MODE_SIZE (bestmode) > (int) align))
goto insv_loses;
/* Adjust address to point to the containing unit of that mode. */
......@@ -623,7 +627,7 @@ store_fixed_bit_field (op0, offset, bitsize, bitpos, value, struct_align)
register rtx op0;
register int offset, bitsize, bitpos;
register rtx value;
int struct_align;
unsigned int struct_align;
{
register enum machine_mode mode;
int total_bits = BITS_PER_WORD;
......@@ -794,7 +798,7 @@ store_split_bit_field (op0, bitsize, bitpos, value, align)
rtx op0;
int bitsize, bitpos;
rtx value;
int align;
unsigned int align;
{
int unit;
int bitsdone = 0;
......@@ -951,7 +955,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
int unsignedp;
rtx target;
enum machine_mode mode, tmode;
int align;
unsigned int align;
int total_size;
{
int unit = (GET_CODE (str_rtx) == MEM) ? BITS_PER_UNIT : BITS_PER_WORD;
......@@ -1391,7 +1395,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
if (bestmode == VOIDmode
|| (SLOW_UNALIGNED_ACCESS (bestmode, align)
&& GET_MODE_SIZE (bestmode) > align))
&& GET_MODE_SIZE (bestmode) > (int) align))
goto extv_loses;
/* Compute offset as multiple of this unit,
......@@ -1530,7 +1534,7 @@ extract_fixed_bit_field (tmode, op0, offset, bitsize, bitpos,
register rtx op0, target;
register int offset, bitsize, bitpos;
int unsignedp;
int align;
unsigned int align;
{
int total_bits = BITS_PER_WORD;
enum machine_mode mode;
......@@ -1748,7 +1752,8 @@ lshift_value (mode, value, bitpos, bitsize)
static rtx
extract_split_bit_field (op0, bitsize, bitpos, unsignedp, align)
rtx op0;
int bitsize, bitpos, unsignedp, align;
int bitsize, bitpos, unsignedp;
unsigned int align;
{
int unit;
int bitsdone = 0;
......
......@@ -942,10 +942,11 @@ extern void convert_move PARAMS ((rtx, rtx, int));
extern rtx convert_to_mode PARAMS ((enum machine_mode, rtx, int));
/* Convert an rtx to MODE from OLDMODE and return the result. */
extern rtx convert_modes PARAMS ((enum machine_mode, enum machine_mode, rtx, int));
extern rtx convert_modes PARAMS ((enum machine_mode, enum machine_mode,
rtx, int));
/* Emit code to move a block Y to a block X. */
extern rtx emit_block_move PARAMS ((rtx, rtx, rtx, int));
extern rtx emit_block_move PARAMS ((rtx, rtx, rtx, unsigned int));
/* Copy all or part of a value X into registers starting at REGNO.
The number of registers to be filled is NREGS. */
......@@ -957,10 +958,11 @@ extern void move_block_from_reg PARAMS ((int, rtx, int, int));
/* Load a BLKmode value into non-consecutive registers represented by a
PARALLEL. */
extern void emit_group_load PARAMS ((rtx, rtx, int, int));
extern void emit_group_load PARAMS ((rtx, rtx, int, unsigned int));
/* Store a BLKmode value from non-consecutive registers represented by a
PARALLEL. */
extern void emit_group_store PARAMS ((rtx, rtx, int, int));
extern void emit_group_store PARAMS ((rtx, rtx, int, unsigned int));
#ifdef TREE_CODE
/* Copy BLKmode object from a set of registers. */
......@@ -969,16 +971,18 @@ extern rtx copy_blkmode_from_reg PARAMS ((rtx,rtx,tree));
/* Mark REG as holding a parameter for the next CALL_INSN. */
extern void use_reg PARAMS ((rtx *, rtx));
/* Mark NREGS consecutive regs, starting at REGNO, as holding parameters
for the next CALL_INSN. */
extern void use_regs PARAMS ((rtx *, int, int));
/* Mark a PARALLEL as holding a parameter for the next CALL_INSN. */
extern void use_group_regs PARAMS ((rtx *, rtx));
/* Write zeros through the storage of OBJECT.
If OBJECT has BLKmode, SIZE is its length in bytes and ALIGN is its
alignment. */
extern rtx clear_storage PARAMS ((rtx, rtx, int));
extern rtx clear_storage PARAMS ((rtx, rtx, unsigned int));
/* Emit insns to set X from Y. */
extern rtx emit_move_insn PARAMS ((rtx, rtx));
......@@ -995,8 +999,9 @@ extern rtx gen_push_operand PARAMS ((void));
#ifdef TREE_CODE
/* Generate code to push something onto the stack, given its mode and type. */
extern void emit_push_insn PARAMS ((rtx, enum machine_mode, tree, rtx, int,
int, rtx, int, rtx, rtx, int, rtx));
extern void emit_push_insn PARAMS ((rtx, enum machine_mode, tree, rtx,
unsigned int, int, rtx, int, rtx, rtx,
int, rtx));
/* Emit library call. */
extern void emit_library_call PARAMS ((rtx orgfun, int no_queue,
......@@ -1056,10 +1061,10 @@ extern void do_jump PARAMS ((tree, rtx, rtx));
/* Generate rtl to compare two rtx's, will call emit_cmp_insn. */
extern rtx compare_from_rtx PARAMS ((rtx, rtx, enum rtx_code, int,
enum machine_mode, rtx, int));
enum machine_mode, rtx, unsigned int));
extern void do_compare_rtx_and_jump PARAMS ((rtx, rtx, enum rtx_code, int,
enum machine_mode, rtx, int,
rtx, rtx));
enum machine_mode, rtx,
unsigned int, rtx, rtx));
/* Generate a tablejump instruction (used for switch statements). */
extern void do_tablejump PARAMS ((rtx, enum machine_mode, rtx, rtx, rtx));
......@@ -1193,8 +1198,11 @@ extern rtx hard_libcall_value PARAMS ((enum machine_mode));
of STACK_BOUNDARY / BITS_PER_UNIT. */
extern rtx round_push PARAMS ((rtx));
extern rtx store_bit_field PARAMS ((rtx, int, int, enum machine_mode, rtx, int, int));
extern rtx extract_bit_field PARAMS ((rtx, int, int, int, rtx, enum machine_mode, enum machine_mode, int, int));
extern rtx store_bit_field PARAMS ((rtx, int, int, enum machine_mode, rtx,
unsigned int, int));
extern rtx extract_bit_field PARAMS ((rtx, int, int, int, rtx,
enum machine_mode, enum machine_mode,
unsigned int, int));
extern rtx expand_mult PARAMS ((enum machine_mode, rtx, rtx, rtx, int));
extern rtx expand_mult_add PARAMS ((rtx, rtx, rtx, rtx,enum machine_mode, int));
extern rtx expand_mult_highpart_adjust PARAMS ((enum machine_mode, rtx, rtx, rtx, rtx, int));
......
......@@ -251,7 +251,7 @@ add_double (l1, h1, l2, h2, lv, hv)
HOST_WIDE_INT l, h;
l = l1 + l2;
h = h1 + h2 + ((unsigned HOST_WIDE_INT) l < l1);
h = h1 + h2 + ((unsigned HOST_WIDE_INT) l < (unsigned HOST_WIDE_INT) l1);
*lv = l;
*hv = h;
......
......@@ -120,13 +120,14 @@ extern enum machine_mode int_mode_for_mode PARAMS ((enum machine_mode));
/* Find the best mode to use to access a bit field. */
extern enum machine_mode get_best_mode PARAMS ((int, int, int, enum machine_mode, int));
extern enum machine_mode get_best_mode PARAMS ((int, int, unsigned int,
enum machine_mode, int));
/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */
#define GET_MODE_ALIGNMENT(MODE) \
MIN (BIGGEST_ALIGNMENT, \
MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
(unsigned int) MIN (BIGGEST_ALIGNMENT, \
MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
/* For each class, get the narrowest mode in that class. */
......
......@@ -1524,7 +1524,7 @@ extern int preserve_subexpressions_p PARAMS ((void));
/* In expr.c */
extern void init_expr_once PARAMS ((void));
extern void move_by_pieces PARAMS ((rtx, rtx, int, int));
extern void move_by_pieces PARAMS ((rtx, rtx, int, unsigned int));
/* In stupid.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. */
......
......@@ -1766,6 +1766,7 @@ extern tree non_lvalue PARAMS ((tree));
extern tree pedantic_non_lvalue PARAMS ((tree));
extern tree convert PARAMS ((tree, tree));
extern unsigned int expr_align PARAMS ((tree));
extern tree size_in_bytes PARAMS ((tree));
extern HOST_WIDE_INT int_size_in_bytes PARAMS ((tree));
extern tree size_binop PARAMS ((enum tree_code, tree, tree));
......@@ -1806,10 +1807,10 @@ extern struct sizetype_tab sizetype_tab;
#define ubitsizetype sizetype_tab.xubitsizetype
/* If nonzero, an upper limit on alignment of structure fields, in bits. */
extern int maximum_field_alignment;
extern unsigned int maximum_field_alignment;
/* If non-zero, the alignment of a bitstring or (power-)set value, in bits. */
extern int set_alignment;
extern unsigned int set_alignment;
/* Concatenate two lists (chains of TREE_LIST nodes) X and Y
by making the last node in X point to Y.
......@@ -1995,7 +1996,7 @@ extern tree maybe_build_cleanup PARAMS ((tree));
extern tree get_inner_reference PARAMS ((tree, int *, int *, tree *,
enum machine_mode *, int *,
int *, int *));
int *, unsigned int *));
/* Given a DECL or TYPE, return the scope in which it was declared, or
NUL_TREE if there is no containing scope. */
......
......@@ -1511,7 +1511,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
* (BIGGEST_ALIGNMENT / BITS_PER_UNIT));
#if !defined(ASM_OUTPUT_ALIGNED_COMMON) && !defined(ASM_OUTPUT_ALIGNED_BSS)
if ( (DECL_ALIGN (decl) / BITS_PER_UNIT) > rounded)
if ((DECL_ALIGN (decl) / BITS_PER_UNIT) > (unsigned int) rounded)
warning_with_decl
(decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment