expmed.c (extract_bit_field): Ensure BITS_PER_WORD is signed in MAX.

* expmed.c (extract_bit_field): Ensure BITS_PER_WORD is signed in MAX.
	* config/arm/pe.c (arm_pe_return_in_memory): Use host_integerp and
	int_bit_position.
	* config/mips/mips.c (function_arg): Likewise; also remove cast
	and make variables unsigned or HOST_WIDE_INT and use tree_low_cst.
	(mips_function_value): Use int_byte_position and make HOST_WIDE_INT.
	* config/mips/abi64.h (SETUP_INCOMING_VARARGS): Offsets are unsigned.
	* config/mips/mips.h (BITS_PER_WORD, UNITS_PER_WORD): Cast to unsigned.
	(UNITS_PER_FPREG, INT_TYPE_SIZE, LONG_TYPE_SIZE): Likewise.
	(POINTER_SIZE, POINTER_BOUNDARY,PARM_BOUNDARY): Likewise.
	(GP_REG_P, FP_REG_P, MD_REG_P, ST_REG_P): Ensure subtraction signed.
	(struct mips_arg): arg_number, arg_words, fp_arg_words, and
	num_adjusts now unsigned.
	(FUNCTION_ARG_BOUNDARY): Remove unneeded cast.
	* config/sparc/sparc.c (struct function_arg_record_value_parms):
	NREGS now unsigned.
	(function_arg_record_value_1): STARTBITPOS arg now HOST_WIDE_INT
	as is BITPOS variable; use host_integerp and int_bit_position.
	(function_arg_record_value_2): Likewise.
	(function_arg_record_value_3): Arg BITPOS now HOST_WIDE_INT.
	Variable REGNO now unsigned.
	(function_arg_record_value): NREGS now unsigned.

From-SVN: r32748
This commit is contained in:
Richard Kenner 2000-03-26 16:46:27 +00:00 committed by Richard Kenner
parent 210ee0dd95
commit 751312371e
7 changed files with 108 additions and 74 deletions

View File

@ -1,7 +1,33 @@
Sun Mar 26 11:37:55 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expmed.c (extract_bit_field): Ensure BITS_PER_WORD is signed in MAX.
* config/arm/pe.c (arm_pe_return_in_memory): Use host_integerp and
int_bit_position.
* config/mips/mips.c (function_arg): Likewise; also remove cast
and make variables unsigned or HOST_WIDE_INT and use tree_low_cst.
(mips_function_value): Use int_byte_position and make HOST_WIDE_INT.
* config/mips/abi64.h (SETUP_INCOMING_VARARGS): Offsets are unsigned.
* config/mips/mips.h (BITS_PER_WORD, UNITS_PER_WORD): Cast to unsigned.
(UNITS_PER_FPREG, INT_TYPE_SIZE, LONG_TYPE_SIZE): Likewise.
(POINTER_SIZE, POINTER_BOUNDARY,PARM_BOUNDARY): Likewise.
(GP_REG_P, FP_REG_P, MD_REG_P, ST_REG_P): Ensure subtraction signed.
(struct mips_arg): arg_number, arg_words, fp_arg_words, and
num_adjusts now unsigned.
(FUNCTION_ARG_BOUNDARY): Remove unneeded cast.
* config/sparc/sparc.c (struct function_arg_record_value_parms):
NREGS now unsigned.
(function_arg_record_value_1): STARTBITPOS arg now HOST_WIDE_INT
as is BITPOS variable; use host_integerp and int_bit_position.
(function_arg_record_value_2): Likewise.
(function_arg_record_value_3): Arg BITPOS now HOST_WIDE_INT.
Variable REGNO now unsigned.
(function_arg_record_value): NREGS now unsigned.
2000-03-26 Bernd Schmidt <bernds@cygnus.co.uk>
* jump.c (mark_all_labels): Handle CALL_PLACEHOLDERs.
Sat Mar 25 09:12:10 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* Rework fields used to describe positions of bitfields and

View File

@ -474,8 +474,10 @@ arm_pe_return_in_memory (type)
if (TREE_CODE (field) == FIELD_DECL
&& ! TREE_STATIC (field)
&& (! DECL_BIT_FIELD_TYPE (field)
|| (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
+ TREE_INT_CST_LOW (DECL_SIZE (field))) > 32))
|| (host_integerp (DECL_SIZE (field), 1)
&& host_integerp (bit_position (field), 1)
&& 32 < (int_bit_position (field)
+ tree_low_cst (DECL_SIZE (field), 1)))))
return 1;
}
return 0;

View File

@ -105,19 +105,21 @@ extern struct rtx_def *mips_function_value PARAMS ((union tree_node *, union tre
For stdarg, we do not need to save the current argument, because it
is a real argument. */
#define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \
{ int mips_off = (! current_function_varargs) && (! (CUM).last_arg_fp); \
int mips_fp_off = (! current_function_varargs) && ((CUM).last_arg_fp); \
{ unsigned int mips_off \
= (! current_function_varargs) && (! (CUM).last_arg_fp); \
unsigned int mips_fp_off \
= (! current_function_varargs) && ((CUM).last_arg_fp); \
if (((mips_abi != ABI_32 && mips_abi != ABI_O64) \
&& (CUM).arg_words < MAX_ARGS_IN_REGISTERS - mips_off) \
|| (mips_abi == ABI_EABI \
&& ! TARGET_SOFT_FLOAT \
&& (CUM).fp_arg_words < MAX_ARGS_IN_REGISTERS - mips_fp_off)) \
{ \
int mips_save_gp_regs = \
MAX_ARGS_IN_REGISTERS - (CUM).arg_words - mips_off; \
int mips_save_fp_regs = \
(mips_abi != ABI_EABI ? 0 \
: MAX_ARGS_IN_REGISTERS - (CUM).fp_arg_words - mips_fp_off); \
int mips_save_gp_regs \
= MAX_ARGS_IN_REGISTERS - (CUM).arg_words - mips_off; \
int mips_save_fp_regs \
= (mips_abi != ABI_EABI ? 0 \
: MAX_ARGS_IN_REGISTERS - (CUM).fp_arg_words - mips_fp_off); \
\
if (mips_save_gp_regs < 0) \
mips_save_gp_regs = 0; \

View File

@ -3801,7 +3801,7 @@ function_arg (cum, mode, type, named)
/* Drops through. */
case BLKmode:
if (type != (tree)0 && TYPE_ALIGN (type) > (unsigned) BITS_PER_WORD
if (type != NULL_TREE && TYPE_ALIGN (type) > BITS_PER_WORD
&& ! TARGET_64BIT && mips_abi != ABI_EABI)
cum->arg_words += (cum->arg_words & 1);
regbase = GP_ARG_FIRST;
@ -3833,7 +3833,8 @@ function_arg (cum, mode, type, named)
abort ();
if (! type || TREE_CODE (type) != RECORD_TYPE || mips_abi == ABI_32
|| mips_abi == ABI_EABI || mips_abi == ABI_O64 || ! named)
|| mips_abi == ABI_EABI || mips_abi == ABI_O64 || ! named
|| ! host_integerp (TYPE_SIZE_UNIT (type), 1))
ret = gen_rtx_REG (mode, regbase + *arg_words + bias);
else
{
@ -3847,8 +3848,8 @@ function_arg (cum, mode, type, named)
if (TREE_CODE (field) == FIELD_DECL
&& TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
&& (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
% BITS_PER_WORD == 0))
&& host_integerp (bit_position (field), 0)
&& int_bit_position (field) % BITS_PER_WORD == 0)
break;
/* If the whole struct fits a DFmode register,
@ -3859,15 +3860,16 @@ function_arg (cum, mode, type, named)
{
/* Now handle the special case by returning a PARALLEL
indicating where each 64 bit chunk goes. */
int chunks;
int bitpos;
int regno;
unsigned int chunks;
HOST_WIDE_INT bitpos;
unsigned int regno;
int i;
/* ??? If this is a packed structure, then the last hunk won't
be 64 bits. */
chunks = TREE_INT_CST_LOW (TYPE_SIZE (type)) / BITS_PER_WORD;
chunks
= tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD;
if (chunks + *arg_words + bias > MAX_ARGS_IN_REGISTERS)
chunks = MAX_ARGS_IN_REGISTERS - *arg_words - bias;
@ -3884,12 +3886,11 @@ function_arg (cum, mode, type, named)
for (; field; field = TREE_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL
&& (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))
>= bitpos))
&& int_bit_position (field) >= bitpos)
break;
if (field
&& TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field)) == bitpos
&& int_bit_position (field) == bitpos
&& TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD)
reg = gen_rtx_REG (DFmode,
@ -7417,10 +7418,8 @@ mips_function_value (valtype, func)
= TYPE_MODE (TREE_TYPE (fields[0]));
enum machine_mode second_mode
= TYPE_MODE (TREE_TYPE (fields[1]));
int first_offset
= TREE_INT_CST_LOW (DECL_FIELD_BITPOS (fields[0]));
int second_offset
= TREE_INT_CST_LOW (DECL_FIELD_BITPOS (fields[1]));
HOST_WIDE_INT first_offset = int_byte_position (fields[0]);
HOST_WIDE_INT second_offset = int_byte_position (fields[1]);
return gen_rtx_PARALLEL
(mode,
@ -7428,13 +7427,11 @@ mips_function_value (valtype, func)
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (first_mode,
FP_RETURN),
GEN_INT (first_offset
/ BITS_PER_UNIT)),
GEN_INT (first_offset)),
gen_rtx_EXPR_LIST (VOIDmode,
gen_rtx_REG (second_mode,
FP_RETURN + 2),
GEN_INT (second_offset
/ BITS_PER_UNIT))));
GEN_INT (second_offset))));
}
}
}

View File

@ -1295,20 +1295,20 @@ do { \
Note that this is not necessarily the width of data type `int';
if using 16-bit ints on a 68000, this would still be 32.
But on a machine with 16-bit registers, this would be 16. */
#define BITS_PER_WORD (TARGET_64BIT ? 64 : 32)
#define BITS_PER_WORD ((unsigned int) (TARGET_64BIT ? 64 : 32))
#define MAX_BITS_PER_WORD 64
/* Width of a word, in units (bytes). */
#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4)
#define UNITS_PER_WORD ((unsigned int) (TARGET_64BIT ? 8 : 4))
#define MIN_UNITS_PER_WORD 4
/* For MIPS, width of a floating point register. */
#define UNITS_PER_FPREG (TARGET_FLOAT64 ? 8 : 4)
#define UNITS_PER_FPREG ((unsigned int) (TARGET_FLOAT64 ? 8 : 4))
/* A C expression for the size in bits of the type `int' on the
target machine. If you don't define this, the default is one
word. */
#define INT_TYPE_SIZE (TARGET_INT64 ? 64 : 32)
#define INT_TYPE_SIZE ((unsigned int) (TARGET_INT64 ? 64 : 32))
#define MAX_INT_TYPE_SIZE 64
/* Tell the preprocessor the maximum size of wchar_t. */
@ -1327,7 +1327,7 @@ do { \
/* A C expression for the size in bits of the type `long' on the
target machine. If you don't define this, the default is one
word. */
#define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32)
#define LONG_TYPE_SIZE ((unsigned int) (TARGET_LONG64 ? 64 : 32))
#define MAX_LONG_TYPE_SIZE 64
/* A C expression for the size in bits of the type `long long' on the
@ -1359,14 +1359,14 @@ do { \
/* Width in bits of a pointer.
See also the macro `Pmode' defined below. */
#ifndef POINTER_SIZE
#define POINTER_SIZE (Pmode == DImode ? 64 : 32)
#define POINTER_SIZE ((unsigned int) (Pmode == DImode ? 64 : 32))
#endif
/* Allocation boundary (in *bits*) for storing pointers in memory. */
#define POINTER_BOUNDARY (Pmode == DImode ? 64 : 32)
#define POINTER_BOUNDARY ((unsigned int) (Pmode == DImode ? 64 : 32))
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
#define PARM_BOUNDARY ((unsigned int) (TARGET_64BIT ? 64 : 32))
/* Allocation boundary (in *bits*) for the code of a function. */
#define FUNCTION_BOUNDARY 32
@ -1421,9 +1421,7 @@ do { \
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
&& (ALIGN) < BITS_PER_WORD \
? BITS_PER_WORD \
: (ALIGN))
&& (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN))
/* If defined, a C expression to compute the alignment for a static
variable. TYPE is the data type, and ALIGN is the alignment that
@ -1582,12 +1580,16 @@ do { \
should be used instead. */
#define FPSW_REGNUM ST_REG_FIRST
#define GP_REG_P(REGNO) ((unsigned) ((REGNO) - GP_REG_FIRST) < GP_REG_NUM)
#define GP_REG_P(REGNO) \
((unsigned int) ((int) (REGNO) - GP_REG_FIRST) < GP_REG_NUM)
#define M16_REG_P(REGNO) \
(((REGNO) >= 2 && (REGNO) <= 7) || (REGNO) == 16 || (REGNO) == 17)
#define FP_REG_P(REGNO) ((unsigned) ((REGNO) - FP_REG_FIRST) < FP_REG_NUM)
#define MD_REG_P(REGNO) ((unsigned) ((REGNO) - MD_REG_FIRST) < MD_REG_NUM)
#define ST_REG_P(REGNO) ((unsigned) ((REGNO) - ST_REG_FIRST) < ST_REG_NUM)
#define FP_REG_P(REGNO) \
((unsigned int) ((int) (REGNO) - FP_REG_FIRST) < FP_REG_NUM)
#define MD_REG_P(REGNO) \
((unsigned int) ((int) (REGNO) - MD_REG_FIRST) < MD_REG_NUM)
#define ST_REG_P(REGNO) \
((unsigned int) ((int) (REGNO) - ST_REG_FIRST) < ST_REG_NUM)
/* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE.
@ -2453,12 +2455,12 @@ extern struct mips_frame_info current_frame_info;
typedef struct mips_args {
int gp_reg_found; /* whether a gp register was found yet */
int arg_number; /* argument number */
int arg_words; /* # total words the arguments take */
int fp_arg_words; /* # words for FP args (MIPS_EABI only) */
unsigned int arg_number; /* argument number */
unsigned int arg_words; /* # total words the arguments take */
unsigned int fp_arg_words; /* # words for FP args (MIPS_EABI only) */
int last_arg_fp; /* nonzero if last arg was FP (EABI only) */
int fp_code; /* Mode of FP arguments (mips16) */
int num_adjusts; /* number of adjustments made */
unsigned int num_adjusts; /* number of adjustments made */
/* Adjustments made to args pass in regs. */
/* ??? The size is doubled to work around a
bug in the code that sets the adjustments
@ -2511,7 +2513,7 @@ typedef struct mips_args {
#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
(((TYPE) != 0) \
? ((TYPE_ALIGN(TYPE) <= (unsigned)PARM_BOUNDARY) \
? ((TYPE_ALIGN(TYPE) <= PARM_BOUNDARY) \
? PARM_BOUNDARY \
: TYPE_ALIGN(TYPE)) \
: ((GET_MODE_ALIGNMENT(MODE) <= PARM_BOUNDARY) \

View File

@ -4057,22 +4057,25 @@ struct function_arg_record_value_parms
{
rtx ret;
int slotno, named, regbase;
int nregs, intoffset;
unsigned int nregs;
int intoffset;
};
static void function_arg_record_value_3
PARAMS ((int, struct function_arg_record_value_parms *));
PARAMS ((HOST_WIDE_INT, struct function_arg_record_value_parms *));
static void function_arg_record_value_2
PARAMS ((tree, int, struct function_arg_record_value_parms *));
PARAMS ((tree, HOST_WIDE_INT,
struct function_arg_record_value_parms *));
static void function_arg_record_value_1
PARAMS ((tree, int, struct function_arg_record_value_parms *));
PARAMS ((tree, HOST_WIDE_INT,
struct function_arg_record_value_parms *));
static rtx function_arg_record_value
PARAMS ((tree, enum machine_mode, int, int, int));
static void
function_arg_record_value_1 (type, startbitpos, parms)
tree type;
int startbitpos;
HOST_WIDE_INT startbitpos;
struct function_arg_record_value_parms *parms;
{
tree field;
@ -4100,15 +4103,16 @@ function_arg_record_value_1 (type, startbitpos, parms)
{
if (TREE_CODE (field) == FIELD_DECL)
{
int bitpos = startbitpos;
if (DECL_FIELD_BITPOS (field))
bitpos += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
HOST_WIDE_INT bitpos = startbitpos;
if (DECL_SIZE (field) != 0
&& host_integerp (bit_position (field), 1))
bitpos += int_bit_position (field);
/* ??? FIXME: else assume zero offset. */
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE)
{
function_arg_record_value_1 (TREE_TYPE (field), bitpos, parms);
}
function_arg_record_value_1 (TREE_TYPE (field), bitpos, parms);
else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
&& TARGET_FPU
&& ! packed_p
@ -4146,15 +4150,17 @@ function_arg_record_value_1 (type, startbitpos, parms)
static void
function_arg_record_value_3 (bitpos, parms)
int bitpos;
HOST_WIDE_INT bitpos;
struct function_arg_record_value_parms *parms;
{
enum machine_mode mode;
int regno, this_slotno, intslots, intoffset;
unsigned int regno;
int this_slotno, intslots, intoffset;
rtx reg;
if (parms->intoffset == -1)
return;
intoffset = parms->intoffset;
parms->intoffset = -1;
@ -4171,10 +4177,8 @@ function_arg_record_value_3 (bitpos, parms)
at the moment but may wish to revisit. */
if (intoffset % BITS_PER_WORD != 0)
{
mode = mode_for_size (BITS_PER_WORD - intoffset%BITS_PER_WORD,
MODE_INT, 0);
}
mode = mode_for_size (BITS_PER_WORD - intoffset % BITS_PER_WORD,
MODE_INT, 0);
else
mode = word_mode;
@ -4197,7 +4201,7 @@ function_arg_record_value_3 (bitpos, parms)
static void
function_arg_record_value_2 (type, startbitpos, parms)
tree type;
int startbitpos;
HOST_WIDE_INT startbitpos;
struct function_arg_record_value_parms *parms;
{
tree field;
@ -4216,15 +4220,16 @@ function_arg_record_value_2 (type, startbitpos, parms)
{
if (TREE_CODE (field) == FIELD_DECL)
{
int bitpos = startbitpos;
if (DECL_FIELD_BITPOS (field))
bitpos += TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field));
HOST_WIDE_INT bitpos = startbitpos;
if (DECL_SIZE (field) != 0
&& host_integerp (bit_position (field), 1))
bitpos += int_bit_position (field);
/* ??? FIXME: else assume zero offset. */
if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE)
{
function_arg_record_value_2 (TREE_TYPE (field), bitpos, parms);
}
function_arg_record_value_2 (TREE_TYPE (field), bitpos, parms);
else if (TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
&& TARGET_FPU
&& ! packed_p
@ -4261,7 +4266,7 @@ function_arg_record_value (type, mode, slotno, named, regbase)
{
HOST_WIDE_INT typesize = int_size_in_bytes (type);
struct function_arg_record_value_parms parms;
int nregs;
unsigned int nregs;
parms.ret = NULL_RTX;
parms.slotno = slotno;

View File

@ -1138,7 +1138,7 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp,
/* Offset from start of field in OP0. */
unsigned int bit_offset = (WORDS_BIG_ENDIAN
? MAX (0, ((int) bitsize - ((int) i + 1)
* BITS_PER_WORD))
* (int) BITS_PER_WORD))
: (int) i * BITS_PER_WORD);
rtx target_part = operand_subword (target, wordnum, 1, VOIDmode);
rtx result_part