*** empty log message ***

From-SVN: r1473
This commit is contained in:
Richard Kenner 1992-07-06 16:04:13 -04:00
parent b1ec3c9262
commit 906c4e36c6
8 changed files with 820 additions and 690 deletions

409
gcc/cse.c

File diff suppressed because it is too large Load Diff

View File

@ -1498,7 +1498,7 @@ output_bound_representation (bound, dim_num, u_or_l)
if (! optimize)
output_loc_descriptor
(eliminate_regs (SAVE_EXPR_RTL (bound), 0, 0));
(eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX));
ASM_OUTPUT_LABEL (asm_out_file, end_label);
}
@ -1573,7 +1573,7 @@ location_attribute (rtl)
declaration, but not a definition. So sayeth the PLSIG. */
if (! is_pseudo_reg (rtl))
output_loc_descriptor (eliminate_regs (rtl, 0, 0));
output_loc_descriptor (eliminate_regs (rtl, 0, NULL_RTX));
ASM_OUTPUT_LABEL (asm_out_file, end_label);
}
@ -1783,8 +1783,8 @@ const_value_attribute (rtl)
simplicity we always just output CONST_DOUBLEs using 8 bytes. */
ASM_OUTPUT_DWARF_DATA8 (asm_out_file,
(unsigned) CONST_DOUBLE_HIGH (rtl),
(unsigned) CONST_DOUBLE_LOW (rtl));
(unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (rtl),
(unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (rtl));
break;
case CONST_STRING:
@ -4320,7 +4320,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
fputc ('\n', asm_out_file);
ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION);
finalizing = set_finalizing;
output_decl (decl, NULL);
output_decl (decl, NULL_TREE);
/* NOTE: The call above to `output_decl' may have caused one or more
file-scope named types (i.e. tagged types) to be placed onto the
@ -4333,7 +4333,7 @@ dwarfout_file_scope_decl (decl, set_finalizing)
`output_pending_types_for_scope' takes them off of the list and un-sets
their TREE_ASM_WRITTEN flags. */
output_pending_types_for_scope (NULL);
output_pending_types_for_scope (NULL_TREE);
/* The above call should have totally emptied the pending_types_list. */

View File

@ -247,7 +247,7 @@ gen_rtx (va_alist)
if (code == CONST_INT)
{
int arg = va_arg (p, int);
HOST_WIDE_INT arg = va_arg (p, HOST_WIDE_INT);
if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT)
return const_int_rtx[arg + MAX_SAVED_CONST_INT];
@ -306,6 +306,10 @@ gen_rtx (va_alist)
XINT (rt_val, i) = va_arg (p, int);
break;
case 'w': /* A wide integer? */
XWINT (rt_val, i) = va_arg (p, HOST_WIDE_INT);
break;
case 's': /* A string? */
XSTR (rt_val, i) = va_arg (p, char *);
break;
@ -538,25 +542,26 @@ gen_lowpart_common (mode, x)
either a reasonable negative value or a reasonable unsigned value
for this mode. */
if (GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_INT)
if (GET_MODE_BITSIZE (mode) == 2 * HOST_BITS_PER_WIDE_INT)
return x;
else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_INT)
else if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
return 0;
else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_INT)
else if (GET_MODE_BITSIZE (mode) == HOST_BITS_PER_WIDE_INT)
return (GET_CODE (x) == CONST_INT ? x
: gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (x)));
: GEN_INT (CONST_DOUBLE_LOW (x)));
else
{
/* MODE must be narrower than HOST_BITS_PER_INT. */
int width = GET_MODE_BITSIZE (mode);
int val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
: CONST_DOUBLE_LOW (x));
HOST_WIDE_INT val = (GET_CODE (x) == CONST_INT ? INTVAL (x)
: CONST_DOUBLE_LOW (x));
if (((val & ((-1) << (width - 1))) != ((-1) << (width - 1))))
val &= (1 << width) - 1;
if (((val & ((HOST_WIDE_INT) (-1) << (width - 1)))
!= ((HOST_WIDE_INT) (-1) << (width - 1))))
val &= ((HOST_WIDE_INT) 1 << width) - 1;
return (GET_CODE (x) == CONST_INT && INTVAL (x) == val ? x
: gen_rtx (CONST_INT, VOIDmode, val));
: GEN_INT (val));
}
}
@ -567,33 +572,34 @@ gen_lowpart_common (mode, x)
different. */
else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == UNITS_PER_WORD
&& GET_CODE (x) == CONST_INT
&& sizeof (float) * HOST_BITS_PER_CHAR == HOST_BITS_PER_INT)
&& sizeof (float) * HOST_BITS_PER_CHAR == HOST_BITS_PER_WIDE_INT)
{
union {int i; float d; } u;
union {HOST_WIDE_INT i; float d; } u;
u.i = INTVAL (x);
return immed_real_const_1 (u.d, mode);
}
else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& (GET_CODE (x) == CONST_INT || GET_CODE (x) == CONST_DOUBLE)
&& GET_MODE (x) == VOIDmode
&& sizeof (double) * HOST_BITS_PER_CHAR == 2 * HOST_BITS_PER_INT)
&& (sizeof (double) * HOST_BITS_PER_CHAR
== 2 * HOST_BITS_PER_WIDE_INT))
{
union {int i[2]; double d; } u;
int low, high;
union {HOST_WIDE_INT i[2]; double d; } u;
HOST_WIDE_INT low, high;
if (GET_CODE (x) == CONST_INT)
low = INTVAL (x), high = low >> (HOST_BITS_PER_INT -1);
low = INTVAL (x), high = low >> (HOST_BITS_PER_WIDE_INT -1);
else
low = CONST_DOUBLE_LOW (x), high = CONST_DOUBLE_HIGH (x);
@ -611,7 +617,7 @@ gen_lowpart_common (mode, x)
compatible. */
else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_INT
&& GET_CODE (x) == CONST_DOUBLE
@ -625,7 +631,7 @@ gen_lowpart_common (mode, x)
compatible. */
else if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_INT
&& GET_CODE (x) == CONST_DOUBLE
@ -725,8 +731,8 @@ operand_subword (op, i, validate_address, mode)
int validate_address;
enum machine_mode mode;
{
int val;
int size_ratio = HOST_BITS_PER_INT / BITS_PER_WORD;
HOST_WIDE_INT val;
int size_ratio = HOST_BITS_PER_WIDE_INT / BITS_PER_WORD;
if (mode == VOIDmode)
mode = GET_MODE (op);
@ -793,13 +799,12 @@ operand_subword (op, i, validate_address, mode)
target floating formats are the same, handling two-word floating
constants are easy. */
if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
&& GET_CODE (op) == CONST_DOUBLE)
return gen_rtx (CONST_INT, VOIDmode,
i ^ (WORDS_BIG_ENDIAN !=
return GEN_INT (i ^ (WORDS_BIG_ENDIAN !=
/* The constant is stored in the host's word-ordering,
but we want to access it in the target's word-ordering. */
#ifdef HOST_WORDS_BIG_ENDIAN
@ -813,19 +818,19 @@ operand_subword (op, i, validate_address, mode)
values often do not have the same high-order bits. We have already
verified that we want the only defined word of the single-word value. */
if (((HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
&& HOST_BITS_PER_INT == BITS_PER_WORD)
&& HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
|| flag_pretend_float)
&& GET_MODE_CLASS (mode) == MODE_FLOAT
&& GET_MODE_SIZE (mode) == UNITS_PER_WORD
&& GET_CODE (op) == CONST_DOUBLE)
{
double d;
union {float f; int i; } u;
union {float f; HOST_WIDE_INT i; } u;
REAL_VALUE_FROM_CONST_DOUBLE (d, op);
u.f = d;
return gen_rtx (CONST_INT, VOIDmode, u.i);
return GEN_INT (u.i);
}
/* The only remaining cases that we can handle are integers.
@ -854,11 +859,12 @@ operand_subword (op, i, validate_address, mode)
? (INTVAL (op) < 0 ? ~0 : 0) : CONST_DOUBLE_HIGH (op)));
/* If BITS_PER_WORD is smaller than an int, get the appropriate bits. */
if (BITS_PER_WORD < HOST_BITS_PER_INT)
if (BITS_PER_WORD < HOST_BITS_PER_WIDE_INT)
val = ((val >> ((i % size_ratio) * BITS_PER_WORD))
& ((1 << (BITS_PER_WORD % HOST_BITS_PER_INT)) - 1));
& (((HOST_WIDE_INT) 1
<< (BITS_PER_WORD % HOST_BITS_PER_WIDE_INT)) - 1));
return gen_rtx (CONST_INT, VOIDmode, val);
return GEN_INT (val);
}
/* Similar to `operand_subword', but never return 0. If we can't extract
@ -965,7 +971,8 @@ change_address (memref, mode, addr)
rtx
gen_label_rtx ()
{
register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0, label_num++, 0);
register rtx label = gen_rtx (CODE_LABEL, VOIDmode, 0, 0, 0,
label_num++, NULL_PTR);
LABEL_NUSES (label) = 0;
return label;
}
@ -991,7 +998,7 @@ gen_inline_header_rtx (first_insn, first_parm_insn, first_labelno,
rtx original_decl_initial;
{
rtx header = gen_rtx (INLINE_HEADER, VOIDmode,
cur_insn_uid++, NULL,
cur_insn_uid++, NULL_RTX,
first_insn, first_parm_insn,
first_labelno, last_labelno,
max_parm_regnum, max_regnum, args_size, pops_args,
@ -1577,7 +1584,7 @@ rtx
next_cc0_user (insn)
rtx insn;
{
rtx note = find_reg_note (insn, REG_CC_USER, 0);
rtx note = find_reg_note (insn, REG_CC_USER, NULL_RTX);
if (note)
return XEXP (note, 0);
@ -1600,7 +1607,7 @@ rtx
prev_cc0_setter (insn)
rtx insn;
{
rtx note = find_reg_note (insn, REG_CC_SETTER, 0);
rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
rtx link;
if (note)
@ -1903,7 +1910,7 @@ emit_insn_before (pattern, before)
}
else
{
insn = make_insn_raw (pattern, 0);
insn = make_insn_raw (pattern, NULL_RTVEC);
add_insn_after (insn, PREV_INSN (before));
}
@ -1923,7 +1930,7 @@ emit_jump_insn_before (pattern, before)
insn = emit_insn_before (pattern, before);
else
{
insn = make_jump_insn_raw (pattern, 0);
insn = make_jump_insn_raw (pattern, NULL_RTVEC);
add_insn_after (insn, PREV_INSN (before));
}
@ -1997,7 +2004,7 @@ emit_insn_after (pattern, after)
}
else
{
insn = make_insn_raw (pattern, 0);
insn = make_insn_raw (pattern, NULL_RTVEC);
add_insn_after (insn, after);
}
@ -2017,7 +2024,7 @@ emit_jump_insn_after (pattern, after)
insn = emit_insn_after (pattern, after);
else
{
insn = make_jump_insn_raw (pattern, 0);
insn = make_jump_insn_raw (pattern, NULL_RTVEC);
add_insn_after (insn, after);
}
@ -2123,7 +2130,7 @@ emit_insn (pattern)
}
else
{
insn = make_insn_raw (pattern, NULL);
insn = make_insn_raw (pattern, NULL_RTVEC);
add_insn (insn);
}
@ -2182,7 +2189,7 @@ emit_jump_insn (pattern)
return emit_insn (pattern);
else
{
register rtx insn = make_jump_insn_raw (pattern, NULL);
register rtx insn = make_jump_insn_raw (pattern, NULL_RTVEC);
add_insn (insn);
return insn;
}
@ -2199,7 +2206,7 @@ emit_call_insn (pattern)
return emit_insn (pattern);
else
{
register rtx insn = make_insn_raw (pattern, NULL);
register rtx insn = make_insn_raw (pattern, NULL_RTVEC);
add_insn (insn);
PUT_CODE (insn, CALL_INSN);
return insn;
@ -2712,13 +2719,13 @@ init_emit_once (line_numbers)
}
/* These four calls obtain some of the rtx expressions made above. */
const0_rtx = gen_rtx (CONST_INT, VOIDmode, 0);
const1_rtx = gen_rtx (CONST_INT, VOIDmode, 1);
const2_rtx = gen_rtx (CONST_INT, VOIDmode, 2);
constm1_rtx = gen_rtx (CONST_INT, VOIDmode, -1);
const0_rtx = GEN_INT (0);
const1_rtx = GEN_INT (1);
const2_rtx = GEN_INT (2);
constm1_rtx = GEN_INT (-1);
/* This will usually be one of the above constants, but may be a new rtx. */
const_true_rtx = gen_rtx (CONST_INT, VOIDmode, STORE_FLAG_VALUE);
const_true_rtx = GEN_INT (STORE_FLAG_VALUE);
dconst0 = REAL_VALUE_ATOF ("0");
dconst1 = REAL_VALUE_ATOF ("1");
@ -2743,11 +2750,11 @@ init_emit_once (line_numbers)
const_tiny_rtx[i][(int) mode] = tem;
}
const_tiny_rtx[i][(int) VOIDmode] = gen_rtx (CONST_INT, VOIDmode, i);
const_tiny_rtx[i][(int) VOIDmode] = GEN_INT (i);
for (mode = GET_CLASS_NARROWEST_MODE (MODE_INT); mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
const_tiny_rtx[i][(int) mode] = gen_rtx (CONST_INT, VOIDmode, i);
const_tiny_rtx[i][(int) mode] = GEN_INT (i);
}
stack_pointer_rtx = gen_rtx (REG, Pmode, STACK_POINTER_REGNUM);

File diff suppressed because it is too large Load Diff

View File

@ -283,8 +283,7 @@ end_final (filename)
assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), UNITS_PER_WORD, 1);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), UNITS_PER_WORD, 1);
assemble_integer (gen_rtx (CONST_INT, VOIDmode, count_basic_blocks),
UNITS_PER_WORD, 1);
assemble_integer (GEN_INT (count_basic_blocks), UNITS_PER_WORD, 1);
assemble_integer (const0_rtx, UNITS_PER_WORD, 1);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 3);
assemble_integer (gen_rtx (SYMBOL_REF, Pmode, name), UNITS_PER_WORD, 1);
@ -600,7 +599,8 @@ asm_insn_count (body)
char *template;
int count = 1;
for (template = decode_asm_operands (body, 0, 0, 0, 0);
for (template = decode_asm_operands (body, NULL_PTR, NULL_PTR,
NULL_PTR, NULL_PTR);
*template; template++)
if (*template == ';' || *template == '\n')
count++;
@ -1174,7 +1174,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
of the insn that branched here. So recover the cc status
from the insn that set it. */
note = find_reg_note (insn, REG_CC_SETTER, 0);
note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
if (note)
{
NOTICE_UPDATE_CC (PATTERN (XEXP (note, 0)), XEXP (note, 0));
@ -1277,7 +1277,8 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
}
/* Get out the operand values. */
string = decode_asm_operands (body, ops, 0, 0, 0);
string = decode_asm_operands (body, ops, NULL_PTR,
NULL_PTR, NULL_PTR);
/* Inhibit aborts on what would otherwise be compiler bugs. */
insn_noperands = noperands;
this_is_asm_operands = insn;
@ -1982,7 +1983,13 @@ output_asm_insn (template, operands)
else if (letter == 'n')
{
if (GET_CODE (operands[c]) == CONST_INT)
fprintf (asm_out_file, "%d", - INTVAL (operands[c]));
fprintf (asm_out_file,
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
"%d",
#else
"%ld",
#endif
- INTVAL (operands[c]));
else
{
putc ('-', asm_out_file);
@ -2009,7 +2016,7 @@ output_asm_insn (template, operands)
The PRINT_OPERAND macro decides what is actually done. */
#ifdef PRINT_OPERAND_PUNCT_VALID_P
else if (PRINT_OPERAND_PUNCT_VALID_P (*p))
output_operand (0, *p++);
output_operand (NULL_RTX, *p++);
#endif
else
output_operand_lossage ("invalid %%-code");
@ -2123,7 +2130,13 @@ output_addr_const (file, x)
break;
case CONST_INT:
fprintf (file, "%d", INTVAL (x));
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
"%d",
#else
"%ld",
#endif
INTVAL (x));
break;
case CONST:
@ -2135,12 +2148,31 @@ output_addr_const (file, x)
case CONST_DOUBLE:
if (GET_MODE (x) == VOIDmode)
{
/* We can use %d if the number is <32 bits and positive. */
/* We can use %d if the number is one word and positive. */
if (CONST_DOUBLE_HIGH (x) || CONST_DOUBLE_LOW (x) < 0)
fprintf (file, "0x%x%08x",
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == 64
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%016lx",
#else
" 0x%x%016x",
#endif
#else
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%08lx",
#else
" 0x%x%08x",
#endif
#endif
CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
else
fprintf (file, "%d", CONST_DOUBLE_LOW (x));
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
"%d",
#else
"%ld",
#endif
CONST_DOUBLE_LOW (x));
}
else
/* We can't handle floating point constants;
@ -2320,27 +2352,27 @@ split_double (value, first, second)
/* In an integer, the words are defined as most and least significant.
So order them by the target's convention. */
#if WORDS_BIG_ENDIAN
*first = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (value));
*second = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (value));
*first = GEN_INT (CONST_DOUBLE_HIGH (value));
*second = GEN_INT (CONST_DOUBLE_LOW (value));
#else
*first = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (value));
*second = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (value));
*first = GEN_INT (CONST_DOUBLE_LOW (value));
*second = GEN_INT (CONST_DOUBLE_HIGH (value));
#endif
}
else
{
if ((HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
|| HOST_BITS_PER_INT != BITS_PER_WORD)
|| HOST_BITS_PER_WIDE_INT != BITS_PER_WORD)
&& ! flag_pretend_float)
abort ();
#if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
/* Host and target agree => no need to swap. */
*first = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (value));
*second = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (value));
*first = GEN_INT (CONST_DOUBLE_LOW (value));
*second = GEN_INT (CONST_DOUBLE_HIGH (value));
#else
*second = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (value));
*first = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_HIGH (value));
*second = GEN_INT (CONST_DOUBLE_LOW (value));
*first = GEN_INT (CONST_DOUBLE_HIGH (value));
#endif
}
}

View File

@ -58,44 +58,47 @@ static tree const_binop ();
#define BRANCH_COST 1
#endif
/* To do constant folding on INTEGER_CST nodes requires 64-bit arithmetic.
We do that by representing the 64-bit integer as 8 shorts,
/* To do constant folding on INTEGER_CST nodes requires two-word arithmetic.
We do that by representing the two-word integer as MAX_SHORTS shorts,
with only 8 bits stored in each short, as a positive number. */
/* Unpack a 64-bit integer into 8 shorts.
LOW and HI are the integer, as two `int' pieces.
/* Unpack a two-word integer into MAX_SHORTS shorts.
LOW and HI are the integer, as two `HOST_WIDE_INT' pieces.
SHORTS points to the array of shorts. */
static void
encode (shorts, low, hi)
short *shorts;
int low, hi;
HOST_WIDE_INT low, hi;
{
shorts[0] = low & 0xff;
shorts[1] = (low >> 8) & 0xff;
shorts[2] = (low >> 16) & 0xff;
shorts[3] = (low >> 24) & 0xff;
shorts[4] = hi & 0xff;
shorts[5] = (hi >> 8) & 0xff;
shorts[6] = (hi >> 16) & 0xff;
shorts[7] = (hi >> 24) & 0xff;
register int i;
for (i = 0; i < MAX_SHORTS / 2; i++)
{
shorts[i] = (low >> (i * 8)) & 0xff;
shorts[i + MAX_SHORTS / 2] = (hi >> (i * 8) & 0xff);
}
}
/* Pack an array of 8 shorts into a 64-bit integer.
/* Pack an array of MAX_SHORTS shorts into a two-word integer.
SHORTS points to the array of shorts.
The integer is stored into *LOW and *HI as two `int' pieces. */
The integer is stored into *LOW and *HI as two `HOST_WIDE_INT' pieces. */
static void
decode (shorts, low, hi)
short *shorts;
int *low, *hi;
HOST_WIDE_INT *low, *hi;
{
/* The casts in the following statement should not be
needed, but they get around bugs in some C compilers. */
*low = (((long)shorts[3] << 24) | ((long)shorts[2] << 16)
| ((long)shorts[1] << 8) | (long)shorts[0]);
*hi = (((long)shorts[7] << 24) | ((long)shorts[6] << 16)
| ((long)shorts[5] << 8) | (long)shorts[4]);
register int i;
HOST_WIDE_INT lv = 0, hv = 0;
for (i = 0; i < MAX_SHORTS / 2; i++)
{
lv |= (HOST_WIDE_INT) shorts[i] << (i * 8);
hv |= (HOST_WIDE_INT) shorts[i + MAX_SHORTS / 2] << (i * 8);
}
*low = lv, *hi = hv;
}
/* Make the integer constant T valid for its type
@ -113,66 +116,65 @@ force_fit_type (t)
/* First clear all bits that are beyond the type's precision. */
if (prec == 2 * HOST_BITS_PER_INT)
if (prec == 2 * HOST_BITS_PER_WIDE_INT)
;
else if (prec > HOST_BITS_PER_INT)
else if (prec > HOST_BITS_PER_WIDE_INT)
{
TREE_INT_CST_HIGH (t)
&= ~((-1) << (prec - HOST_BITS_PER_INT));
&= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
}
else
{
TREE_INT_CST_HIGH (t) = 0;
if (prec < HOST_BITS_PER_INT)
TREE_INT_CST_LOW (t)
&= ~((-1) << prec);
if (prec < HOST_BITS_PER_WIDE_INT)
TREE_INT_CST_LOW (t) &= ~((HOST_WIDE_INT) (-1) << prec);
}
/* If it's a signed type and value's sign bit is set, extend the sign. */
if (! TREE_UNSIGNED (TREE_TYPE (t))
&& prec != 2 * HOST_BITS_PER_INT
&& (prec > HOST_BITS_PER_INT
? TREE_INT_CST_HIGH (t) & (1 << (prec - HOST_BITS_PER_INT - 1))
: TREE_INT_CST_LOW (t) & (1 << (prec - 1))))
&& prec != 2 * HOST_BITS_PER_WIDE_INT
&& (prec > HOST_BITS_PER_WIDE_INT
? (TREE_INT_CST_HIGH (t)
& ((HOST_WIDE_INT) 1 << (prec - HOST_BITS_PER_WIDE_INT - 1)))
: TREE_INT_CST_LOW (t) & ((HOST_WIDE_INT) 1 << (prec - 1))))
{
/* Value is negative:
set to 1 all the bits that are outside this type's precision. */
if (prec > HOST_BITS_PER_INT)
if (prec > HOST_BITS_PER_WIDE_INT)
{
TREE_INT_CST_HIGH (t)
|= ((-1) << (prec - HOST_BITS_PER_INT));
|= ((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
}
else
{
TREE_INT_CST_HIGH (t) = -1;
if (prec < HOST_BITS_PER_INT)
TREE_INT_CST_LOW (t)
|= ((-1) << prec);
if (prec < HOST_BITS_PER_WIDE_INT)
TREE_INT_CST_LOW (t) |= ((HOST_WIDE_INT) (-1) << prec);
}
}
}
/* Add two 64-bit integers with 64-bit result.
Each argument is given as two `int' pieces.
/* Add two doubleword integers with doubleword result.
Each argument is given as two `HOST_WIDE_INT' pieces.
One argument is L1 and H1; the other, L2 and H2.
The value is stored as two `int' pieces in *LV and *HV.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV.
We use the 8-shorts representation internally. */
void
add_double (l1, h1, l2, h2, lv, hv)
int l1, h1, l2, h2;
int *lv, *hv;
HOST_WIDE_INT l1, h1, l2, h2;
HOST_WIDE_INT *lv, *hv;
{
short arg1[8];
short arg2[8];
short arg1[MAX_SHORTS];
short arg2[MAX_SHORTS];
register int carry = 0;
register int i;
encode (arg1, l1, h1);
encode (arg2, l2, h2);
for (i = 0; i < 8; i++)
for (i = 0; i < MAX_SHORTS; i++)
{
carry += arg1[i] + arg2[i];
arg1[i] = carry & 0xff;
@ -182,15 +184,15 @@ add_double (l1, h1, l2, h2, lv, hv)
decode (arg1, lv, hv);
}
/* Negate a 64-bit integers with 64-bit result.
The argument is given as two `int' pieces in L1 and H1.
The value is stored as two `int' pieces in *LV and *HV.
/* Negate a doubleword integer with doubleword result.
The argument is given as two `HOST_WIDE_INT' pieces in L1 and H1.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV.
We use the 8-shorts representation internally. */
void
neg_double (l1, h1, lv, hv)
int l1, h1;
int *lv, *hv;
HOST_WIDE_INT l1, h1;
HOST_WIDE_INT *lv, *hv;
{
if (l1 == 0)
{
@ -204,20 +206,20 @@ neg_double (l1, h1, lv, hv)
}
}
/* Multiply two 64-bit integers with 64-bit result.
Each argument is given as two `int' pieces.
/* Multiply two doubleword integers with doubleword result.
Each argument is given as two `HOST_WIDE_INT' pieces.
One argument is L1 and H1; the other, L2 and H2.
The value is stored as two `int' pieces in *LV and *HV.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV.
We use the 8-shorts representation internally. */
void
mul_double (l1, h1, l2, h2, lv, hv)
int l1, h1, l2, h2;
int *lv, *hv;
HOST_WIDE_INT l1, h1, l2, h2;
HOST_WIDE_INT *lv, *hv;
{
short arg1[8];
short arg2[8];
short prod[16];
short arg1[MAX_SHORTS];
short arg2[MAX_SHORTS];
short prod[MAX_SHORTS * 2];
register int carry = 0;
register int i, j, k;
@ -227,14 +229,14 @@ mul_double (l1, h1, l2, h2, lv, hv)
{
if (l2 == 2)
{
unsigned temp = l1 + l1;
unsigned HOST_WIDE_INT temp = l1 + l1;
*hv = h1 * 2 + (temp < l1);
*lv = temp;
return;
}
if (l2 == 4)
{
unsigned temp = l1 + l1;
unsigned HOST_WIDE_INT temp = l1 + l1;
h1 = h1 * 4 + ((temp < l1) << 1);
l1 = temp;
temp += temp;
@ -245,7 +247,7 @@ mul_double (l1, h1, l2, h2, lv, hv)
}
if (l2 == 8)
{
unsigned temp = l1 + l1;
unsigned HOST_WIDE_INT temp = l1 + l1;
h1 = h1 * 8 + ((temp < l1) << 2);
l1 = temp;
temp += temp;
@ -264,8 +266,8 @@ mul_double (l1, h1, l2, h2, lv, hv)
bzero (prod, sizeof prod);
for (i = 0; i < 8; i++)
for (j = 0; j < 8; j++)
for (i = 0; i < MAX_SHORTS; i++)
for (j = 0; j < MAX_SHORTS; j++)
{
k = i + j;
carry = arg1[i] * arg2[j];
@ -278,22 +280,24 @@ mul_double (l1, h1, l2, h2, lv, hv)
}
}
decode (prod, lv, hv); /* @@decode ignores prod[8] -> prod[15] */
decode (prod, lv, hv); /* ?? decode ignores
prod[MAX_SHORTS] -> prod[MAX_SHORTS*2-1] */
}
/* Shift the 64-bit integer in L1, H1 left by COUNT places
/* Shift the doubleword integer in L1, H1 left by COUNT places
keeping only PREC bits of result.
Shift right if COUNT is negative.
ARITH nonzero specifies arithmetic shifting; otherwise use logical shift.
Store the value as two `int' pieces in *LV and *HV. */
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
void
lshift_double (l1, h1, count, prec, lv, hv, arith)
int l1, h1, count, prec;
int *lv, *hv;
HOST_WIDE_INT l1, h1;
int count, prec;
HOST_WIDE_INT *lv, *hv;
int arith;
{
short arg1[8];
short arg1[MAX_SHORTS];
register int i;
register int carry;
@ -311,7 +315,7 @@ lshift_double (l1, h1, count, prec, lv, hv, arith)
while (count > 0)
{
carry = 0;
for (i = 0; i < 8; i++)
for (i = 0; i < MAX_SHORTS; i++)
{
carry += arg1[i] << 1;
arg1[i] = carry & 0xff;
@ -323,18 +327,18 @@ lshift_double (l1, h1, count, prec, lv, hv, arith)
decode (arg1, lv, hv);
}
/* Shift the 64-bit integer in L1, H1 right by COUNT places
/* Shift the doubleword integer in L1, H1 right by COUNT places
keeping only PREC bits of result. COUNT must be positive.
ARITH nonzero specifies arithmetic shifting; otherwise use logical shift.
Store the value as two `int' pieces in *LV and *HV. */
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
void
rshift_double (l1, h1, count, prec, lv, hv, arith)
int l1, h1, count, prec;
int *lv, *hv;
HOST_WIDE_INT l1, h1, count, prec;
HOST_WIDE_INT *lv, *hv;
int arith;
{
short arg1[8];
short arg1[MAX_SHORTS];
register int i;
register int carry;
@ -346,7 +350,7 @@ rshift_double (l1, h1, count, prec, lv, hv, arith)
while (count > 0)
{
carry = arith && arg1[7] >> 7;
for (i = 7; i >= 0; i--)
for (i = MAX_SHORTS - 1; i >= 0; i--)
{
carry <<= 8;
carry += arg1[i];
@ -358,17 +362,17 @@ rshift_double (l1, h1, count, prec, lv, hv, arith)
decode (arg1, lv, hv);
}
/* Rotate the 64-bit integer in L1, H1 left by COUNT places
/* Rotate the doubldword integer in L1, H1 left by COUNT places
keeping only PREC bits of result.
Rotate right if COUNT is negative.
Store the value as two `int' pieces in *LV and *HV. */
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
void
lrotate_double (l1, h1, count, prec, lv, hv)
int l1, h1, count, prec;
int *lv, *hv;
HOST_WIDE_INT l1, h1, count, prec;
HOST_WIDE_INT *lv, *hv;
{
short arg1[8];
short arg1[MAX_SHORTS];
register int i;
register int carry;
@ -383,10 +387,10 @@ lrotate_double (l1, h1, count, prec, lv, hv)
if (count > prec)
count = prec;
carry = arg1[7] >> 7;
carry = arg1[MAX_SHORTS - 1] >> 7;
while (count > 0)
{
for (i = 0; i < 8; i++)
for (i = 0; i < MAX_SHORTS; i++)
{
carry += arg1[i] << 1;
arg1[i] = carry & 0xff;
@ -398,16 +402,16 @@ lrotate_double (l1, h1, count, prec, lv, hv)
decode (arg1, lv, hv);
}
/* Rotate the 64-bit integer in L1, H1 left by COUNT places
/* Rotate the doubleword integer in L1, H1 left by COUNT places
keeping only PREC bits of result. COUNT must be positive.
Store the value as two `int' pieces in *LV and *HV. */
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
void
rrotate_double (l1, h1, count, prec, lv, hv)
int l1, h1, count, prec;
int *lv, *hv;
HOST_WIDE_INT l1, h1, count, prec;
HOST_WIDE_INT *lv, *hv;
{
short arg1[8];
short arg1[MAX_SHORTS];
register int i;
register int carry;
@ -419,7 +423,7 @@ rrotate_double (l1, h1, count, prec, lv, hv)
carry = arg1[0] & 1;
while (count > 0)
{
for (i = 7; i >= 0; i--)
for (i = MAX_SHORTS - 1; i >= 0; i--)
{
carry <<= 8;
carry += arg1[i];
@ -431,7 +435,7 @@ rrotate_double (l1, h1, count, prec, lv, hv)
decode (arg1, lv, hv);
}
/* Divide 64 bit integer LNUM, HNUM by 64 bit integer LDEN, HDEN
/* Divide doubleword integer LNUM, HNUM by doubleword integer LDEN, HDEN
for a quotient (stored in *LQUO, *HQUO) and remainder (in *LREM, *HREM).
CODE is a tree code for a kind of division, one of
TRUNC_DIV_EXPR, FLOOR_DIV_EXPR, CEIL_DIV_EXPR, ROUND_DIV_EXPR
@ -445,12 +449,13 @@ div_and_round_double (code, uns,
lquo, hquo, lrem, hrem)
enum tree_code code;
int uns;
int lnum_orig, hnum_orig; /* num == numerator == dividend */
int lden_orig, hden_orig; /* den == denominator == divisor */
int *lquo, *hquo, *lrem, *hrem;
HOST_WIDE_INT lnum_orig, hnum_orig; /* num == numerator == dividend */
HOST_WIDE_INT lden_orig, hden_orig; /* den == denominator == divisor */
HOST_WIDE_INT *lquo, *hquo, *lrem, *hrem;
{
int quo_neg = 0;
short num[9], den[8], quo[8]; /* extra element for scaling. */
short num[MAX_SHORTS + 1]; /* extra element for scaling. */
short den[MAX_SHORTS], quo[MAX_SHORTS];
register int i, j, work;
register int carry = 0;
unsigned int lnum = lnum_orig;
@ -507,7 +512,7 @@ div_and_round_double (code, uns,
if (hden == 0 && ((lden << 8) >> 8) == lden)
{ /* simpler algorithm */
/* hnum != 0 already checked. */
for (i = 7; i >= 0; i--)
for (i = MAX_SHORTS - 1; i >= 0; i--)
{
work = num[i] + (carry << 8);
quo[i] = work / lden;
@ -521,12 +526,12 @@ div_and_round_double (code, uns,
int quo_est, scale, num_hi_sig, den_hi_sig, quo_hi_sig;
/* Find the highest non-zero divisor digit. */
for (i = 7; ; i--)
for (i = MAX_SHORTS - 1; ; i--)
if (den[i] != 0) {
den_hi_sig = i;
break;
}
for (i = 7; ; i--)
for (i = MAX_SHORTS - 1; ; i--)
if (num[i] != 0) {
num_hi_sig = i;
break;
@ -539,14 +544,14 @@ div_and_round_double (code, uns,
scale = BASE / (den[den_hi_sig] + 1);
if (scale > 1) { /* scale divisor and dividend */
carry = 0;
for (i = 0; i <= 8; i++) {
for (i = 0; i <= MAX_SHORTS - 1; i++) {
work = (num[i] * scale) + carry;
num[i] = work & 0xff;
carry = work >> 8;
if (num[i] != 0) num_hi_sig = i;
}
carry = 0;
for (i = 0; i <= 7; i++) {
for (i = 0; i <= MAX_SHORTS - 1; i++) {
work = (den[i] * scale) + carry;
den[i] = work & 0xff;
carry = work >> 8;
@ -652,7 +657,8 @@ div_and_round_double (code, uns,
if (quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio < 0 && rem != 0 */
{
/* quo = quo - 1; */
add_double (*lquo, *hquo, -1, -1, lquo, hquo);
add_double (*lquo, *hquo, (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1,
lquo, hquo);
}
else return;
break;
@ -661,7 +667,8 @@ div_and_round_double (code, uns,
case CEIL_MOD_EXPR: /* round toward positive infinity */
if (!quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio > 0 && rem != 0 */
{
add_double (*lquo, *hquo, 1, 0, lquo, hquo);
add_double (*lquo, *hquo, (HOST_WIDE_INT) 1, (HOST_WIDE_INT) 0,
lquo, hquo);
}
else return;
break;
@ -669,25 +676,31 @@ div_and_round_double (code, uns,
case ROUND_DIV_EXPR:
case ROUND_MOD_EXPR: /* round to closest integer */
{
int labs_rem = *lrem, habs_rem = *hrem;
int labs_den = lden, habs_den = hden, ltwice, htwice;
HOST_WIDE_INT labs_rem = *lrem, habs_rem = *hrem;
HOST_WIDE_INT labs_den = lden, habs_den = hden, ltwice, htwice;
/* get absolute values */
if (*hrem < 0) neg_double (*lrem, *hrem, &labs_rem, &habs_rem);
if (hden < 0) neg_double (lden, hden, &labs_den, &habs_den);
/* if (2 * abs (lrem) >= abs (lden)) */
mul_double (2, 0, labs_rem, habs_rem, &ltwice, &htwice);
if (((unsigned) habs_den < (unsigned) htwice)
|| (((unsigned) habs_den == (unsigned) htwice)
&& ((unsigned) labs_den < (unsigned) ltwice)))
mul_double ((HOST_WIDE_INT) 2, (HOST_WIDE_INT) 0,
labs_rem, habs_rem, &ltwice, &htwice);
if (((unsigned HOST_WIDE_INT) habs_den
< (unsigned HOST_WIDE_INT) htwice)
|| (((unsigned HOST_WIDE_INT) habs_den
== (unsigned HOST_WIDE_INT) htwice)
&& ((HOST_WIDE_INT unsigned) labs_den
< (unsigned HOST_WIDE_INT) ltwice)))
{
if (*hquo < 0)
/* quo = quo - 1; */
add_double (*lquo, *hquo, -1, -1, lquo, hquo);
add_double (*lquo, *hquo,
(HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo);
else
/* quo = quo + 1; */
add_double (*lquo, *hquo, 1, 0, lquo, hquo);
add_double (*lquo, *hquo, (HOST_WIDE_INT) 1, (HOST_WIDE_INT) 0,
lquo, hquo);
}
else return;
}
@ -728,7 +741,7 @@ real_value_truncate (mode, arg)
}
set_float_handler (handler);
value = REAL_VALUE_TRUNCATE (mode, arg);
set_float_handler (0);
set_float_handler (NULL_PTR);
return value;
}
@ -981,12 +994,12 @@ const_binop (code, arg1, arg2)
{
if (TREE_CODE (arg1) == INTEGER_CST)
{
register int int1l = TREE_INT_CST_LOW (arg1);
register int int1h = TREE_INT_CST_HIGH (arg1);
int int2l = TREE_INT_CST_LOW (arg2);
int int2h = TREE_INT_CST_HIGH (arg2);
int low, hi;
int garbagel, garbageh;
register HOST_WIDE_INT int1l = TREE_INT_CST_LOW (arg1);
register HOST_WIDE_INT int1h = TREE_INT_CST_HIGH (arg1);
HOST_WIDE_INT int2l = TREE_INT_CST_LOW (arg2);
HOST_WIDE_INT int2h = TREE_INT_CST_HIGH (arg2);
HOST_WIDE_INT low, hi;
HOST_WIDE_INT garbagel, garbageh;
register tree t;
int uns = TREE_UNSIGNED (TREE_TYPE (arg1));
@ -1031,7 +1044,7 @@ const_binop (code, arg1, arg2)
if (int1h == 0)
{
int2l += int1l;
if ((unsigned) int2l < int1l)
if ((unsigned HOST_WIDE_INT) int2l < int1l)
int2h += 1;
t = build_int_2 (int2l, int2h);
break;
@ -1039,7 +1052,7 @@ const_binop (code, arg1, arg2)
if (int2h == 0)
{
int1l += int2l;
if ((unsigned) int1l < int2l)
if ((unsigned HOST_WIDE_INT) int1l < int2l)
int1h += 1;
t = build_int_2 (int1l, int1h);
break;
@ -1063,7 +1076,7 @@ const_binop (code, arg1, arg2)
/* Optimize simple cases. */
if (int1h == 0)
{
unsigned temp;
unsigned HOST_WIDE_INT temp;
switch (int1l)
{
@ -1168,15 +1181,19 @@ const_binop (code, arg1, arg2)
case MAX_EXPR:
if (uns)
{
low = (((unsigned) int1h < (unsigned) int2h)
|| (((unsigned) int1h == (unsigned) int2h)
&& ((unsigned) int1l < (unsigned) int2l)));
low = (((unsigned HOST_WIDE_INT) int1h
< (unsigned HOST_WIDE_INT) int2h)
|| (((unsigned HOST_WIDE_INT) int1h
== (unsigned HOST_WIDE_INT) int2h)
&& ((unsigned HOST_WIDE_INT) int1l
< (unsigned HOST_WIDE_INT) int2l)));
}
else
{
low = ((int1h < int2h)
|| ((int1h == int2h)
&& ((unsigned) int1l < (unsigned) int2l)));
&& ((unsigned HOST_WIDE_INT) int1l
< (unsigned HOST_WIDE_INT) int2l)));
}
if (low == (code == MIN_EXPR))
t = build_int_2 (int1l, int1h);
@ -1249,7 +1266,7 @@ const_binop (code, arg1, arg2)
#endif /* no REAL_ARITHMETIC */
t = build_real (TREE_TYPE (arg1),
real_value_truncate (TYPE_MODE (TREE_TYPE (arg1)), value));
set_float_handler (0);
set_float_handler (NULL_PTR);
return t;
}
#endif /* not REAL_IS_NOT_DOUBLE, or REAL_ARITHMETIC */
@ -1318,11 +1335,12 @@ size_int (number)
{
register tree t;
/* Type-size nodes already made for small sizes. */
static tree size_table[2*HOST_BITS_PER_INT+1];
static tree size_table[2*HOST_BITS_PER_WIDE_INT + 1];
if (number >= 0 && number < 2*HOST_BITS_PER_INT+1 && size_table[number] != 0)
if (number >= 0 && number < 2*HOST_BITS_PER_WIDE_INT + 1
&& size_table[number] != 0)
return size_table[number];
if (number >= 0 && number < 2*HOST_BITS_PER_INT+1)
if (number >= 0 && number < 2*HOST_BITS_PER_WIDE_INT + 1)
{
push_obstacks_nochange ();
/* Make this a permanent node. */
@ -1423,23 +1441,24 @@ fold_convert (t, arg1)
#ifndef REAL_ARITHMETIC
{
REAL_VALUE_TYPE d;
int low, high;
int half_word = 1 << (HOST_BITS_PER_INT / 2);
HOST_WIDE_INT low, high;
HOST_WIDE_INT half_word
= (HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2);
d = TREE_REAL_CST (arg1);
if (d < 0)
d = -d;
high = (int) (d / half_word / half_word);
high = (HOST_WIDE_INT) (d / half_word / half_word);
d -= (REAL_VALUE_TYPE) high * half_word * half_word;
low = (unsigned) d;
low = (unsigned HOST_WIDE_INT) d;
if (TREE_REAL_CST (arg1) < 0)
neg_double (low, high, &low, &high);
t = build_int_2 (low, high);
}
#else
{
int low, high;
HOST_WIDE_INT low, high;
REAL_VALUE_TO_INT (low, high, TREE_REAL_CST (arg1));
t = build_int_2 (low, high);
}
@ -1467,7 +1486,7 @@ fold_convert (t, arg1)
t = build_real (type, real_value_truncate (TYPE_MODE (type),
TREE_REAL_CST (arg1)));
set_float_handler (0);
set_float_handler (NULL_PTR);
return t;
}
}
@ -3377,16 +3396,18 @@ fold (expr)
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg1, 0))))
{
int prec = TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0)));
if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_INT
&& (~TREE_INT_CST_LOW (arg0) & ((1 << prec) - 1)) == 0)
if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_WIDE_INT
&& (~TREE_INT_CST_LOW (arg0)
& (((HOST_WIDE_INT) 1 << prec) - 1)) == 0)
return build1 (NOP_EXPR, type, TREE_OPERAND (arg1, 0));
}
if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) == NOP_EXPR
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
{
int prec = TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)));
if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_INT
&& (~TREE_INT_CST_LOW (arg1) & ((1 << prec) - 1)) == 0)
if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_WIDE_INT
&& (~TREE_INT_CST_LOW (arg1)
& (((HOST_WIDE_INT) 1 << prec) - 1)) == 0)
return build1 (NOP_EXPR, type, TREE_OPERAND (arg0, 0));
}
goto associate;
@ -3429,7 +3450,7 @@ fold (expr)
{
tree new_op
= build_int_2 (TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1))
/ TREE_INT_CST_LOW (arg1));
/ TREE_INT_CST_LOW (arg1), 0);
TREE_TYPE (new_op) = type;
return build (MULT_EXPR, type, TREE_OPERAND (arg0, 0), new_op);
@ -3450,7 +3471,7 @@ fold (expr)
{
tree new_op
= build_int_2 (TREE_INT_CST_LOW (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1))
/ TREE_INT_CST_LOW (arg1));
/ TREE_INT_CST_LOW (arg1), 0);
TREE_TYPE (new_op) = type;
return build (MULT_EXPR, type,

123
gcc/gcc.c
View File

@ -47,6 +47,14 @@ compilation is specified by a string called a "spec". */
#define X_OK 1
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef NULL_PTR
#define NULL_PTR (char *) NULL
#endif
#ifdef USG
#define vfork fork
#endif /* USG */
@ -1716,8 +1724,8 @@ process_command (argc, argv)
if (gcc_exec_prefix)
{
add_prefix (&exec_prefix, gcc_exec_prefix, 0, 0, 0);
add_prefix (&startfile_prefix, gcc_exec_prefix, 0, 0, 0);
add_prefix (&exec_prefix, gcc_exec_prefix, 0, 0, NULL_PTR);
add_prefix (&startfile_prefix, gcc_exec_prefix, 0, 0, NULL_PTR);
}
/* COMPILER_PATH and LIBRARY_PATH have values
@ -1746,7 +1754,7 @@ process_command (argc, argv)
}
else
nstore[endp-startp] = 0;
add_prefix (&exec_prefix, nstore, 0, 0, 0);
add_prefix (&exec_prefix, nstore, 0, 0, NULL_PTR);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -1779,9 +1787,9 @@ process_command (argc, argv)
}
else
nstore[endp-startp] = 0;
add_prefix (&startfile_prefix, nstore, 0, 0, 0);
add_prefix (&startfile_prefix, nstore, 0, 0, NULL_PTR);
/* Make separate list of dirs that came from LIBRARY_PATH. */
add_prefix (&library_prefix, nstore, 0, 0, 0);
add_prefix (&library_prefix, nstore, 0, 0, NULL_PTR);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -1815,9 +1823,9 @@ process_command (argc, argv)
}
else
nstore[endp-startp] = 0;
add_prefix (&startfile_prefix, nstore, 0, 0, 0);
add_prefix (&startfile_prefix, nstore, 0, 0, NULL_PTR);
/* Make separate list of dirs that came from LIBRARY_PATH. */
add_prefix (&library_prefix, nstore, 0, 0, 0);
add_prefix (&library_prefix, nstore, 0, 0, NULL_PTR);
if (*endp == 0)
break;
endp = startp = endp + 1;
@ -1947,11 +1955,11 @@ process_command (argc, argv)
/* These come before the md prefixes so that we will find gcc's subcommands
(such as cpp) rather than those of the host system. */
add_prefix (&exec_prefix, standard_exec_prefix, 0, 1, 0);
add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 1, 0);
add_prefix (&exec_prefix, standard_exec_prefix, 0, 1, NULL_PTR);
add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 1, NULL_PTR);
add_prefix (&startfile_prefix, standard_exec_prefix, 0, 1, 0);
add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 1, 0);
add_prefix (&startfile_prefix, standard_exec_prefix, 0, 1, NULL_PTR);
add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 1, NULL_PTR);
/* More prefixes are enabled in main, after we read the specs file
and determine whether this is cross-compilation or not. */
@ -2115,7 +2123,7 @@ do_spec (spec)
this_is_output_file = 0;
this_is_library_file = 0;
value = do_spec_1 (spec, 0, NULL);
value = do_spec_1 (spec, 0, NULL_PTR);
/* Force out any unfinished command.
If -pipe, this forces out the last command if it ended in `|'. */
@ -2287,11 +2295,11 @@ do_spec_1 (spec, inswitch, soft_matched_part)
{
if (is_linker_dir (pl->prefix, machine_suffix))
{
do_spec_1 ("-L", 0, 0);
do_spec_1 ("-L", 0, NULL_PTR);
#ifdef SPACE_AFTER_L_OPTION
do_spec_1 (" ", 0, 0);
do_spec_1 (" ", 0, NULL_PTR);
#endif
do_spec_1 (pl->prefix, 1, 0);
do_spec_1 (pl->prefix, 1, NULL_PTR);
/* Remove slash from machine_suffix. */
if (strlen (machine_suffix) >= bufsize)
bufsize = strlen (machine_suffix) * 2 + 1;
@ -2300,18 +2308,18 @@ do_spec_1 (spec, inswitch, soft_matched_part)
idx = strlen (buffer);
if (buffer[idx - 1] == '/')
buffer[idx - 1] = 0;
do_spec_1 (buffer, 1, 0);
do_spec_1 (buffer, 1, NULL_PTR);
/* Make this a separate argument. */
do_spec_1 (" ", 0, 0);
do_spec_1 (" ", 0, NULL_PTR);
}
}
if (!pl->require_machine_suffix)
{
if (is_linker_dir (pl->prefix, ""))
{
do_spec_1 ("-L", 0, 0);
do_spec_1 ("-L", 0, NULL_PTR);
#ifdef SPACE_AFTER_L_OPTION
do_spec_1 (" ", 0, 0);
do_spec_1 (" ", 0, NULL_PTR);
#endif
/* Remove slash from pl->prefix. */
if (strlen (pl->prefix) >= bufsize)
@ -2321,9 +2329,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
idx = strlen (buffer);
if (buffer[idx - 1] == '/')
buffer[idx - 1] = 0;
do_spec_1 (buffer, 1, 0);
do_spec_1 (buffer, 1, NULL_PTR);
/* Make this a separate argument. */
do_spec_1 (" ", 0, 0);
do_spec_1 (" ", 0, NULL_PTR);
}
}
}
@ -2444,9 +2452,9 @@ do_spec_1 (spec, inswitch, soft_matched_part)
case 'X':
for (i = 0; i < n_linker_options; i++)
{
do_spec_1 (linker_options[i], 1, NULL);
do_spec_1 (linker_options[i], 1, NULL_PTR);
/* Make each accumulated option a separate argument. */
do_spec_1 (" ", 0, NULL);
do_spec_1 (" ", 0, NULL_PTR);
}
break;
@ -2454,39 +2462,39 @@ do_spec_1 (spec, inswitch, soft_matched_part)
a certain constant string as a spec. */
case '1':
do_spec_1 (cc1_spec, 0, NULL);
do_spec_1 (cc1_spec, 0, NULL_PTR);
break;
case '2':
do_spec_1 (cc1plus_spec, 0, NULL);
do_spec_1 (cc1plus_spec, 0, NULL_PTR);
break;
case 'a':
do_spec_1 (asm_spec, 0, NULL);
do_spec_1 (asm_spec, 0, NULL_PTR);
break;
case 'A':
do_spec_1 (asm_final_spec, 0, NULL);
do_spec_1 (asm_final_spec, 0, NULL_PTR);
break;
case 'c':
do_spec_1 (signed_char_spec, 0, NULL);
do_spec_1 (signed_char_spec, 0, NULL_PTR);
break;
case 'C':
do_spec_1 (cpp_spec, 0, NULL);
do_spec_1 (cpp_spec, 0, NULL_PTR);
break;
case 'E':
do_spec_1 (endfile_spec, 0, NULL);
do_spec_1 (endfile_spec, 0, NULL_PTR);
break;
case 'l':
do_spec_1 (link_spec, 0, NULL);
do_spec_1 (link_spec, 0, NULL_PTR);
break;
case 'L':
do_spec_1 (lib_spec, 0, NULL);
do_spec_1 (lib_spec, 0, NULL_PTR);
break;
case 'p':
@ -2513,7 +2521,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
*x = 0;
do_spec_1 (buf, 0, NULL);
do_spec_1 (buf, 0, NULL_PTR);
}
break;
@ -2619,12 +2627,12 @@ do_spec_1 (spec, inswitch, soft_matched_part)
*x = 0;
do_spec_1 (buf, 0, NULL);
do_spec_1 (buf, 0, NULL_PTR);
}
break;
case 'S':
do_spec_1 (startfile_spec, 0, NULL);
do_spec_1 (startfile_spec, 0, NULL_PTR);
break;
/* Here we define characters other than letters and digits. */
@ -2640,8 +2648,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
break;
case '*':
do_spec_1 (soft_matched_part, 1, NULL);
do_spec_1 (" ", 0, NULL);
do_spec_1 (soft_matched_part, 1, NULL_PTR);
do_spec_1 (" ", 0, NULL_PTR);
break;
/* Process a string found as the value of a spec given by name.
@ -2672,7 +2680,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
if (sl)
{
if (c == '(')
do_spec_1 (name, 0, NULL);
do_spec_1 (name, 0, NULL_PTR);
else
{
char *x = (char *) alloca (strlen (name) * 2 + 1);
@ -2705,7 +2713,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
}
*x = 0;
do_spec_1 (buf, 0, NULL);
do_spec_1 (buf, 0, NULL_PTR);
}
}
@ -2797,7 +2805,7 @@ handle_braces (p)
abort ();
if (negate != found
&& do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL) < 0)
&& do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL_PTR) < 0)
return 0;
return q;
@ -2895,7 +2903,7 @@ handle_braces (p)
}
else
{
if (do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL) < 0)
if (do_spec_1 (save_string (p + 1, q - p - 2), 0, NULL_PTR) < 0)
return 0;
}
}
@ -2903,7 +2911,7 @@ handle_braces (p)
{
/* Here if a %{|...} conditional fails: output a minus sign,
which means "standard output" or "standard input". */
do_spec_1 ("-", 0, NULL);
do_spec_1 ("-", 0, NULL_PTR);
}
}
@ -2925,17 +2933,17 @@ give_switch (switchnum, omit_first_word)
{
if (!omit_first_word)
{
do_spec_1 ("-", 0, NULL);
do_spec_1 (switches[switchnum].part1, 1, NULL);
do_spec_1 ("-", 0, NULL_PTR);
do_spec_1 (switches[switchnum].part1, 1, NULL_PTR);
}
do_spec_1 (" ", 0, NULL);
do_spec_1 (" ", 0, NULL_PTR);
if (switches[switchnum].args != 0)
{
char **p;
for (p = switches[switchnum].args; *p; p++)
{
do_spec_1 (*p, 1, NULL);
do_spec_1 (" ", 0, NULL);
do_spec_1 (*p, 1, NULL_PTR);
do_spec_1 (" ", 0, NULL_PTR);
}
}
switches[switchnum].valid = 1;
@ -3072,23 +3080,26 @@ main (argc, argv)
if (!cross_compile)
{
#ifdef MD_EXEC_PREFIX
add_prefix (&exec_prefix, md_exec_prefix, 0, 0, 0);
add_prefix (&startfile_prefix, md_exec_prefix, 0, 0, 0);
add_prefix (&exec_prefix, md_exec_prefix, 0, 0, NULL_PTR);
add_prefix (&startfile_prefix, md_exec_prefix, 0, 0, NULL_PTR);
#endif
#ifdef MD_STARTFILE_PREFIX
add_prefix (&startfile_prefix, md_startfile_prefix, 0, 0, 0);
add_prefix (&startfile_prefix, md_startfile_prefix, 0, 0, NULL_PTR);
#endif
#ifdef MD_STARTFILE_PREFIX_1
add_prefix (&startfile_prefix, md_startfile_prefix_1, 0, 0, 0);
add_prefix (&startfile_prefix, md_startfile_prefix_1, 0, 0, NULL_PTR);
#endif
add_prefix (&startfile_prefix, standard_startfile_prefix, 0, 0, 0);
add_prefix (&startfile_prefix, standard_startfile_prefix_1, 0, 0, 0);
add_prefix (&startfile_prefix, standard_startfile_prefix_2, 0, 0, 0);
add_prefix (&startfile_prefix, standard_startfile_prefix, 0, 0,
NULL_PTR);
add_prefix (&startfile_prefix, standard_startfile_prefix_1, 0, 0,
NULL_PTR);
add_prefix (&startfile_prefix, standard_startfile_prefix_2, 0, 0,
NULL_PTR);
#if 0 /* Can cause surprises, and one can use -B./ instead. */
add_prefix (&startfile_prefix, "./", 0, 1, 0);
add_prefix (&startfile_prefix, "./", 0, 1, NULL_PTR);
#endif
}
@ -3315,7 +3326,7 @@ lookup_compiler (name, length, language)
language = cp->spec + 1;
new = (struct compiler *) xmalloc (sizeof (struct compiler));
new->suffix = cp->suffix;
new->spec = lookup_compiler (0, 0, language)->spec;
new->spec = lookup_compiler (NULL_PTR, 0, language)->spec;
return new;
}
/* A non-alias entry: return it. */

View File

@ -79,8 +79,8 @@ print_node_brief (file, prefix, node, indent)
name if any. */
if (indent > 0)
fprintf (file, " ");
fprintf (file, "%s <%s %x", prefix,
tree_code_name[(int) TREE_CODE (node)], (int) node);
fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
fprintf (file, HOST_PTR_PRINTF, node);
if (class == 'd')
{
@ -110,9 +110,21 @@ print_node_brief (file, prefix, node, indent)
&& TREE_INT_CST_LOW (node) != 0)
fprintf (file, " -%1u", -TREE_INT_CST_LOW (node));
else
fprintf (file, " 0x%x%08x",
TREE_INT_CST_HIGH (node),
TREE_INT_CST_LOW (node));
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == 64
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%016lx",
#else
" 0x%x%016x",
#endif
#else
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%08lx",
#else
" 0x%x%08x",
#endif
#endif
TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
}
if (TREE_CODE (node) == REAL_CST)
{
@ -213,8 +225,8 @@ print_node (file, prefix, node, indent)
indent_to (file, indent);
/* Print the slot this node is in, and its code, and address. */
fprintf (file, "%s <%s %x", prefix,
tree_code_name[(int) TREE_CODE (node)], (int) node);
fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
fprintf (file, HOST_PTR_PRINTF, node);
/* Print the name, if any. */
if (class == 'd')
@ -374,7 +386,10 @@ print_node (file, prefix, node, indent)
print_rtl (file, DECL_INCOMING_RTL (node));
}
else if (TREE_CODE (node) == FUNCTION_DECL)
fprintf (file, "saved-insns 0x%x", DECL_SAVED_INSNS (node));
{
fprintf (file, "saved-insns ");
fprintf (file, HOST_PTR_PRINTF, DECL_SAVED_INSNS (node));
}
}
/* Print the decl chain only if decl is at second level. */
@ -525,9 +540,21 @@ print_node (file, prefix, node, indent)
&& TREE_INT_CST_LOW (node) != 0)
fprintf (file, " -%1u", -TREE_INT_CST_LOW (node));
else
fprintf (file, " 0x%x%08x",
TREE_INT_CST_HIGH (node),
TREE_INT_CST_LOW (node));
fprintf (file,
#if HOST_BITS_PER_WIDE_INT == 64
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%016lx",
#else
" 0x%x%016x",
#endif
#else
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%08lx",
#else
" 0x%x%08x",
#endif
#endif
TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
break;
case REAL_CST: