Commit 0c685f12 by Nathan Sidwell Committed by Nathan Sidwell

tree.c (save_expr): Allow either side of a dyadic operand to be constant.

	* tree.c (save_expr): Allow either side of a dyadic operand to be
	constant.

	* doc/portability.texi (portability): Update portability goals.

From-SVN: r60435
parent 1df7e439
2002-12-22 Nathan Sidwell <nathan@codesourcery.com>
* tree.c (save_expr): Allow either side of a dyadic operand to be
constant.
* doc/portability.texi (portability): Update portability goals.
2002-12-23 Kazu Hirata <kazu@cs.umass.edu> 2002-12-23 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (output_a_shift): Remove unused code. * config/h8300/h8300.c (output_a_shift): Remove unused code.
......
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
@c 1999, 2000, 2001 Free Software Foundation, Inc. @c 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
@c This is part of the GCC manual. @c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi. @c For copying conditions, see the file gcc.texi.
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
@cindex portability @cindex portability
@cindex GCC and portability @cindex GCC and portability
The main goal of GCC was to make a good, fast compiler for machines in GCC itself aims to be portable to any machine where @code{int} is at least
the class that the GNU system aims to run on: 32-bit machines that address a 32-bit type. It aims to target machines with a flat (non-segmented) byte
8-bit bytes and have several general registers. Elegance, theoretical addressed data address space (the code address space can be separate).
power and simplicity are only secondary. Target ABIs may have 8, 16, 32 or 64-bit @code{int} type. @code{char}
can be wider than 8 bits.
GCC gets most of the information about the target machine from a machine GCC gets most of the information about the target machine from a machine
description which gives an algebraic formula for each of the machine's description which gives an algebraic formula for each of the machine's
......
...@@ -1363,12 +1363,23 @@ save_expr (expr) ...@@ -1363,12 +1363,23 @@ save_expr (expr)
a constant, it will be more efficient to not make another SAVE_EXPR since a constant, it will be more efficient to not make another SAVE_EXPR since
it will allow better simplification and GCSE will be able to merge the it will allow better simplification and GCSE will be able to merge the
computations if they actualy occur. */ computations if they actualy occur. */
for (inner = t; inner = t;
(TREE_CODE_CLASS (TREE_CODE (inner)) == '1' while (1)
|| (TREE_CODE_CLASS (TREE_CODE (inner)) == '2' {
&& TREE_CONSTANT (TREE_OPERAND (inner, 1)))); if (TREE_CODE_CLASS (TREE_CODE (inner)) == '1')
inner = TREE_OPERAND (inner, 0)) inner = TREE_OPERAND (inner, 0);
; else if (TREE_CODE_CLASS (TREE_CODE (inner)) == '2')
{
if (TREE_CONSTANT (TREE_OPERAND (inner, 1)))
inner = TREE_OPERAND (inner, 0);
else if (TREE_CONSTANT (TREE_OPERAND (inner, 0)))
inner = TREE_OPERAND (inner, 1);
else
break;
}
else
break;
}
/* If the tree evaluates to a constant, then we don't want to hide that /* If the tree evaluates to a constant, then we don't want to hide that
fact (i.e. this allows further folding, and direct checks for constants). fact (i.e. this allows further folding, and direct checks for constants).
...@@ -1377,7 +1388,8 @@ save_expr (expr) ...@@ -1377,7 +1388,8 @@ save_expr (expr)
literal node. */ literal node. */
if (TREE_CONSTANT (inner) if (TREE_CONSTANT (inner)
|| (TREE_READONLY (inner) && ! TREE_SIDE_EFFECTS (inner)) || (TREE_READONLY (inner) && ! TREE_SIDE_EFFECTS (inner))
|| TREE_CODE (inner) == SAVE_EXPR || TREE_CODE (inner) == ERROR_MARK) || TREE_CODE (inner) == SAVE_EXPR
|| TREE_CODE (inner) == ERROR_MARK)
return t; return t;
/* If T contains a PLACEHOLDER_EXPR, we must evaluate it each time, since /* If T contains a PLACEHOLDER_EXPR, we must evaluate it each time, since
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment