summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-18 21:33:23 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1999-12-18 21:33:23 +0000
commit083a2b5efc1c99bf5876b5dee828230e4a3faa77 (patch)
treeb29d6812261abeb25b182a176f35382f12cb98bd /gcc
parent34f6bd81bda38e680764f4ffd2405ac4123b9a3d (diff)
downloadgcc-083a2b5efc1c99bf5876b5dee828230e4a3faa77.tar.gz
* alias.c: Minor reformatting.
* flow.c: Likewise. * regs.h: Likewise. * stor-layout.c: Likewise. * fold-const.c: Likewise. (OVERFLOW_SUM_SIGN): Renamed from overflow_sum_sign. (struct cb_args, const_binop_1, const_binop): Pass type of arg, not arg itself. (size_int_wide): Cache nodes even if garbage collecting. (twoval_comparison_p): Reenable SAVE_EXPR case if operand of SAVE_EXPR has no side effects. * cse.c: Move a comment. * tree.c: Minor reformatting. (int_size_in_bytes): Return -1 if constant overflows. * reload.c (combine_reloads): Do nothing if no output reload git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31017 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/alias.c116
-rw-r--r--gcc/cse.c10
-rw-r--r--gcc/flow.c22
-rw-r--r--gcc/fold-const.c242
-rw-r--r--gcc/regs.h8
-rw-r--r--gcc/reload.c2
-rw-r--r--gcc/stor-layout.c85
-rw-r--r--gcc/tree.c242
9 files changed, 416 insertions, 329 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 613c2bf4dd0..fd8a0b67fb5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+Sat Dec 18 16:28:43 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * alias.c: Minor reformatting.
+ * flow.c: Likewise.
+ * regs.h: Likewise.
+ * stor-layout.c: Likewise.
+ * fold-const.c: Likewise.
+ (OVERFLOW_SUM_SIGN): Renamed from overflow_sum_sign.
+ (struct cb_args, const_binop_1, const_binop): Pass type of arg,
+ not arg itself.
+ (size_int_wide): Cache nodes even if garbage collecting.
+ (twoval_comparison_p): Reenable SAVE_EXPR case if operand
+ of SAVE_EXPR has no side effects.
+ * cse.c: Move a comment.
+ * tree.c: Minor reformatting.
+ (int_size_in_bytes): Return -1 if constant overflows.
+ * reload.c (combine_reloads): Do nothing if no output reload
+
Sat Dec 18 18:30:20 1999 J"orn Rennecke <amylaar@cygnus.co.uk>
* unroll.c (copy_loop_body): Don't treat a REG like a PLUS.
diff --git a/gcc/alias.c b/gcc/alias.c
index ebb1e7c7efb..e788ed3b0b5 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -53,7 +53,7 @@ Boston, MA 02111-1307, USA. */
int double
(The arrows are directed and point downwards.) If, when comparing
- two alias sets, we can hold one set fixed, and trace the other set
+ two alias sets, we can hold one set fixed, trace the other set
downwards, and at some point find the first set, the two MEMs can
alias one another. In this situation we say the alias set for
`struct S' is the `superset' and that those for `int' and `double'
@@ -63,7 +63,8 @@ Boston, MA 02111-1307, USA. */
However, this is no actual entry for alias set zero. It is an
error to attempt to explicitly construct a subset of zero. */
-typedef struct alias_set_entry {
+typedef struct alias_set_entry
+{
/* The alias set number, as stored in MEM_ALIAS_SET. */
int alias_set;
@@ -75,7 +76,7 @@ typedef struct alias_set_entry {
continuing our example above, the children here will be all of
`int', `double', `float', and `struct S'. */
splay_tree children;
-}* alias_set_entry;
+} *alias_set_entry;
static rtx canon_rtx PROTO((rtx));
static int rtx_equal_for_memref_p PROTO((rtx, rtx));
@@ -98,6 +99,7 @@ static int nonlocal_reference_p PROTO((rtx));
/* Set up all info needed to perform alias analysis on memory references. */
+/* Returns the size in bytes of the mode of X. */
#define SIZE_FOR_MODE(X) (GET_MODE_SIZE (GET_MODE (X)))
/* Returns nonzero if MEM1 and MEM2 do not alias because they are in
@@ -134,7 +136,8 @@ static int nonlocal_reference_p PROTO((rtx));
static rtx *reg_base_value;
static rtx *new_reg_base_value;
-static unsigned int reg_base_value_size; /* size of reg_base_value array */
+static unsigned int reg_base_value_size; /* size of reg_base_value array */
+
#define REG_BASE_VALUE(X) \
((unsigned) REGNO (X) < reg_base_value_size ? reg_base_value[REGNO (X)] : 0)
@@ -184,10 +187,10 @@ static alias_set_entry
get_alias_set_entry (alias_set)
int alias_set;
{
- splay_tree_node sn =
- splay_tree_lookup (alias_sets, (splay_tree_key) alias_set);
+ splay_tree_node sn
+ = splay_tree_lookup (alias_sets, (splay_tree_key) alias_set);
- return sn ? ((alias_set_entry) sn->value) : ((alias_set_entry) 0);
+ return sn != 0 ? ((alias_set_entry) sn->value) : 0;
}
/* Returns nonzero value if the alias sets for MEM1 and MEM2 are such
@@ -208,8 +211,8 @@ mems_in_disjoint_alias_sets_p (mem1, mem2)
gen_rtx_MEM, and the MEM_ALIAS_SET is not cleared. If we begin to
use alias sets to indicate that spilled registers cannot alias each
other, we might need to remove this check. */
- if (!flag_strict_aliasing &&
- (MEM_ALIAS_SET (mem1) || MEM_ALIAS_SET (mem2)))
+ if (! flag_strict_aliasing
+ && (MEM_ALIAS_SET (mem1) != 0 || MEM_ALIAS_SET (mem2) != 0))
abort ();
#endif
@@ -222,26 +225,26 @@ mems_in_disjoint_alias_sets_p (mem1, mem2)
if (current_function_stdarg || current_function_varargs)
return 0;
- if (!MEM_ALIAS_SET (mem1) || !MEM_ALIAS_SET (mem2))
- /* We have no alias set information for one of the MEMs, so we
- have to assume it can alias anything. */
+ /* If have no alias set information for one of the MEMs, we have to assume
+ it can alias anything. */
+ if (MEM_ALIAS_SET (mem1) == 0 || MEM_ALIAS_SET (mem2) == 0)
return 0;
+ /* If the two alias sets are the same, they may alias. */
if (MEM_ALIAS_SET (mem1) == MEM_ALIAS_SET (mem2))
- /* The two alias sets are the same, so they may alias. */
return 0;
/* Iterate through each of the children of the first alias set,
comparing it with the second alias set. */
ase = get_alias_set_entry (MEM_ALIAS_SET (mem1));
- if (ase && splay_tree_lookup (ase->children,
- (splay_tree_key) MEM_ALIAS_SET (mem2)))
+ if (ase != 0 && splay_tree_lookup (ase->children,
+ (splay_tree_key) MEM_ALIAS_SET (mem2)))
return 0;
/* Now do the same, but with the alias sets reversed. */
ase = get_alias_set_entry (MEM_ALIAS_SET (mem2));
- if (ase && splay_tree_lookup (ase->children,
- (splay_tree_key) MEM_ALIAS_SET (mem1)))
+ if (ase != 0 && splay_tree_lookup (ase->children,
+ (splay_tree_key) MEM_ALIAS_SET (mem1)))
return 0;
/* The two MEMs are in distinct alias sets, and neither one is the
@@ -257,9 +260,7 @@ insert_subset_children (node, data)
splay_tree_node node;
void *data;
{
- splay_tree_insert ((splay_tree) data,
- node->key,
- node->value);
+ splay_tree_insert ((splay_tree) data, node->key, node->value);
return 0;
}
@@ -286,33 +287,32 @@ record_alias_subset (superset, subset)
abort ();
superset_entry = get_alias_set_entry (superset);
- if (!superset_entry)
+ if (superset_entry == 0)
{
/* Create an entry for the SUPERSET, so that we have a place to
attach the SUBSET. */
- superset_entry =
- (alias_set_entry) xmalloc (sizeof (struct alias_set_entry));
+ superset_entry
+ = (alias_set_entry) xmalloc (sizeof (struct alias_set_entry));
superset_entry->alias_set = superset;
superset_entry->children
= splay_tree_new (splay_tree_compare_ints, 0, 0);
- splay_tree_insert (alias_sets,
- (splay_tree_key) superset,
+ splay_tree_insert (alias_sets, (splay_tree_key) superset,
(splay_tree_value) superset_entry);
}
subset_entry = get_alias_set_entry (subset);
+
+ /* If there is an entry for the subset, enter all of its children
+ (if they are not already present) as children of the SUPERSET. */
if (subset_entry)
- /* There is an entry for the subset. Enter all of its children
- (if they are not already present) as children of the SUPERSET. */
splay_tree_foreach (subset_entry->children,
insert_subset_children,
superset_entry->children);
/* Enter the SUBSET itself as a child of the SUPERSET. */
splay_tree_insert (superset_entry->children,
- (splay_tree_key) subset,
- /*value=*/0);
+ (splay_tree_key) subset, 0);
}
/* Inside SRC, the source of a SET, find a base address. */
@@ -328,7 +328,7 @@ find_base_value (src)
return src;
case REG:
- /* At the start of a function argument registers have known base
+ /* At the start of a function, argument registers have known base
values which may be lost later. Returning an ADDRESS
expression here allows optimization based on argument values
even when the argument registers are used for other purposes. */
@@ -363,7 +363,8 @@ find_base_value (src)
src = XEXP (src, 0);
if (GET_CODE (src) != PLUS && GET_CODE (src) != MINUS)
break;
- /* fall through */
+
+ /* ... fall through ... */
case PLUS:
case MINUS:
@@ -375,42 +376,31 @@ find_base_value (src)
if (GET_CODE (src_0) == REG)
{
temp = find_base_value (src_0);
- if (temp)
+ if (temp != 0)
src_0 = temp;
}
if (GET_CODE (src_1) == REG)
{
temp = find_base_value (src_1);
- if (temp)
+ if (temp!= 0)
src_1 = temp;
}
- /* Guess which operand is the base address.
-
+ /* Guess which operand is the base address:
If either operand is a symbol, then it is the base. If
either operand is a CONST_INT, then the other is the base. */
-
- if (GET_CODE (src_1) == CONST_INT
- || GET_CODE (src_0) == SYMBOL_REF
- || GET_CODE (src_0) == LABEL_REF
- || GET_CODE (src_0) == CONST)
+ if (GET_CODE (src_1) == CONST_INT || CONSTANT_P (src_0))
return find_base_value (src_0);
-
- if (GET_CODE (src_0) == CONST_INT
- || GET_CODE (src_1) == SYMBOL_REF
- || GET_CODE (src_1) == LABEL_REF
- || GET_CODE (src_1) == CONST)
+ else if (GET_CODE (src_0) == CONST_INT || CONSTANT_P (src_1))
return find_base_value (src_1);
- /* This might not be necessary anymore.
-
+ /* This might not be necessary anymore:
If either operand is a REG that is a known pointer, then it
is the base. */
- if (GET_CODE (src_0) == REG && REGNO_POINTER_FLAG (REGNO (src_0)))
+ else if (GET_CODE (src_0) == REG && REGNO_POINTER_FLAG (REGNO (src_0)))
return find_base_value (src_0);
-
- if (GET_CODE (src_1) == REG && REGNO_POINTER_FLAG (REGNO (src_1)))
+ else if (GET_CODE (src_1) == REG && REGNO_POINTER_FLAG (REGNO (src_1)))
return find_base_value (src_1);
return 0;
@@ -442,7 +432,7 @@ find_base_value (src)
/* Called from init_alias_analysis indirectly through note_stores. */
-/* while scanning insns to find base values, reg_seen[N] is nonzero if
+/* While scanning insns to find base values, reg_seen[N] is nonzero if
register N has been set in this function. */
static char *reg_seen;
@@ -523,6 +513,7 @@ record_set (dest, set, data)
}
/* Called from loop optimization when a new pseudo-register is created. */
+
void
record_base_value (regno, val, invariant)
int regno;
@@ -541,11 +532,11 @@ record_base_value (regno, val, invariant)
if (GET_CODE (val) == REG)
{
if ((unsigned) REGNO (val) < reg_base_value_size)
- {
- reg_base_value[regno] = reg_base_value[REGNO (val)];
- }
+ reg_base_value[regno] = reg_base_value[REGNO (val)];
+
return;
}
+
reg_base_value[regno] = find_base_value (val);
}
@@ -574,6 +565,7 @@ canon_rtx (x)
return gen_rtx_PLUS (GET_MODE (x), x0, x1);
}
}
+
/* This gives us much better alias analysis when called from
the loop optimizer. Note we want to leave the original
MEM alone, but need to return the canonicalized MEM with
@@ -581,9 +573,11 @@ canon_rtx (x)
else if (GET_CODE (x) == MEM)
{
rtx addr = canon_rtx (XEXP (x, 0));
+
if (addr != XEXP (x, 0))
{
rtx new = gen_rtx_MEM (GET_MODE (x), addr);
+
RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (x);
MEM_COPY_ATTRIBUTES (new, x);
MEM_ALIAS_SET (new) = MEM_ALIAS_SET (x);
@@ -611,6 +605,7 @@ rtx_equal_for_memref_p (x, y)
return 1;
if (x == 0 || y == 0)
return 0;
+
x = canon_rtx (x);
y = canon_rtx (y);
@@ -643,7 +638,8 @@ rtx_equal_for_memref_p (x, y)
if (code == CONST_DOUBLE)
return 0;
if (code == ADDRESSOF)
- return REGNO (XEXP (x, 0)) == REGNO (XEXP (y, 0)) && XINT (x, 1) == XINT (y, 1);
+ return (REGNO (XEXP (x, 0)) == REGNO (XEXP (y, 0))
+ && XINT (x, 1) == XINT (y, 1));
/* For commutative operations, the RTX match if the operand match in any
order. Also handle the simple binary and unary cases without a loop. */
@@ -680,7 +676,8 @@ rtx_equal_for_memref_p (x, y)
/* And the corresponding elements must match. */
for (j = 0; j < XVECLEN (x, i); j++)
- if (rtx_equal_for_memref_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
+ if (rtx_equal_for_memref_p (XVECEXP (x, i, j),
+ XVECEXP (y, i, j)) == 0)
return 0;
break;
@@ -795,14 +792,14 @@ find_base_term (x)
/* If either base term is named object or a special address
(like an argument or stack reference), then use it for the
base term. */
- if (tmp1
+ if (tmp1 != 0
&& (GET_CODE (tmp1) == SYMBOL_REF
|| GET_CODE (tmp1) == LABEL_REF
|| (GET_CODE (tmp1) == ADDRESS
&& GET_MODE (tmp1) != VOIDmode)))
return tmp1;
- if (tmp2
+ if (tmp2 != 0
&& (GET_CODE (tmp2) == SYMBOL_REF
|| GET_CODE (tmp2) == LABEL_REF
|| (GET_CODE (tmp2) == ADDRESS
@@ -846,8 +843,10 @@ base_alias_check (x, y, x_mode, y_mode)
if (x_base == 0)
{
rtx x_c;
+
if (! flag_expensive_optimizations || (x_c = canon_rtx (x)) == x)
return 1;
+
x_base = find_base_term (x_c);
if (x_base == 0)
return 1;
@@ -858,6 +857,7 @@ base_alias_check (x, y, x_mode, y_mode)
rtx y_c;
if (! flag_expensive_optimizations || (y_c = canon_rtx (y)) == y)
return 1;
+
y_base = find_base_term (y_c);
if (y_base == 0)
return 1;
diff --git a/gcc/cse.c b/gcc/cse.c
index 8c03fce0c58..c27c8fd4dc8 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -722,11 +722,6 @@ dump_class (classp)
}
}
-/* Return an estimate of the cost of computing rtx X.
- One use is in cse, to decide which expression to keep in the hash table.
- Another is in rtl generation, to pick the cheapest way to multiply.
- Other uses like the latter are expected in the future. */
-
/* Internal function, to compute cost when X is not a register; called
from COST macro to keep it simple. */
@@ -755,6 +750,11 @@ notreg_cost (x)
#define COSTS_N_INSNS(N) ((N) * 4 - 2)
+/* Return an estimate of the cost of computing rtx X.
+ One use is in cse, to decide which expression to keep in the hash table.
+ Another is in rtl generation, to pick the cheapest way to multiply.
+ Other uses like the latter are expected in the future. */
+
int
rtx_cost (x, outer_code)
rtx x;
diff --git a/gcc/flow.c b/gcc/flow.c
index 606f2064c55..eff2a05d686 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -103,8 +103,8 @@ Boston, MA 02111-1307, USA. */
a REG_INC element is added to the insn's REG_NOTES list.
life_analysis fills in certain vectors containing information about
- register usage: reg_n_refs, reg_n_deaths, reg_n_sets, reg_live_length,
- reg_n_calls_crosses and reg_basic_block.
+ register usage: REG_N_REFS, REG_N_DEATHS, REG_N_SETS, REG_LIVE_LENGTH,
+ REG_N_CALLS_CROSSED and REG_BASIC_BLOCK.
life_analysis sets current_function_sp_is_unchanging if the function
doesn't modify the stack pointer. */
@@ -178,10 +178,8 @@ varray_type basic_block_info;
/* The special entry and exit blocks. */
-struct basic_block_def entry_exit_blocks[2] =
-{
- {
- NULL, /* head */
+struct basic_block_def entry_exit_blocks[2]
+= {{NULL, /* head */
NULL, /* end */
NULL, /* pred */
NULL, /* succ */
@@ -2392,8 +2390,10 @@ calculate_loop_depth (dump)
/* The loop infrastructure does the real job for us. */
flow_loops_find (&loops);
+
if (dump)
flow_loops_dump (&loops, dump, 0);
+
flow_loops_free (&loops);
}
@@ -6802,6 +6802,7 @@ flow_loop_level_compute (loop, depth)
/* Compute the loop nesting depth and enclosed loop level for the loop
hierarchy tree specfied by LOOPS. Return the maximum enclosed loop
level. */
+
static int
flow_loops_level_compute (loops)
struct loops *loops;
@@ -6813,6 +6814,7 @@ flow_loops_level_compute (loops)
/* Find all the natural loops in the function and save in LOOPS structure
and recalculate loop_depth information in basic block structures.
Return the number of natural loops found. */
+
int
flow_loops_find (loops)
struct loops *loops;
@@ -6872,8 +6874,8 @@ flow_loops_find (loops)
flow_depth_first_order_compute (dfs_order);
/* Allocate loop structures. */
- loops->array = (struct loop *)
- xcalloc (num_loops, sizeof (struct loop));
+ loops->array
+ = (struct loop *) xcalloc (num_loops, sizeof (struct loop));
headers = sbitmap_alloc (n_basic_blocks);
sbitmap_zero (headers);
@@ -6921,8 +6923,8 @@ flow_loops_find (loops)
/* Find nodes contained within the loop. */
loop->nodes = sbitmap_alloc (n_basic_blocks);
- loop->num_nodes =
- flow_loop_nodes_find (header, latch, loop->nodes);
+ loop->num_nodes
+ = flow_loop_nodes_find (header, latch, loop->nodes);
/* Find edges which exit the loop. Note that a node
may have several exit edges. */
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c13b907192b..335cb5cbc3e 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -66,7 +66,9 @@ static tree split_tree PROTO((tree, enum tree_code, tree *, tree *,
int));
static tree associate_trees PROTO((tree, tree, enum tree_code, tree));
static tree int_const_binop PROTO((enum tree_code, tree, tree, int, int));
+static void const_binop_1 PROTO((PTR));
static tree const_binop PROTO((enum tree_code, tree, tree, int));
+static void fold_convert_1 PROTO((PTR));
static tree fold_convert PROTO((tree, tree));
static enum tree_code invert_tree_comparison PROTO((enum tree_code));
static enum tree_code swap_tree_comparison PROTO((enum tree_code));
@@ -100,29 +102,31 @@ static tree strip_compound_expr PROTO((tree, tree));
static int multiple_of_p PROTO((tree, tree, tree));
static tree constant_boolean_node PROTO((int, tree));
static int count_cond PROTO((tree, int));
-static void const_binop_1 PROTO((PTR));
-static void fold_convert_1 PROTO((PTR));
#ifndef BRANCH_COST
#define BRANCH_COST 1
#endif
-/* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow.
- Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1.
- Then this yields nonzero if overflow occurred during the addition.
- Overflow occurs if A and B have the same sign, but A and SUM differ in sign.
- Use `^' to test whether signs differ, and `< 0' to isolate the sign. */
-#define overflow_sum_sign(a, b, sum) ((~((a) ^ (b)) & ((a) ^ (sum))) < 0)
+/* We know that A1 + B1 = SUM1, using 2's complement arithmetic and ignoring
+ overflow. Suppose A, B and SUM have the same respective signs as A1, B1,
+ and SUM1. Then this yields nonzero if overflow occurred during the
+ addition.
+
+ Overflow occurs if A and B have the same sign, but A and SUM differ in
+ sign. Use `^' to test whether signs differ, and `< 0' to isolate the
+ sign. */
+#define OVERFLOW_SUM_SIGN(a, b, sum) ((~((a) ^ (b)) & ((a) ^ (sum))) < 0)
/* To do constant folding on INTEGER_CST nodes requires two-word arithmetic.
We do that by representing the two-word integer in 4 words, with only
- HOST_BITS_PER_WIDE_INT/2 bits stored in each word, as a positive number. */
+ HOST_BITS_PER_WIDE_INT / 2 bits stored in each word, as a positive
+ number. The value of the word is LOWPART + HIGHPART * BASE. */
#define LOWPART(x) \
- ((x) & (((unsigned HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT/2)) - 1))
+ ((x) & (((unsigned HOST_WIDE_INT) 1 << (HOST_BITS_PER_WIDE_INT / 2)) - 1))
#define HIGHPART(x) \
- ((unsigned HOST_WIDE_INT) (x) >> HOST_BITS_PER_WIDE_INT/2)
-#define BASE ((unsigned HOST_WIDE_INT) 1 << HOST_BITS_PER_WIDE_INT/2)
+ ((unsigned HOST_WIDE_INT) (x) >> HOST_BITS_PER_WIDE_INT / 2)
+#define BASE ((unsigned HOST_WIDE_INT) 1 << HOST_BITS_PER_WIDE_INT / 2)
/* Unpack a two-word integer into 4 words.
LOW and HI are the integer, as two `HOST_WIDE_INT' pieces.
@@ -148,16 +152,16 @@ decode (words, low, hi)
HOST_WIDE_INT *words;
HOST_WIDE_INT *low, *hi;
{
- *low = words[0] | words[1] * BASE;
- *hi = words[2] | words[3] * BASE;
+ *low = words[0] + words[1] * BASE;
+ *hi = words[2] + words[3] * BASE;
}
-/* Make the integer constant T valid for its type
- by setting to 0 or 1 all the bits in the constant
- that don't belong in the type.
- Yield 1 if a signed overflow occurs, 0 otherwise.
- If OVERFLOW is nonzero, a signed overflow has already occurred
- in calculating T, so propagate it.
+/* Make the integer constant T valid for its type by setting to 0 or 1 all
+ the bits in the constant that don't belong in the type.
+
+ Return 1 if a signed overflow occurs, 0 otherwise. If OVERFLOW is
+ nonzero, a signed overflow has already occurred in calculating T, so
+ propagate it.
Make the real constant T valid for its type by calling CHECK_FLOAT_VALUE,
if it exists. */
@@ -195,10 +199,8 @@ force_fit_type (t, overflow)
if (prec == 2 * HOST_BITS_PER_WIDE_INT)
;
else if (prec > HOST_BITS_PER_WIDE_INT)
- {
- TREE_INT_CST_HIGH (t)
- &= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- }
+ TREE_INT_CST_HIGH (t)
+ &= ~((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
else
{
TREE_INT_CST_HIGH (t) = 0;
@@ -220,10 +222,8 @@ force_fit_type (t, overflow)
/* Value is negative:
set to 1 all the bits that are outside this type's precision. */
if (prec > HOST_BITS_PER_WIDE_INT)
- {
- TREE_INT_CST_HIGH (t)
- |= ((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
- }
+ TREE_INT_CST_HIGH (t)
+ |= ((HOST_WIDE_INT) (-1) << (prec - HOST_BITS_PER_WIDE_INT));
else
{
TREE_INT_CST_HIGH (t) = -1;
@@ -232,7 +232,7 @@ force_fit_type (t, overflow)
}
}
- /* Yield nonzero if signed overflow occurred. */
+ /* Return nonzero if signed overflow occurred. */
return
((overflow | (low ^ TREE_INT_CST_LOW (t)) | (high ^ TREE_INT_CST_HIGH (t)))
!= 0);
@@ -255,7 +255,7 @@ add_double (l1, h1, l2, h2, lv, hv)
*lv = l;
*hv = h;
- return overflow_sum_sign (h1, h2, h);
+ return OVERFLOW_SUM_SIGN (h1, h2, h);
}
/* Negate a doubleword integer with doubleword result.
@@ -975,10 +975,9 @@ fail:
return 1;
}
-
/* Convert C9X hexadecimal floating point string constant S. Return
real value type in mode MODE. This function uses the host computer's
- fp arithmetic when there is no REAL_ARITHMETIC. */
+ floating point arithmetic when there is no REAL_ARITHMETIC. */
REAL_VALUE_TYPE
real_hex_to_f (s, mode)
@@ -988,8 +987,13 @@ real_hex_to_f (s, mode)
REAL_VALUE_TYPE ip;
char *p = s;
unsigned HOST_WIDE_INT low, high;
- int frexpon, expon, shcount, nrmcount, k;
- int sign, expsign, decpt, isfloat, isldouble, gotp, lost;
+ int expon, shcount, nrmcount, k;
+ int sign, expsign, isfloat, isldouble;
+ int lost = 0;/* Nonzero low order bits shifted out and discarded. */
+ int frexpon = 0; /* Bits after the decimal point. */
+ int expon = 0; /* Value of exponent. */
+ int decpt = 0; /* How many decimal points. */
+ int gotp = 0; /* How many P's. */
char c;
isldouble = 0;
@@ -1027,11 +1031,6 @@ real_hex_to_f (s, mode)
high = 0;
low = 0;
- lost = 0; /* Nonzero low order bits shifted out and discarded. */
- frexpon = 0; /* Bits after the decimal point. */
- expon = 0; /* Value of exponent. */
- decpt = 0; /* How many decimal points. */
- gotp = 0; /* How many P's. */
shcount = 0;
while ((c = *p) != '\0')
{
@@ -1058,7 +1057,7 @@ real_hex_to_f (s, mode)
{
/* Record nonzero lost bits. */
lost |= k;
- if (!decpt)
+ if (! decpt)
frexpon -= 4;
}
++p;
@@ -1068,6 +1067,7 @@ real_hex_to_f (s, mode)
++decpt;
++p;
}
+
else if (c == 'p' || c == 'P')
{
++gotp;
@@ -1078,6 +1078,7 @@ real_hex_to_f (s, mode)
expsign = -1;
++p;
}
+
/* Value of exponent.
The exponent field is a decimal integer. */
while (ISDIGIT(*p))
@@ -1085,6 +1086,7 @@ real_hex_to_f (s, mode)
k = (*p++ & 0x7f) - '0';
expon = 10 * expon + k;
}
+
expon *= expsign;
/* F suffix is ambiguous in the significand part
so it must appear after the decimal exponent field. */
@@ -1095,6 +1097,7 @@ real_hex_to_f (s, mode)
break;
}
}
+
else if (c == 'l' || c == 'L')
{
isldouble = 1;
@@ -1104,18 +1107,19 @@ real_hex_to_f (s, mode)
else
break;
}
+
/* Abort if last character read was not legitimate. */
c = *p;
if ((c != '\0' && c != ' ' && c != '\n' && c != '\r') || (decpt > 1))
abort ();
+
/* There must be either one decimal point or one p. */
if (decpt == 0 && gotp == 0)
abort ();
+
shcount -= 4;
- if ((high == 0) && (low == 0))
- {
- return dconst0;
- }
+ if (high == 0 && low == 0))
+ return dconst0;
/* Normalize. */
nrmcount = 0;
@@ -1125,6 +1129,7 @@ real_hex_to_f (s, mode)
low = 0;
nrmcount += 32;
}
+
/* Leave a high guard bit for carry-out. */
if ((high & 0x80000000) != 0)
{
@@ -1133,18 +1138,21 @@ real_hex_to_f (s, mode)
high = high >> 1;
nrmcount -= 1;
}
+
if ((high & 0xffff8000) == 0)
{
high = (high << 16) + ((low >> 16) & 0xffff);
low = low << 16;
nrmcount += 16;
}
+
while ((high & 0xc0000000) == 0)
{
high = (high << 1) + ((low >> 31) & 1);
low = low << 1;
nrmcount += 1;
}
+
if (isfloat || GET_MODE_SIZE(mode) == UNITS_PER_WORD)
{
/* Keep 24 bits precision, bits 0x7fffff80.
@@ -1193,6 +1201,7 @@ real_hex_to_f (s, mode)
low &= 0xffffff80;
#endif
}
+
ip = (double) high;
ip = REAL_VALUE_LDEXP (ip, 32) + (double) low;
/* Apply shifts and exponent value as power of 2. */
@@ -1449,7 +1458,7 @@ int_const_binop (code, arg1, arg2, notrunc, forsize)
case MINUS_EXPR:
neg_double (int2l, int2h, &low, &hi);
add_double (int1l, int1h, low, hi, &low, &hi);
- overflow = overflow_sum_sign (hi, int2h, int1h);
+ overflow = OVERFLOW_SUM_SIGN (hi, int2h, int1h);
break;
case MULT_EXPR:
@@ -1515,21 +1524,18 @@ int_const_binop (code, arg1, arg2, notrunc, forsize)
case MIN_EXPR:
case MAX_EXPR:
if (uns)
- {
- 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)));
- }
+ 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 HOST_WIDE_INT) int1l
- < (unsigned HOST_WIDE_INT) int2l)));
- }
+ low = ((int1h < int2h)
+ || ((int1h == int2h)
+ && ((unsigned HOST_WIDE_INT) int1l
+ < (unsigned HOST_WIDE_INT) int2l)));
+
if (low == (code == MIN_EXPR))
low = int1l, hi = int1h;
else
@@ -1558,6 +1564,7 @@ int_const_binop (code, arg1, arg2, notrunc, forsize)
: force_fit_type (t, (!uns || forsize) && overflow) && ! no_overflow)
| TREE_OVERFLOW (arg1)
| TREE_OVERFLOW (arg2));
+
/* If we're doing a size calculation, unsigned arithmetic does overflow.
So check if force_fit_type truncated the value. */
if (forsize
@@ -1565,27 +1572,30 @@ int_const_binop (code, arg1, arg2, notrunc, forsize)
&& (TREE_INT_CST_HIGH (t) != hi
|| TREE_INT_CST_LOW (t) != low))
TREE_OVERFLOW (t) = 1;
+
TREE_CONSTANT_OVERFLOW (t) = (TREE_OVERFLOW (t)
| TREE_CONSTANT_OVERFLOW (arg1)
| TREE_CONSTANT_OVERFLOW (arg2));
return t;
}
+/* Define input and output argument for const_binop_1. */
struct cb_args
{
- /* Input */
- tree arg1;
- REAL_VALUE_TYPE d1, d2;
- enum tree_code code;
- /* Output */
- tree t;
+ enum tree_code code; /* Input: tree code for operation*/
+ tree type; /* Input: tree type for operation. */
+ REAL_VALUE_TYPE d1, d2; /* Input: floating point operands. */
+ tree t; /* Output: constant for result. */
};
+/* Do the real arithmetic for const_binop while protected by a
+ float overflow handler. */
+
static void
const_binop_1 (data)
PTR data;
{
- struct cb_args * args = (struct cb_args *) data;
+ struct cb_args *args = (struct cb_args *) data;
REAL_VALUE_TYPE value;
#ifdef REAL_ARITHMETIC
@@ -1626,16 +1636,15 @@ const_binop_1 (data)
abort ();
}
#endif /* no REAL_ARITHMETIC */
- args->t =
- build_real (TREE_TYPE (args->arg1),
- real_value_truncate (TYPE_MODE (TREE_TYPE (args->arg1)),
- value));
+
+ args->t
+ = build_real (args->type,
+ real_value_truncate (TYPE_MODE (args->type), value));
}
-/* Combine two constants ARG1 and ARG2 under operation CODE
- to produce a new constant.
- We assume ARG1 and ARG2 have the same data type,
- or at least are the same kind of constant and the same machine mode.
+/* Combine two constants ARG1 and ARG2 under operation CODE to produce a new
+ constant. We assume ARG1 and ARG2 have the same data type, or at least
+ are the same kind of constant and the same machine mode.
If NOTRUNC is nonzero, do not truncate the result to fit the data type. */
@@ -1670,19 +1679,17 @@ const_binop (code, arg1, arg2, notrunc)
return arg2;
/* Setup input for const_binop_1() */
- args.arg1 = arg1;
+ args.type = TREE_TYPE (arg1);
args.d1 = d1;
args.d2 = d2;
args.code = code;
if (do_float_handler (const_binop_1, (PTR) &args))
- {
- /* Receive output from const_binop_1() */
- t = args.t;
- }
+ /* Receive output from const_binop_1. */
+ t = args.t;
else
{
- /* We got an exception from const_binop_1() */
+ /* We got an exception from const_binop_1. */
t = copy_node (arg1);
overflow = 1;
}
@@ -1776,36 +1783,51 @@ const_binop (code, arg1, arg2, notrunc)
return 0;
}
-/* Return an INTEGER_CST with value V . The type is determined by bit_p:
- if it is zero, the type is taken from sizetype; if it is one, the type
- is taken from bitsizetype. */
+/* Return an INTEGER_CST with value whose HOST_BITS_PER_WIDE_INT bits are
+ given by HIGH and whose HOST_BITS_PER_WIDE_INT bits are given by NUMBER.
+
+ If BIT_P is nonzero, this represents a size in bit and the type of the
+ result will be bitsizetype, othewise it represents a size in bytes and
+ the type of the result will be sizetype. */
tree
size_int_wide (number, high, bit_p)
unsigned HOST_WIDE_INT number, high;
int bit_p;
{
+ /* Type-size nodes already made for small sizes. */
+ static tree size_table[2 * HOST_BITS_PER_WIDE_INT + 1][2];
+ static int init_p = 0;
tree t;
- if (!ggc_p)
+ if (ggc_p && ! init_p)
{
- /* Type-size nodes already made for small sizes. */
- static tree size_table[2*HOST_BITS_PER_WIDE_INT + 1][2];
+ ggc_add_tree_root ((tree *) size_table,
+ sizeof size_table / sizeof (tree));
+ init_p = 1;
+ }
+
+ if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && high == 0
+ && size_table[number][bit_p] != 0)
+ return size_table[number][bit_p];
- if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && ! high
- && size_table[number][bit_p] != 0)
- return size_table[number][bit_p];
- if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && ! high)
+ if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && high == 0)
+ {
+ if (! ggc_p)
{
- push_obstacks_nochange ();
/* Make this a permanent node. */
+ push_obstacks_nochange ();
end_temporary_allocation ();
- t = build_int_2 (number, 0);
- TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
- size_table[number][bit_p] = t;
- pop_obstacks ();
- return t;
}
+
+ t = build_int_2 (number, 0);
+ TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
+ size_table[number][bit_p] = t;
+
+ if (! ggc_p)
+ pop_obstacks ();
+
+ return t;
}
t = build_int_2 (number, high);
@@ -1879,14 +1901,17 @@ ssize_binop (code, arg0, arg1)
return fold (build (code, ssizetype, arg0, arg1));
}
+/* This structure is used to communicate arguments to fold_convert_1. */
struct fc_args
{
- /* Input */
- tree arg1, type;
- /* Output */
- tree t;
+ tree arg1; /* Input: value to convert. */
+ tree type; /* Input: type to convert value to. */
+ tree t; /* Ouput: result of conversion. */
};
+/* Function to convert floating-point constants, protected by floating
+ point exception handler. */
+
static void
fold_convert_1 (data)
PTR data;
@@ -2400,11 +2425,8 @@ twoval_comparison_p (arg, cval1, cval2, save_p)
|| code == COMPOUND_EXPR))
class = '2';
- /* ??? Disable this since the SAVE_EXPR might already be in use outside
- the expression. There may be no way to make this work, but it needs
- to be looked at again for 2.6. */
-#if 0
- else if (class == 'e' && code == SAVE_EXPR && SAVE_EXPR_RTL (arg) == 0)
+ else if (class == 'e' && code == SAVE_EXPR && SAVE_EXPR_RTL (arg) == 0
+ && ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0)))
{
/* If we've already found a CVAL1 or CVAL2, this expression is
two complex to handle. */
@@ -2414,7 +2436,6 @@ twoval_comparison_p (arg, cval1, cval2, save_p)
class = '1';
*save_p = 1;
}
-#endif
switch (class)
{
@@ -4513,6 +4534,7 @@ constant_boolean_node (value, type)
else
{
tree t = build_int_2 (value, 0);
+
TREE_TYPE (t) = type;
return t;
}
@@ -4559,10 +4581,8 @@ fold (expr)
register enum tree_code code = TREE_CODE (t);
register int kind;
int invert;
-
/* WINS will be nonzero when the switch is done
if all operands are constant. */
-
int wins = 1;
/* Don't try to process an RTL_EXPR since its operands aren't trees.
@@ -4737,11 +4757,13 @@ fold (expr)
&& (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0))
== TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 2), 0)))
&& ! (INTEGRAL_TYPE_P (TREE_TYPE (t))
- && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0)))
+ && (INTEGRAL_TYPE_P
+ (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0))))
&& TYPE_PRECISION (TREE_TYPE (t)) <= BITS_PER_WORD))
t = build1 (code, type,
build (COND_EXPR,
- TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0)),
+ TREE_TYPE (TREE_OPERAND
+ (TREE_OPERAND (t, 1), 0)),
TREE_OPERAND (t, 0),
TREE_OPERAND (TREE_OPERAND (t, 1), 0),
TREE_OPERAND (TREE_OPERAND (t, 2), 0)));
diff --git a/gcc/regs.h b/gcc/regs.h
index d0f7446a584..ff267febc30 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -1,5 +1,5 @@
/* Define per-register tables for data flow info and register allocation.
- Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 93-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -39,13 +39,13 @@ Boston, MA 02111-1307, USA. */
extern int max_regno;
/* Register information indexed by register number */
-typedef struct reg_info_def {
- /* fields set by reg_scan */
+typedef struct reg_info_def
+{ /* fields set by reg_scan */
int first_uid; /* UID of first insn to use (REG n) */
int last_uid; /* UID of last insn to use (REG n) */
int last_note_uid; /* UID of last note to use (REG n) */
- /* fields set by both reg_scan and flow_analysis */
+ /* fields set by reg_scan & flow_analysis */
int sets; /* # of times (REG n) is set */
/* fields set by flow_analysis */
diff --git a/gcc/reload.c b/gcc/reload.c
index bcaef6cf534..529a2c6ebb5 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -1718,7 +1718,7 @@ combine_reloads ()
that it does not occur in the output (we already know it isn't an
earlyclobber. If this is an asm insn, give up. */
- if (INSN_CODE (this_insn) == -1)
+ if (INSN_CODE (this_insn) == -1 || output_reload == -1)
return;
for (i = 1; i < insn_data[INSN_CODE (this_insn)].n_operands; i++)
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 1688fc30a00..4fa645af9d9 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1,5 +1,5 @@
/* C-compiler utilities for types and variables storage layout
- Copyright (C) 1987, 88, 92-97, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 92-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -21,7 +21,6 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
-
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
@@ -67,6 +66,7 @@ get_pending_sizes ()
/* Put each SAVE_EXPR into the current function. */
for (t = chain; t; t = TREE_CHAIN (t))
SAVE_EXPR_CONTEXT (TREE_VALUE (t)) = current_function_decl;
+
pending_sizes = 0;
return chain;
}
@@ -123,7 +123,8 @@ variable_size (size)
Also, we would like to pass const0_rtx here, but don't have it. */
expand_expr (size, expand_expr (integer_zero_node, NULL_PTR, VOIDmode, 0),
VOIDmode, 0);
- else if (current_function && current_function->x_dont_save_pending_sizes_p)
+ else if (current_function != 0
+ && current_function->x_dont_save_pending_sizes_p)
/* The front-end doesn't want us to keep a list of the expressions
that determine sizes for variable size objects. */
;
@@ -203,7 +204,8 @@ int_mode_for_mode (mode)
case MODE_RANDOM:
if (mode == BLKmode)
break;
- /* FALLTHRU */
+
+ /* ... fall through ... */
case MODE_CC:
default:
@@ -282,8 +284,8 @@ layout_decl (decl, known_align)
|| (! DECL_PACKED (decl) && TYPE_ALIGN (type) > DECL_ALIGN (decl)))
DECL_ALIGN (decl) = TYPE_ALIGN (type);
- /* See if we can use an ordinary integer mode for a bit-field. */
- /* Conditions are: a fixed size that is correct for another mode
+ /* See if we can use an ordinary integer mode for a bit-field.
+ Conditions are: a fixed size that is correct for another mode
and occupying a complete byte or bytes on proper boundary. */
if (code == FIELD_DECL)
{
@@ -385,6 +387,7 @@ layout_record (rec)
pending_statics = tree_cons (NULL_TREE, field, pending_statics);
continue;
}
+
/* Enumerators and enum types which are local to this class need not
be laid out. Likewise for initialized constant fields. */
if (TREE_CODE (field) != FIELD_DECL)
@@ -639,7 +642,8 @@ layout_record (rec)
tree unpacked_size;
TYPE_PACKED (rec) = 0;
#ifdef ROUND_TYPE_ALIGN
- unpacked_align = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), unpacked_align);
+ unpacked_align
+ = ROUND_TYPE_ALIGN (rec, TYPE_ALIGN (rec), unpacked_align);
#else
unpacked_align = MAX (TYPE_ALIGN (rec), unpacked_align);
#endif
@@ -825,6 +829,7 @@ layout_type (type)
case BOOLEAN_TYPE: /* Used for Java, Pascal, and Chill. */
if (TYPE_PRECISION (type) == 0)
TYPE_PRECISION (type) = 1; /* default to one byte/boolean. */
+
/* ... fall through ... */
case INTEGER_TYPE:
@@ -937,9 +942,11 @@ layout_type (type)
element_size = TYPE_SIZE (element);
if (TYPE_PACKED (type) && INTEGRAL_TYPE_P (element))
{
- HOST_WIDE_INT maxvalue, minvalue;
- maxvalue = TREE_INT_CST_LOW (TYPE_MAX_VALUE (element));
- minvalue = TREE_INT_CST_LOW (TYPE_MIN_VALUE (element));
+ HOST_WIDE_INT maxvalue
+ = TREE_INT_CST_LOW (TYPE_MAX_VALUE (element));
+ HOST_WIDE_INT minvalue
+ = TREE_INT_CST_LOW (TYPE_MIN_VALUE (element));
+
if (maxvalue - minvalue == 1
&& (maxvalue == 1 || maxvalue == 0))
element_size = integer_one_node;
@@ -957,10 +964,8 @@ layout_type (type)
set correctly in that case. */
if (TYPE_SIZE_UNIT (element) != 0
&& element_size != integer_one_node)
- {
- TYPE_SIZE_UNIT (type)
- = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (element), length);
- }
+ TYPE_SIZE_UNIT (type)
+ = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (element), length);
}
/* Now round the alignment and size,
@@ -976,12 +981,14 @@ layout_type (type)
#ifdef ROUND_TYPE_SIZE
if (TYPE_SIZE (type) != 0)
{
- tree tmp;
- tmp = ROUND_TYPE_SIZE (type, TYPE_SIZE (type), TYPE_ALIGN (type));
+ tree tmp
+ = ROUND_TYPE_SIZE (type, TYPE_SIZE (type), TYPE_ALIGN (type));
+
/* If the rounding changed the size of the type, remove any
pre-calculated TYPE_SIZE_UNIT. */
if (simple_cst_equal (TYPE_SIZE (type), tmp) != 1)
TYPE_SIZE_UNIT (type) = NULL;
+
TYPE_SIZE (type) = tmp;
}
#endif
@@ -999,7 +1006,8 @@ layout_type (type)
MODE_INT, 1);
if (STRICT_ALIGNMENT && TYPE_ALIGN (type) < BIGGEST_ALIGNMENT
- && (int)TYPE_ALIGN (type) < TREE_INT_CST_LOW (TYPE_SIZE (type))
+ && ((int) TYPE_ALIGN (type)
+ < TREE_INT_CST_LOW (TYPE_SIZE (type)))
&& TYPE_MODE (type) != BLKmode)
{
TYPE_NO_FORCE_BLK (type) = 1;
@@ -1066,7 +1074,7 @@ layout_type (type)
then stick with BLKmode. */
if (STRICT_ALIGNMENT
&& ! (TYPE_ALIGN (type) >= BIGGEST_ALIGNMENT
- || ((int)TYPE_ALIGN (type)
+ || ((int) TYPE_ALIGN (type)
>= TREE_INT_CST_LOW (TYPE_SIZE (type)))))
{
if (TYPE_MODE (type) != BLKmode)
@@ -1190,14 +1198,13 @@ layout_type (type)
/* If we failed to find a simple way to calculate the unit size
of the type above, find it by division. */
if (TYPE_SIZE_UNIT (type) == 0 && TYPE_SIZE (type) != 0)
- {
- /* TYPE_SIZE (type) is computed in bitsizetype. After the division, the
- result will fit in sizetype. We will get more efficient code using
- sizetype, so we force a conversion. */
- tree unit_size = size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (type),
- size_int (BITS_PER_UNIT));
- TYPE_SIZE_UNIT (type) = convert (sizetype, unit_size);
- }
+ /* TYPE_SIZE (type) is computed in bitsizetype. After the division, the
+ result will fit in sizetype. We will get more efficient code using
+ sizetype, so we force a conversion. */
+ TYPE_SIZE_UNIT (type)
+ = convert (sizetype,
+ size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (type),
+ size_int (BITS_PER_UNIT)));
/* Once again evaluate only once, either now or as soon as safe. */
if (TYPE_SIZE_UNIT (type) != 0
@@ -1217,7 +1224,7 @@ layout_type (type)
/* Copy it into all variants. */
for (variant = TYPE_MAIN_VARIANT (type);
- variant;
+ variant != 0;
variant = TYPE_NEXT_VARIANT (variant))
{
TYPE_SIZE (variant) = size;
@@ -1265,14 +1272,12 @@ make_signed_type (precision)
/* The first type made with this or `make_unsigned_type'
is the type for size values. */
-
if (sizetype == 0)
set_sizetype (type);
/* Lay out the type: set its alignment, size, etc. */
layout_type (type);
-
return type;
}
@@ -1306,25 +1311,24 @@ void
set_sizetype (type)
tree type;
{
- int oprecision = TYPE_PRECISION (type), precision;
-
- sizetype = type;
-
+ int oprecision = TYPE_PRECISION (type);
/* The *bitsizetype types use a precision that avoids overflows when
- calculating signed sizes / offsets in bits. */
- precision = oprecision + BITS_PER_UNIT_LOG + 1;
- /* However, when cross-compiling from a 32 bit to a 64 bit host,
- we are limited to 64 bit precision. */
- if (precision > 2 * HOST_BITS_PER_WIDE_INT)
- precision = 2 * HOST_BITS_PER_WIDE_INT;
+ calculating signed sizes / offsets in bits. However, when
+ cross-compiling from a 32 bit to a 64 bit host, we are limited to 64 bit
+ precision. */
+ int precision = MAX (oprecision + BITS_PER_UNIT_LOG + 1,
+ 2 * HOST_BITS_PER_WIDE_INT);
+ sizetype = type;
bitsizetype = make_node (INTEGER_TYPE);
TYPE_NAME (bitsizetype) = TYPE_NAME (type);
TYPE_PRECISION (bitsizetype) = precision;
+
if (TREE_UNSIGNED (type))
fixup_unsigned_type (bitsizetype);
else
fixup_signed_type (bitsizetype);
+
layout_type (bitsizetype);
if (TREE_UNSIGNED (type))
@@ -1343,7 +1347,8 @@ set_sizetype (type)
}
TYPE_NAME (bitsizetype) = TYPE_NAME (sizetype);
- ggc_add_tree_root ((tree*) &sizetype_tab, sizeof(sizetype_tab)/sizeof(tree));
+ ggc_add_tree_root ((tree *) &sizetype_tab,
+ sizeof sizetype_tab / sizeof (tree));
}
/* Set the extreme values of TYPE based on its precision in bits,
diff --git a/gcc/tree.c b/gcc/tree.c
index 78ea4cf976a..6f6caf94f74 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -271,9 +271,9 @@ struct type_hash
#define TYPE_HASH_SIZE 59
struct type_hash *type_hash_table[TYPE_HASH_SIZE];
+static void build_real_from_int_cst_1 PROTO((PTR));
static void set_type_quals PROTO((tree, int));
static void append_random_chars PROTO((char *));
-static void build_real_from_int_cst_1 PROTO((PTR));
static void mark_type_hash PROTO ((void *));
static void fix_sizetype PROTO ((tree));
@@ -321,11 +321,14 @@ init_obstacks ()
/* Init the hash table of identifiers. */
bzero ((char *) hash_table, sizeof hash_table);
-
- ggc_add_tree_root (hash_table, MAX_HASH_TABLE);
- ggc_add_root (type_hash_table, TYPE_HASH_SIZE,
- sizeof(struct type_hash *),
- mark_type_hash);
+ ggc_add_tree_root (hash_table, sizeof hash_table / sizeof (tree));
+
+ /* Initialize the hash table of types. */
+ bzero ((char *) type_hash_table,
+ sizeof type_hash_table / sizeof type_hash_table[0]);
+ ggc_add_root (type_hash_table,
+ sizeof type_hash_table / sizeof type_hash_table [0],
+ sizeof type_hash_table[0], mark_type_hash);
ggc_add_tree_root (global_trees, TI_MAX);
}
@@ -574,6 +577,7 @@ permanent_allocation (function_end)
}
else
obstack_free (&momentary_obstack, momentary_firstobj);
+
obstack_free (function_maybepermanent_obstack, maybepermanent_firstobj);
obstack_free (&temp_decl_obstack, temp_decl_firstobj);
@@ -880,8 +884,8 @@ resume_momentary (yes)
void
init_tree_codes ()
{
- built_in_filename =
- ggc_alloc_string (BUILT_IN_FILENAME, sizeof (BUILT_IN_FILENAME));
+ built_in_filename
+ = ggc_alloc_string (BUILT_IN_FILENAME, sizeof (BUILT_IN_FILENAME));
ggc_add_string_root (&built_in_filename, 1);
}
@@ -1379,6 +1383,7 @@ build_int_2_wide (low, hi)
HOST_WIDE_INT low, hi;
{
register tree t = make_node (INTEGER_CST);
+
TREE_INT_CST_LOW (t) = low;
TREE_INT_CST_HIGH (t) = hi;
TREE_TYPE (t) = integer_type_node;
@@ -1456,31 +1461,37 @@ real_value_from_int_cst (type, i)
return d;
}
+/* Args to pass to and from build_real_from_int_cst_1. */
+
struct brfic_args
{
- /* Input */
- tree type, i;
- /* Output */
- REAL_VALUE_TYPE d;
+ tree type; /* Input: type to conver to. */
+ tree i; /* Input: operand to convert */
+ REAL_VALUE_TYPE d; /* Output: floating point value. */
};
+/* Convert an integer to a floating point value while protected by a floating
+ point exception handler. */
+
static void
build_real_from_int_cst_1 (data)
PTR data;
{
- struct brfic_args * args = (struct brfic_args *) data;
+ struct brfic_args *args = (struct brfic_args *) data;
#ifdef REAL_ARITHMETIC
args->d = real_value_from_int_cst (args->type, args->i);
#else
- args->d =
- REAL_VALUE_TRUNCATE (TYPE_MODE (args->type),
- real_value_from_int_cst (args->type, args->i));
+ args->d
+ = REAL_VALUE_TRUNCATE (TYPE_MODE (args->type),
+ real_value_from_int_cst (args->type, args->i));
#endif
}
-/* This function can't be implemented if we can't do arithmetic
- on the float representation. */
+/* Given a tree representing an integer constant I, return a tree
+ representing the same value as a floating-point constant of type TYPE.
+ We cannot perform this operation if there is no way of doing arithmetic
+ on floating-point values. */
tree
build_real_from_int_cst (type, i)
@@ -1500,10 +1511,8 @@ build_real_from_int_cst (type, i)
args.i = i;
if (do_float_handler (build_real_from_int_cst_1, (PTR) &args))
- {
- /* Receive output from build_real_from_int_cst_1() */
- d = args.d;
- }
+ /* Receive output from build_real_from_int_cst_1() */
+ d = args.d;
else
{
/* We got an exception from build_real_from_int_cst_1() */
@@ -1538,11 +1547,13 @@ build_string (len, str)
deferring constant output in varasm.c. */
register tree s = make_node (STRING_CST);
+
TREE_STRING_LENGTH (s) = len;
if (ggc_p)
TREE_STRING_POINTER (s) = ggc_alloc_string (str, len);
else
TREE_STRING_POINTER (s) = obstack_copy0 (saveable_obstack, str, len);
+
return s;
}
@@ -1897,10 +1908,8 @@ chain_member (elem, chain)
}
/* Return nonzero if ELEM is equal to TREE_VALUE (CHAIN) for any piece of
- chain CHAIN. */
-/* ??? This function was added for machine specific attributes but is no
- longer used. It could be deleted if we could confirm all front ends
- don't use it. */
+ chain CHAIN. This and the next function are currently unused, but
+ are retained for completeness. */
int
chain_member_value (elem, chain)
@@ -1918,9 +1927,6 @@ chain_member_value (elem, chain)
/* Return nonzero if ELEM is equal to TREE_PURPOSE (CHAIN)
for any piece of chain CHAIN. */
-/* ??? This function was added for machine specific attributes but is no
- longer used. It could be deleted if we could confirm all front ends
- don't use it. */
int
chain_member_purpose (elem, chain)
@@ -2058,6 +2064,7 @@ build_decl_list (parm, value)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
+
current_obstack = &temp_decl_obstack;
node = build_tree_list (parm, value);
current_obstack = ambient_obstack;
@@ -2072,6 +2079,7 @@ build_expr_list (parm, value)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
+
current_obstack = expression_obstack;
node = build_tree_list (parm, value);
current_obstack = ambient_obstack;
@@ -2086,9 +2094,6 @@ tree
tree_cons (purpose, value, chain)
tree purpose, value, chain;
{
-#if 0
- register tree node = make_node (TREE_LIST);
-#else
register tree node;
if (ggc_p)
@@ -2108,7 +2113,6 @@ tree_cons (purpose, value, chain)
TREE_SET_CODE (node, TREE_LIST);
if (current_obstack == &permanent_obstack)
TREE_PERMANENT (node) = 1;
-#endif
TREE_CHAIN (node) = chain;
TREE_PURPOSE (node) = purpose;
@@ -2124,6 +2128,7 @@ decl_tree_cons (purpose, value, chain)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
+
current_obstack = &temp_decl_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
@@ -2138,6 +2143,7 @@ expr_tree_cons (purpose, value, chain)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
+
current_obstack = expression_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
@@ -2152,8 +2158,8 @@ perm_tree_cons (purpose, value, chain)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &permanent_obstack;
+ current_obstack = &permanent_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
return node;
@@ -2167,8 +2173,8 @@ temp_tree_cons (purpose, value, chain)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
- current_obstack = &temporary_obstack;
+ current_obstack = &temporary_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
return node;
@@ -2182,8 +2188,8 @@ saveable_tree_cons (purpose, value, chain)
{
register tree node;
register struct obstack *ambient_obstack = current_obstack;
- current_obstack = saveable_obstack;
+ current_obstack = saveable_obstack;
node = tree_cons (purpose, value, chain);
current_obstack = ambient_obstack;
return node;
@@ -2206,11 +2212,13 @@ size_in_bytes (type)
type = TYPE_MAIN_VARIANT (type);
t = TYPE_SIZE_UNIT (type);
+
if (t == 0)
{
incomplete_type_error (NULL_TREE, type);
return integer_zero_node;
}
+
if (TREE_CODE (t) == INTEGER_CST)
force_fit_type (t, 0);
@@ -2233,6 +2241,7 @@ int_size_in_bytes (type)
t = TYPE_SIZE_UNIT (type);
if (t == 0
|| TREE_CODE (t) != INTEGER_CST
+ || TREE_OVERFLOW (t)
|| TREE_INT_CST_HIGH (t) != 0)
return -1;
@@ -2433,7 +2442,7 @@ unsave_expr_1 (expr)
switch (TREE_CODE (expr))
{
case SAVE_EXPR:
- if (!SAVE_EXPR_PERSISTENT_P (expr))
+ if (! SAVE_EXPR_PERSISTENT_P (expr))
SAVE_EXPR_RTL (expr) = 0;
break;
@@ -2444,7 +2453,7 @@ unsave_expr_1 (expr)
case RTL_EXPR:
/* I don't yet know how to emit a sequence multiple times. */
- if (RTL_EXPR_SEQUENCE (expr))
+ if (RTL_EXPR_SEQUENCE (expr) != 0)
abort ();
break;
@@ -2453,7 +2462,7 @@ unsave_expr_1 (expr)
break;
default:
- if (lang_unsave_expr_now)
+ if (lang_unsave_expr_now != 0)
(*lang_unsave_expr_now) (expr);
break;
}
@@ -2468,7 +2477,7 @@ unsave_expr_now_r (expr)
enum tree_code code;
/* There's nothing to do for NULL_TREE. */
- if (!expr)
+ if (expr == 0)
return;
unsave_expr_1 (expr);
@@ -2521,7 +2530,7 @@ tree
unsave_expr_now (expr)
tree expr;
{
- if (lang_unsave)
+ if (lang_unsave!= 0)
(*lang_unsave) (&expr);
else
unsave_expr_now_r (expr);
@@ -3304,6 +3313,7 @@ build_block (vars, tags, subblocks, supercontext, chain)
tree vars, tags, subblocks, supercontext, chain;
{
register tree block = make_node (BLOCK);
+
BLOCK_VARS (block) = vars;
BLOCK_SUBBLOCKS (block) = subblocks;
BLOCK_SUPERCONTEXT (block) = supercontext;
@@ -3323,7 +3333,7 @@ build_expr_wfl (node, file, line, col)
int line, col;
{
static const char *last_file = 0;
- static tree last_filenode = NULL_TREE;
+ static tree last_filenode = NULL_TREE;
register tree wfl = make_node (EXPR_WITH_FILE_LOCATION);
EXPR_WFL_NODE (wfl) = node;
@@ -3333,12 +3343,14 @@ build_expr_wfl (node, file, line, col)
last_file = file;
last_filenode = file ? get_identifier (file) : NULL_TREE;
}
+
EXPR_WFL_FILENAME_NODE (wfl) = last_filenode;
if (node)
{
TREE_SIDE_EFFECTS (wfl) = TREE_SIDE_EFFECTS (node);
TREE_TYPE (wfl) = TREE_TYPE (node);
}
+
return wfl;
}
@@ -3433,7 +3445,8 @@ valid_machine_attribute (attr_name, attr_args, decl, type)
#ifdef VALID_MACHINE_DECL_ATTRIBUTE
if (decl != 0
- && VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, attr_name, attr_args))
+ && VALID_MACHINE_DECL_ATTRIBUTE (decl, decl_attr_list, attr_name,
+ attr_args))
{
tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
decl_attr_list);
@@ -3482,8 +3495,10 @@ valid_machine_attribute (attr_name, attr_args, decl, type)
else
TYPE_ATTRIBUTES (type) = type_attr_list;
}
+
if (decl != 0)
TREE_TYPE (decl) = type;
+
validated = 1;
}
@@ -3606,12 +3621,12 @@ merge_attributes (a1, a2)
/* Either one unset? Take the set one. */
- if (! (attributes = a1))
+ if ((attributes = a1) == 0)
attributes = a2;
/* One that completely contains the other? Take it. */
- else if (a2 && ! attribute_list_contained (a1, a2))
+ else if (a2 != 0 && ! attribute_list_contained (a1, a2))
{
if (attribute_list_contained (a2, a1))
attributes = a2;
@@ -3623,7 +3638,7 @@ merge_attributes (a1, a2)
if (list_length (a1) < list_length (a2))
attributes = a2, a2 = a1;
- for (; a2; a2 = TREE_CHAIN (a2))
+ for (; a2 != 0; a2 = TREE_CHAIN (a2))
if (lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (a2)),
attributes) == NULL_TREE)
{
@@ -3744,8 +3759,10 @@ type_hash_list (list)
{
register int hashcode;
register tree tail;
+
for (hashcode = 0, tail = list; tail; tail = TREE_CHAIN (tail))
hashcode += TYPE_HASH (TREE_VALUE (tail));
+
return hashcode;
}
@@ -3785,6 +3802,7 @@ type_hash_lookup (hashcode, type)
&& type_list_equal (TYPE_DOMAIN (h->type),
TYPE_DOMAIN (type)))))
return h->type;
+
return 0;
}
@@ -3834,6 +3852,7 @@ type_hash_canon (hashcode, type)
{
if (!ggc_p)
obstack_free (TYPE_OBSTACK (type), type);
+
#ifdef GATHER_STATISTICS
tree_node_counts[(int)t_kind]--;
tree_node_sizes[(int)t_kind] -= sizeof (struct tree_type);
@@ -3873,6 +3892,7 @@ attribute_hash_list (list)
{
register int hashcode;
register tree tail;
+
for (hashcode = 0, tail = list; tail; tail = TREE_CHAIN (tail))
/* ??? Do we want to add in TREE_VALUE too? */
hashcode += TYPE_HASH (TREE_PURPOSE (tail));
@@ -3910,7 +3930,7 @@ attribute_list_contained (l1, l2)
/* Maybe the lists are similar. */
for (t1 = l1, t2 = l2;
- t1 && t2
+ t1 != 0 && t2 != 0
&& TREE_PURPOSE (t1) == TREE_PURPOSE (t2)
&& TREE_VALUE (t1) == TREE_VALUE (t2);
t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2));
@@ -3919,13 +3939,14 @@ attribute_list_contained (l1, l2)
if (t1 == 0 && t2 == 0)
return 1;
- for (; t2; t2 = TREE_CHAIN (t2))
+ for (; t2 != 0; t2 = TREE_CHAIN (t2))
{
tree attr
= lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
- if (attr == NULL_TREE)
+ if (attr == 0)
return 0;
+
if (simple_cst_equal (TREE_VALUE (t2), TREE_VALUE (attr)) != 1)
return 0;
}
@@ -3964,13 +3985,16 @@ tree_int_cst_equal (t1, t2)
{
if (t1 == t2)
return 1;
+
if (t1 == 0 || t2 == 0)
return 0;
+
if (TREE_CODE (t1) == INTEGER_CST
&& TREE_CODE (t2) == INTEGER_CST
&& TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
&& TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2))
return 1;
+
return 0;
}
@@ -3984,8 +4008,9 @@ tree_int_cst_lt (t1, t2)
if (t1 == t2)
return 0;
- if (!TREE_UNSIGNED (TREE_TYPE (t1)))
+ if (! TREE_UNSIGNED (TREE_TYPE (t1)))
return INT_CST_LT (t1, t2);
+
return INT_CST_LT_UNSIGNED (t1, t2);
}
@@ -4023,7 +4048,7 @@ simple_cst_list_equal (l1, l2)
l2 = TREE_CHAIN (l2);
}
- return (l1 == l2);
+ return l1 == l2;
}
/* Return truthvalue of whether T1 is the same tree structure as T2.
@@ -4038,6 +4063,7 @@ simple_cst_equal (t1, t2)
{
register enum tree_code code1, code2;
int cmp;
+ int i;
if (t1 == t2)
return 1;
@@ -4055,6 +4081,7 @@ simple_cst_equal (t1, t2)
else
return simple_cst_equal (TREE_OPERAND (t1, 0), t2);
}
+
else if (code2 == NOP_EXPR || code2 == CONVERT_EXPR
|| code2 == NON_LVALUE_EXPR)
return simple_cst_equal (t1, TREE_OPERAND (t2, 0));
@@ -4065,16 +4092,16 @@ simple_cst_equal (t1, t2)
switch (code1)
{
case INTEGER_CST:
- return TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
- && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2);
+ return (TREE_INT_CST_LOW (t1) == TREE_INT_CST_LOW (t2)
+ && TREE_INT_CST_HIGH (t1) == TREE_INT_CST_HIGH (t2));
case REAL_CST:
return REAL_VALUES_IDENTICAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
case STRING_CST:
- return TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
- && !bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
- TREE_STRING_LENGTH (t1));
+ return (TREE_STRING_LENGTH (t1) == TREE_STRING_LENGTH (t2)
+ && ! bcmp (TREE_STRING_POINTER (t1), TREE_STRING_POINTER (t2),
+ TREE_STRING_LENGTH (t1)));
case CONSTRUCTOR:
if (CONSTRUCTOR_ELTS (t1) == CONSTRUCTOR_ELTS (t2))
@@ -4089,7 +4116,8 @@ simple_cst_equal (t1, t2)
cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
if (cmp <= 0)
return cmp;
- return simple_cst_list_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
+ return
+ simple_cst_list_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
case TARGET_EXPR:
/* Special case: if either target is an unallocated VAR_DECL,
@@ -4105,19 +4133,23 @@ simple_cst_equal (t1, t2)
cmp = 1;
else
cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
+
if (cmp <= 0)
return cmp;
+
return simple_cst_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
case WITH_CLEANUP_EXPR:
cmp = simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
if (cmp <= 0)
return cmp;
+
return simple_cst_equal (TREE_OPERAND (t1, 2), TREE_OPERAND (t1, 2));
case COMPONENT_REF:
if (TREE_OPERAND (t1, 1) == TREE_OPERAND (t2, 1))
return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
+
return 0;
case VAR_DECL:
@@ -4139,7 +4171,6 @@ simple_cst_equal (t1, t2)
switch (TREE_CODE_CLASS (code1))
{
- int i;
case '1':
case '2':
case '<':
@@ -4147,12 +4178,13 @@ simple_cst_equal (t1, t2)
case 'r':
case 's':
cmp = 1;
- for (i=0; i<tree_code_length[(int) code1]; ++i)
+ for (i = 0; i < tree_code_length[(int) code1]; i++)
{
cmp = simple_cst_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
if (cmp <= 0)
return cmp;
}
+
return cmp;
default:
@@ -4175,7 +4207,7 @@ build_pointer_type (to_type)
/* First, if we already have a type for pointers to TO_TYPE, use it. */
- if (t)
+ if (t != 0)
return t;
/* We need a new one. Put this in the same obstack as TO_TYPE. */
@@ -4196,6 +4228,34 @@ build_pointer_type (to_type)
return t;
}
+/* Build the node for the type of references-to-TO_TYPE. */
+
+tree
+build_reference_type (to_type)
+ tree to_type;
+{
+ register tree t = TYPE_REFERENCE_TO (to_type);
+
+ /* First, if we already have a type for pointers to TO_TYPE, use it. */
+
+ if (t)
+ return t;
+
+ /* We need a new one. Put this in the same obstack as TO_TYPE. */
+ push_obstacks (TYPE_OBSTACK (to_type), TYPE_OBSTACK (to_type));
+ t = make_node (REFERENCE_TYPE);
+ pop_obstacks ();
+
+ TREE_TYPE (t) = to_type;
+
+ /* Record this type as the pointer to TO_TYPE. */
+ TYPE_REFERENCE_TO (to_type) = t;
+
+ layout_type (t);
+
+ return t;
+}
+
/* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE.
MAXVAL should be the maximum value in the domain
(one less than the length of the array).
@@ -4302,6 +4362,7 @@ index_type_equal (itype1, itype2)
{
if (TREE_CODE (itype1) != TREE_CODE (itype2))
return 0;
+
if (TREE_CODE (itype1) == INTEGER_TYPE)
{
if (TYPE_PRECISION (itype1) != TYPE_PRECISION (itype2)
@@ -4309,6 +4370,7 @@ index_type_equal (itype1, itype2)
|| simple_cst_equal (TYPE_SIZE (itype1), TYPE_SIZE (itype2)) != 1
|| TYPE_ALIGN (itype1) != TYPE_ALIGN (itype2))
return 0;
+
if (1 == simple_cst_equal (TYPE_MIN_VALUE (itype1),
TYPE_MIN_VALUE (itype2))
&& 1 == simple_cst_equal (TYPE_MAX_VALUE (itype1),
@@ -4407,34 +4469,6 @@ build_function_type (value_type, arg_types)
return t;
}
-/* Build the node for the type of references-to-TO_TYPE. */
-
-tree
-build_reference_type (to_type)
- tree to_type;
-{
- register tree t = TYPE_REFERENCE_TO (to_type);
-
- /* First, if we already have a type for pointers to TO_TYPE, use it. */
-
- if (t)
- return t;
-
- /* We need a new one. Put this in the same obstack as TO_TYPE. */
- push_obstacks (TYPE_OBSTACK (to_type), TYPE_OBSTACK (to_type));
- t = make_node (REFERENCE_TYPE);
- pop_obstacks ();
-
- TREE_TYPE (t) = to_type;
-
- /* Record this type as the pointer to TO_TYPE. */
- TYPE_REFERENCE_TO (to_type) = t;
-
- layout_type (t);
-
- return t;
-}
-
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments and values are described by TYPE.
If that type exists already, reuse it.
@@ -4550,9 +4584,9 @@ build_complex_type (component_type)
else if (component_type == long_long_unsigned_type_node)
name = "complex long long unsigned int";
else
- name = (char *)0;
+ name = 0;
- if (name)
+ if (name != 0)
TYPE_NAME (t) = get_identifier (name);
}
@@ -4684,8 +4718,8 @@ get_narrower (op, unsignedp_ptr)
while (TREE_CODE (op) == NOP_EXPR)
{
register int bitschange
- = TYPE_PRECISION (TREE_TYPE (op))
- - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0)));
+ = (TYPE_PRECISION (TREE_TYPE (op))
+ - TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (op, 0))));
/* Truncations are many-one so cannot be removed. */
if (bitschange < 0)
@@ -4841,11 +4875,14 @@ decl_type_context (decl)
|| TREE_CODE (context) == UNION_TYPE
|| TREE_CODE (context) == QUAL_UNION_TYPE)
return context;
+
if (TREE_CODE (context) == TYPE_DECL
|| TREE_CODE (context) == FUNCTION_DECL)
context = DECL_CONTEXT (context);
+
else if (TREE_CODE (context) == BLOCK)
context = BLOCK_SUPERCONTEXT (context);
+
else
/* Unhandled CONTEXT!? */
abort ();
@@ -4955,8 +4992,8 @@ dump_tree_statistics ()
#endif /* NO_DOT_IN_LABEL */
#endif /* NO_DOLLAR_IN_LABEL */
-extern char * first_global_object_name;
-extern char * weak_global_object_name;
+extern char *first_global_object_name;
+extern char *weak_global_object_name;
/* Appends 6 random characters to TEMPLATE to (hopefully) avoid name
clashes in cases where we can't reliably choose a unique name.
@@ -5039,10 +5076,10 @@ get_file_function_name_long (type)
buf = (char *) alloca (sizeof (FILE_FUNCTION_FORMAT) + strlen (p)
+ strlen (type));
- /* Set up the name of the file-level functions we may need. */
- /* Use a global object (which is already required to be unique over
+ /* Set up the name of the file-level functions we may need.
+ Use a global object (which is already required to be unique over
the program) rather than the file name (which imposes extra
- constraints). -- Raeburn@MIT.EDU, 10 Jan 1990. */
+ constraints). */
sprintf (buf, FILE_FUNCTION_FORMAT, type, p);
/* Don't need to pull weird characters out of global names. */
@@ -5077,12 +5114,12 @@ get_file_function_name (kind)
int kind;
{
char p[2];
+
p[0] = kind;
p[1] = 0;
return get_file_function_name_long (p);
}
-
/* Expand (the constant part of) a SET_TYPE CONSTRUCTOR node.
The result is placed in BUFFER (which has length BIT_SIZE),
@@ -5221,7 +5258,7 @@ int
get_alias_set (t)
tree t;
{
- if (!flag_strict_aliasing || !lang_get_alias_set)
+ if (! flag_strict_aliasing || lang_get_alias_set == 0)
/* If we're not doing any lanaguage-specific alias analysis, just
assume everything aliases everything else. */
return 0;
@@ -5235,6 +5272,7 @@ int
new_alias_set ()
{
static int last_alias_set;
+
if (flag_strict_aliasing)
return ++last_alias_set;
else
@@ -5321,8 +5359,8 @@ build_common_tree_nodes (signed_char)
unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
}
-/* For type TYPE, fill in the proper type for TYPE_SIZE and
- TYPE_SIZE_UNIT. */
+/* For type TYPE, fill in the proper type for TYPE_SIZE and TYPE_SIZE_UNIT. */
+
static void
fix_sizetype (type)
tree type;
@@ -5334,6 +5372,7 @@ fix_sizetype (type)
/* Call this function after calling build_common_tree_nodes and set_sizetype.
It will fix the previously made nodes to have proper references to
sizetype, and it will create several other common tree nodes. */
+
void
build_common_tree_nodes_2 (short_double)
int short_double;
@@ -5373,6 +5412,7 @@ build_common_tree_nodes_2 (short_double)
void_type_node = make_node (VOID_TYPE);
layout_type (void_type_node); /* Uses size_zero_node */
+
/* We are not going to have real types in C with less than byte alignment,
so we might as well not have any types that claim to have it. */
TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;