+++ /dev/null
-(From http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00197.html)
-
-The attached patch fixes the move costs according to the updated AMD
-documentation. It also fixes several PRS crashing on reloading MMX to
-SSE as the previous costs made this very fast and thus made SSE to
-appear in preffered class.
-I am installing the patch to mainline as obvious, OK for the 3.2 branch too?
-
-Honza
-
- * i386.c (athlon_cost): Fix the move costs.
-
-Index: i386.c
-===================================================================
-RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
-retrieving revision 1.462
-diff -c -3 -p -r1.462 i386.c
-*** gcc/gcc/config/i386/i386.c 27 Sep 2002 13:30:08 -0000 1.462
---- gcc/gcc/config/i386/i386.c 2 Oct 2002 15:00:24 -0000
-*************** struct processor_costs athlon_cost = {
-*** 285,309 ****
- 8, /* "large" insn */
- 9, /* MOVE_RATIO */
- 4, /* cost for loading QImode using movzbl */
-! {4, 5, 4}, /* cost of loading integer registers
- in QImode, HImode and SImode.
- Relative to reg-reg move (2). */
-! {2, 3, 2}, /* cost of storing integer registers */
- 4, /* cost of reg,reg fld/fst */
-! {6, 6, 20}, /* cost of loading fp registers
- in SFmode, DFmode and XFmode */
-! {4, 4, 16}, /* cost of loading integer registers */
- 2, /* cost of moving MMX register */
-! {2, 2}, /* cost of loading MMX registers
- in SImode and DImode */
-! {2, 2}, /* cost of storing MMX registers
- in SImode and DImode */
- 2, /* cost of moving SSE register */
-! {2, 2, 8}, /* cost of loading SSE registers
- in SImode, DImode and TImode */
-! {2, 2, 8}, /* cost of storing SSE registers
- in SImode, DImode and TImode */
-! 6, /* MMX or SSE register to integer */
- 64, /* size of prefetch block */
- 6, /* number of parallel prefetches */
- };
---- 285,309 ----
- 8, /* "large" insn */
- 9, /* MOVE_RATIO */
- 4, /* cost for loading QImode using movzbl */
-! {3, 4, 3}, /* cost of loading integer registers
- in QImode, HImode and SImode.
- Relative to reg-reg move (2). */
-! {3, 4, 3}, /* cost of storing integer registers */
- 4, /* cost of reg,reg fld/fst */
-! {4, 4, 12}, /* cost of loading fp registers
- in SFmode, DFmode and XFmode */
-! {6, 6, 8}, /* cost of loading integer registers */
- 2, /* cost of moving MMX register */
-! {4, 4}, /* cost of loading MMX registers
- in SImode and DImode */
-! {4, 4}, /* cost of storing MMX registers
- in SImode and DImode */
- 2, /* cost of moving SSE register */
-! {4, 4, 6}, /* cost of loading SSE registers
- in SImode, DImode and TImode */
-! {4, 4, 5}, /* cost of storing SSE registers
- in SImode, DImode and TImode */
-! 5, /* MMX or SSE register to integer */
- 64, /* size of prefetch block */
- 6, /* number of parallel prefetches */
- };
-
+++ /dev/null
-Index: loop.c
-===================================================================
-RCS file: /cvsroot/gcc/gcc/gcc/loop.c,v
-retrieving revision 1.389.2.7
-diff -c -r1.389.2.7 loop.c
-*** gcc-3.2/gcc/loop.c 15 Jun 2002 01:12:04 -0000 1.389.2.7
---- gcc-3.2/gcc/loop.c 9 Sep 2002 20:23:19 -0000
-***************
-*** 9264,9270 ****
- {
- case LE:
- if ((unsigned HOST_WIDE_INT) const_val != max_val >> 1)
-! code = LT, op1 = GEN_INT (const_val + 1);
- break;
-
- /* When cross-compiling, const_val might be sign-extended from
---- 9264,9270 ----
- {
- case LE:
- if ((unsigned HOST_WIDE_INT) const_val != max_val >> 1)
-! code = LT, op1 = gen_int_mode (const_val + 1, GET_MODE (op0));
- break;
-
- /* When cross-compiling, const_val might be sign-extended from
-***************
-*** 9273,9289 ****
- if ((HOST_WIDE_INT) (const_val & max_val)
- != (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
-! code = GT, op1 = GEN_INT (const_val - 1);
- break;
-
- case LEU:
- if (uconst_val < max_val)
-! code = LTU, op1 = GEN_INT (uconst_val + 1);
- break;
-
- case GEU:
- if (uconst_val != 0)
-! code = GTU, op1 = GEN_INT (uconst_val - 1);
- break;
-
- default:
---- 9273,9289 ----
- if ((HOST_WIDE_INT) (const_val & max_val)
- != (((HOST_WIDE_INT) 1
- << (GET_MODE_BITSIZE (GET_MODE (op0)) - 1))))
-! code = GT, op1 = gen_int_mode (const_val - 1, GET_MODE (op0));
- break;
-
- case LEU:
- if (uconst_val < max_val)
-! code = LTU, op1 = gen_int_mode (uconst_val + 1, GET_MODE (op0));
- break;
-
- case GEU:
- if (uconst_val != 0)
-! code = GTU, op1 = gen_int_mode (uconst_val - 1, GET_MODE (op0));
- break;
-
- default:
+++ /dev/null
- * config/i386/i386.c (ix86_register_move_cost): Increase cost
- for secondary_memory_needed pairs.
-
-Index: i386.c
-===================================================================
-RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
-retrieving revision 1.463
-diff -c -p -d -r1.463 i386.c
-*** gcc/gcc/config/i386/i386.c 2 Oct 2002 15:02:50 -0000 1.463
---- gcc/gcc/config/i386/i386.c 2 Oct 2002 18:22:47 -0000
-*************** ix86_register_move_cost (mode, class1, c
-*** 13580,13596 ****
- enum reg_class class1, class2;
- {
- /* In case we require secondary memory, compute cost of the store followed
-! by load. In case of copying from general_purpose_register we may emit
-! multiple stores followed by single load causing memory size mismatch
-! stall. Count this as arbitarily high cost of 20. */
- if (ix86_secondary_memory_needed (class1, class2, mode, 0))
- {
-! int add_cost = 0;
- if (CLASS_MAX_NREGS (class1, mode) > CLASS_MAX_NREGS (class2, mode))
-! add_cost = 20;
-! return (MEMORY_MOVE_COST (mode, class1, 0)
-! + MEMORY_MOVE_COST (mode, class2, 1) + add_cost);
- }
- /* Moves between SSE/MMX and integer unit are expensive. */
- if (MMX_CLASS_P (class1) != MMX_CLASS_P (class2)
- || SSE_CLASS_P (class1) != SSE_CLASS_P (class2))
---- 13580,13612 ----
- enum reg_class class1, class2;
- {
- /* In case we require secondary memory, compute cost of the store followed
-! by load. In order to avoid bad register allocation choices, we need
-! for this to be *at least* as high as the symmetric MEMORY_MOVE_COST. */
-!
- if (ix86_secondary_memory_needed (class1, class2, mode, 0))
- {
-! int cost = 1;
-!
-! cost += MAX (MEMORY_MOVE_COST (mode, class1, 0),
-! MEMORY_MOVE_COST (mode, class1, 1));
-! cost += MAX (MEMORY_MOVE_COST (mode, class2, 0),
-! MEMORY_MOVE_COST (mode, class2, 1));
-!
-! /* In case of copying from general_purpose_register we may emit multiple
-! stores followed by single load causing memory size mismatch stall.
-! Count this as arbitarily high cost of 20. */
- if (CLASS_MAX_NREGS (class1, mode) > CLASS_MAX_NREGS (class2, mode))
-! cost += 20;
-!
-! /* In the case of FP/MMX moves, the registers actually overlap, and we
-! have to switch modes in order to treat them differently. */
-! if ((MMX_CLASS_P (class1) && MAYBE_FLOAT_CLASS_P (class2))
-! || (MMX_CLASS_P (class2) && MAYBE_FLOAT_CLASS_P (class1)))
-! cost += 20;
-!
-! return cost;
- }
-+
- /* Moves between SSE/MMX and integer unit are expensive. */
- if (MMX_CLASS_P (class1) != MMX_CLASS_P (class2)
- || SSE_CLASS_P (class1) != SSE_CLASS_P (class2))
-
-
+++ /dev/null
-(From http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00186.html)
-
-Thu Oct 3 21:33:52 CEST 2002 Jan Hubicka <jh@suse.cz>
- * i386.h (CPP_SPECS): fix defines for -msse, -msse2, -mpentium2,3.
-
-
-Index: i386.h
-===================================================================
-RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.h,v
-retrieving revision 1.243.2.8
-diff -c -3 -p -r1.243.2.8 i386.h
-*** gcc/gcc/config/i386/i386.h 15 Jul 2002 06:54:36 -0000 1.243.2.8
---- gcc/gcc/config/i386/i386.h 3 Oct 2002 18:57:49 -0000
-*************** extern int ix86_arch;
-*** 584,592 ****
- %{march=pentium-mmx:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
- -D__pentium__mmx__ \
- %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ -D__tune_pentium_mmx__}}\
-! %{march=pentiumpro|march=i686:-D__i686 -D__i686__ \
- -D__pentiumpro -D__pentiumpro__ \
- %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
- %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
- %{march=k6-2:-D__k6 -D__k6__ -D__k6_2__ \
- %{!mcpu*:-D__tune_k6__ -D__tune_k6_2__ }}\
---- 584,596 ----
- %{march=pentium-mmx:-D__i586 -D__i586__ -D__pentium -D__pentium__ \
- -D__pentium__mmx__ \
- %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ -D__tune_pentium_mmx__}}\
-! %{march=pentiumpro|march=i686|march=pentium2|march=pentium3:-D__i686 -D__i686__ \
- -D__pentiumpro -D__pentiumpro__ \
- %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}\
-+ %{march=march=pentium2|march=pentium3: -D__pentium2 -D__pentium2__\
-+ %{!mcpu*:-D__tune_pentium2__ }}\
-+ %{march=pentium3: -D__pentium3 -D__pentium3__\
-+ %{!mcpu*:-D__tune_pentium3__ }}\
- %{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}\
- %{march=k6-2:-D__k6 -D__k6__ -D__k6_2__ \
- %{!mcpu*:-D__tune_k6__ -D__tune_k6_2__ }}\
-*************** extern int ix86_arch;
-*** 601,607 ****
- %{m386|mcpu=i386:-D__tune_i386__ }\
- %{m486|mcpu=i486:-D__tune_i486__ }\
- %{mpentium|mcpu=pentium|mcpu=i586|mcpu=pentium-mmx:-D__tune_i586__ -D__tune_pentium__ }\
-! %{mpentiumpro|mcpu=pentiumpro|mcpu=i686|cpu=pentium2|cpu=pentium3:-D__tune_i686__ \
- -D__tune_pentiumpro__ }\
- %{mcpu=k6|mcpu=k6-2|mcpu=k6-3:-D__tune_k6__ }\
- %{mcpu=athlon|mcpu=athlon-tbird|mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
---- 605,611 ----
- %{m386|mcpu=i386:-D__tune_i386__ }\
- %{m486|mcpu=i486:-D__tune_i486__ }\
- %{mpentium|mcpu=pentium|mcpu=i586|mcpu=pentium-mmx:-D__tune_i586__ -D__tune_pentium__ }\
-! %{mpentiumpro|mcpu=pentiumpro|mcpu=i686|mcpu=pentium2|mcpu=pentium3:-D__tune_i686__ \
- -D__tune_pentiumpro__ }\
- %{mcpu=k6|mcpu=k6-2|mcpu=k6-3:-D__tune_k6__ }\
- %{mcpu=athlon|mcpu=athlon-tbird|mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
-*************** extern int ix86_arch;
-*** 609,625 ****
- %{mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
- -D__tune_athlon_sse__ }\
- %{mcpu=pentium4:-D__tune_pentium4__ }\
-! %{march=athlon-xp|march=athlon-mp|march=pentium3|march=pentium4:\
- -D__SSE__ }\
- %{march=pentium-mmx|march=k6|march=k6-2|march=k6-3\
- |march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
-! |march=athlon-mp|march=pentium2|march=pentium3|march=pentium4: -D__MMX__ }\
- %{march=k6-2|march=k6-3\
- |march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
-! |march=athlon-mp: -D__3dNOW__ }\
- %{march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
- |march=athlon-mp: -D__3dNOW_A__ }\
-! %{march=pentium4: -D__SSE2__ }\
- %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
-
- #ifndef CPP_CPU_SPEC
---- 613,629 ----
- %{mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
- -D__tune_athlon_sse__ }\
- %{mcpu=pentium4:-D__tune_pentium4__ }\
-! %{march=athlon-xp|march=athlon-mp|march=pentium3|march=pentium4|msse|msse2:\
- -D__SSE__ }\
- %{march=pentium-mmx|march=k6|march=k6-2|march=k6-3\
- |march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
-! |march=athlon-mp|march=pentium2|march=pentium3|march=pentium4|mmx|msse|m3dnow: -D__MMX__ }\
- %{march=k6-2|march=k6-3\
- |march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
-! |march=athlon-mp|m3dnow: -D__3dNOW__ }\
- %{march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp\
- |march=athlon-mp: -D__3dNOW_A__ }\
-! %{march=pentium4|msse2: -D__SSE2__ }\
- %{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}"
-
- #ifndef CPP_CPU_SPEC
-
-
+++ /dev/null
-2002-08-22 Jason Merrill <jason@redhat.com>
-
- * langhooks-def.h (LANG_HOOKS_EXPR_SIZE): New macro.
- * langhooks.c (lhd_expr_size): Define default.
- * langhooks.h (struct lang_hooks): Add expr_size.
- * explow.c (expr_size): Call it.
- (int_expr_size): New fn.
- * expr.h: Declare it.
- * expr.c (expand_expr) [CONSTRUCTOR]: Use it to calculate how
- much to store.
-cp/
- PR c++/5607
- * search.c (check_final_overrider): No longer static.
- * class.c (update_vtable_entry_for_fn): Call it.
- * cp-tree.h: Adjust.
-
- * cp-lang.c (LANG_HOOKS_EXPR_SIZE): Define.
- (cp_expr_size): New fn.
- * call.c (convert_arg_to_ellipsis): Promote non-POD warning to error.
- * typeck.c (build_modify_expr): Don't use save_expr on an lvalue.
-
---- gcc/cp/call.c.jj 2002-04-15 14:48:51.000000000 +0200
-+++ gcc/cp/call.c 2002-08-23 13:51:08.000000000 +0200
-@@ -4022,9 +4022,12 @@ convert_arg_to_ellipsis (arg)
-
- if (arg != error_mark_node && ! pod_type_p (TREE_TYPE (arg)))
- {
-- /* Undefined behaviour [expr.call] 5.2.2/7. */
-- warning ("cannot pass objects of non-POD type `%#T' through `...'",
-- TREE_TYPE (arg));
-+ /* Undefined behaviour [expr.call] 5.2.2/7. We used to just warn
-+ here and do a bitwise copy, but now cp_expr_size will abort if we
-+ try to do that. */
-+ error ("cannot pass objects of non-POD type `%#T' through `...'",
-+ TREE_TYPE (arg));
-+ arg = error_mark_node;
- }
-
- return arg;
---- gcc/cp/class.c.jj 2002-08-05 18:30:31.000000000 +0200
-+++ gcc/cp/class.c 2002-08-23 13:51:08.000000000 +0200
-@@ -2454,6 +2454,10 @@ update_vtable_entry_for_fn (t, binfo, fn
- if (overrider == error_mark_node)
- return;
-
-+ /* Check for unsupported covariant returns again now that we've
-+ calculated the base offsets. */
-+ check_final_overrider (TREE_PURPOSE (overrider), fn);
-+
- /* Assume that we will produce a thunk that convert all the way to
- the final overrider, and not to an intermediate virtual base. */
- virtual_base = NULL_TREE;
---- gcc/cp/cp-lang.c.jj 2002-05-25 00:02:21.000000000 +0200
-+++ gcc/cp/cp-lang.c 2002-08-23 13:51:08.000000000 +0200
-@@ -28,7 +28,8 @@ Boston, MA 02111-1307, USA. */
- #include "langhooks.h"
- #include "langhooks-def.h"
-
--static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree));
-+static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree));
-+static tree cp_expr_size PARAMS ((tree));
-
- #undef LANG_HOOKS_NAME
- #define LANG_HOOKS_NAME "GNU C++"
-@@ -91,6 +92,8 @@ static HOST_WIDE_INT cxx_get_alias_set P
- #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree
- #undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN
- #define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals
-+#undef LANG_HOOKS_EXPR_SIZE
-+#define LANG_HOOKS_EXPR_SIZE cp_expr_size
-
- /* Each front end provides its own hooks, for toplev.c. */
- const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-@@ -108,3 +111,28 @@ cxx_get_alias_set (t)
-
- return c_common_get_alias_set (t);
- }
-+
-+/* Langhook for expr_size: Tell the backend that the value of an expression
-+ of non-POD class type does not include any tail padding; a derived class
-+ might have allocated something there. */
-+
-+static tree
-+cp_expr_size (exp)
-+ tree exp;
-+{
-+ if (CLASS_TYPE_P (TREE_TYPE (exp)))
-+ {
-+ /* The backend should not be interested in the size of an expression
-+ of a type with both of these set; all copies of such types must go
-+ through a constructor or assignment op. */
-+ if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
-+ && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp)))
-+ abort ();
-+ /* This would be wrong for a type with virtual bases, but they are
-+ caught by the abort above. */
-+ return CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp));
-+ }
-+ else
-+ /* Use the default code. */
-+ return lhd_expr_size (exp);
-+}
---- gcc/cp/cp-tree.h.jj 2002-07-27 01:31:05.000000000 +0200
-+++ gcc/cp/cp-tree.h 2002-08-23 13:51:08.000000000 +0200
-@@ -4084,6 +4084,7 @@ extern tree lookup_conversions PARAMS
- extern tree binfo_for_vtable PARAMS ((tree));
- extern tree binfo_from_vbase PARAMS ((tree));
- extern tree look_for_overrides_here PARAMS ((tree, tree));
-+extern int check_final_overrider PARAMS ((tree, tree));
- extern tree dfs_walk PARAMS ((tree,
- tree (*) (tree, void *),
- tree (*) (tree, void *),
---- gcc/cp/search.c.jj 2002-04-23 20:29:00.000000000 +0200
-+++ gcc/cp/search.c 2002-08-23 13:51:08.000000000 +0200
-@@ -100,7 +100,6 @@ static tree dfs_push_decls PARAMS ((tree
- static tree dfs_unuse_fields PARAMS ((tree, void *));
- static tree add_conversions PARAMS ((tree, void *));
- static int covariant_return_p PARAMS ((tree, tree));
--static int check_final_overrider PARAMS ((tree, tree));
- static int look_for_overrides_r PARAMS ((tree, tree));
- static struct search_level *push_search_level
- PARAMS ((struct stack_level *, struct obstack *));
-@@ -1800,7 +1799,7 @@ covariant_return_p (brettype, drettype)
- /* Check that virtual overrider OVERRIDER is acceptable for base function
- BASEFN. Issue diagnostic, and return zero, if unacceptable. */
-
--static int
-+int
- check_final_overrider (overrider, basefn)
- tree overrider, basefn;
- {
---- gcc/cp/typeck.c.jj 2002-07-10 11:37:43.000000000 +0200
-+++ gcc/cp/typeck.c 2002-08-23 13:51:08.000000000 +0200
-@@ -5450,7 +5450,10 @@ build_modify_expr (lhs, modifycode, rhs)
- so the code to compute it is only emitted once. */
- tree cond;
-
-- rhs = save_expr (rhs);
-+ if (lvalue_p (rhs))
-+ rhs = stabilize_reference (rhs);
-+ else
-+ rhs = save_expr (rhs);
-
- /* Check this here to avoid odd errors when trying to convert
- a throw to the type of the COND_EXPR. */
---- gcc/expr.c.jj 2002-05-07 12:45:49.000000000 +0200
-+++ gcc/expr.c 2002-08-23 13:51:09.000000000 +0200
-@@ -6661,8 +6661,7 @@ expand_expr (exp, target, tmode, modifie
- * TYPE_QUAL_CONST))),
- 0, TREE_ADDRESSABLE (exp), 1);
-
-- store_constructor (exp, target, 0,
-- int_size_in_bytes (TREE_TYPE (exp)));
-+ store_constructor (exp, target, 0, int_expr_size (exp));
- return target;
- }
-
---- gcc/explow.c.jj 2002-02-22 11:32:03.000000000 +0100
-+++ gcc/explow.c 2002-08-23 13:51:08.000000000 +0200
-@@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - S
- #include "insn-config.h"
- #include "ggc.h"
- #include "recog.h"
-+#include "langhooks.h"
-
- static rtx break_out_memory_refs PARAMS ((rtx));
- static void emit_stack_probe PARAMS ((rtx));
-@@ -285,20 +286,33 @@ rtx
- expr_size (exp)
- tree exp;
- {
-- tree size;
--
-- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
-- && DECL_SIZE_UNIT (exp) != 0)
-- size = DECL_SIZE_UNIT (exp);
-- else
-- size = size_in_bytes (TREE_TYPE (exp));
-+ tree size = (*lang_hooks.expr_size) (exp);
-
- if (TREE_CODE (size) != INTEGER_CST
- && contains_placeholder_p (size))
- size = build (WITH_RECORD_EXPR, sizetype, size, exp);
-
- return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
-+}
-+
-+/* Return a wide integer for the size in bytes of the value of EXP, or -1
-+ if the size can vary or is larger than an integer. */
-+
-+HOST_WIDE_INT
-+int_expr_size (exp)
-+ tree exp;
-+{
-+ tree t = (*lang_hooks.expr_size) (exp);
-+
-+ if (t == 0
-+ || TREE_CODE (t) != INTEGER_CST
-+ || TREE_OVERFLOW (t)
-+ || TREE_INT_CST_HIGH (t) != 0
-+ /* If the result would appear negative, it's too big to represent. */
-+ || (HOST_WIDE_INT) TREE_INT_CST_LOW (t) < 0)
-+ return -1;
-
-+ return TREE_INT_CST_LOW (t);
- }
- \f
- /* Return a copy of X in which all memory references
---- gcc/expr.h.jj 2002-04-02 23:17:24.000000000 +0200
-+++ gcc/expr.h 2002-08-23 13:51:09.000000000 +0200
-@@ -548,6 +548,10 @@ extern unsigned int case_values_threshol
- /* Return an rtx for the size in bytes of the value of an expr. */
- extern rtx expr_size PARAMS ((tree));
-
-+/* Return a wide integer for the size in bytes of the value of EXP, or -1
-+ if the size can vary or is larger than an integer. */
-+extern HOST_WIDE_INT int_expr_size PARAMS ((tree));
-+
- extern rtx lookup_static_chain PARAMS ((tree));
-
- /* Convert a stack slot address ADDR valid in function FNDECL
---- gcc/langhooks-def.h.jj 2002-05-24 23:55:54.000000000 +0200
-+++ gcc/langhooks-def.h 2002-08-23 13:51:09.000000000 +0200
-@@ -48,6 +48,7 @@ extern int lhd_staticp PARAMS ((tree));
- extern void lhd_clear_binding_stack PARAMS ((void));
- extern void lhd_print_tree_nothing PARAMS ((FILE *, tree, int));
- extern void lhd_set_yydebug PARAMS ((int));
-+extern tree lhd_expr_size PARAMS ((tree));
-
- /* Declarations of default tree inlining hooks. */
- tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *,
-@@ -85,6 +86,7 @@ tree lhd_tree_inlining_convert_parm_for_
- #define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing
- #define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing
- #define LANG_HOOKS_SET_YYDEBUG lhd_set_yydebug
-+#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
-
- /* Tree inlining hooks. */
- #define LANG_HOOKS_TREE_INLINING_WALK_SUBTREES lhd_tree_inlining_walk_subtrees
-@@ -156,6 +158,7 @@ int lhd_tree_dump_type_quals PARAMS ((
- LANG_HOOKS_PRINT_TYPE, \
- LANG_HOOKS_PRINT_IDENTIFIER, \
- LANG_HOOKS_SET_YYDEBUG, \
-+ LANG_HOOKS_EXPR_SIZE, \
- LANG_HOOKS_TREE_INLINING_INITIALIZER, \
- LANG_HOOKS_TREE_DUMP_INITIALIZER \
- }
---- gcc/langhooks.c.jj 2002-03-23 12:02:51.000000000 +0100
-+++ gcc/langhooks.c 2002-08-23 13:51:09.000000000 +0200
-@@ -303,3 +303,16 @@ lhd_tree_dump_type_quals (t)
- return TYPE_QUALS (t);
- }
-
-+/* lang_hooks.expr_size: Determine the size of the value of an expression T
-+ in a language-specific way. Returns a tree for the size in bytes. */
-+
-+tree
-+lhd_expr_size (exp)
-+ tree exp;
-+{
-+ if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
-+ && DECL_SIZE_UNIT (exp) != 0)
-+ return DECL_SIZE_UNIT (exp);
-+ else
-+ return size_in_bytes (TREE_TYPE (exp));
-+}
---- gcc/langhooks.h.jj 2002-05-24 23:55:54.000000000 +0200
-+++ gcc/langhooks.h 2002-08-23 13:51:09.000000000 +0200
-@@ -156,6 +156,12 @@ struct lang_hooks
- warning that the front end does not use such a parser. */
- void (*set_yydebug) PARAMS ((int));
-
-+ /* Called from expr_size to calculate the size of the value of an
-+ expression in a language-dependent way. Returns a tree for the size
-+ in bytes. A frontend can call lhd_expr_size to get the default
-+ semantics in cases that it doesn't want to handle specially. */
-+ tree (*expr_size) PARAMS ((tree));
-+
- struct lang_hooks_for_tree_inlining tree_inlining;
-
- struct lang_hooks_for_tree_dump tree_dump;
+++ /dev/null
-2002-08-06 Jason Merrill <jason@redhat.com>
-
- * c-common.c (c_expand_expr) [STMT_EXPR]: If the last expression is
- a VAR_DECL with RTL that matches the target, just return that RTL.
-
-2002-06-01 Daniel Berlin <dberlin@dberlin.org>
-
- * tree-inline.c (expand_call_inline): Make the statement
- expression we generate have a COMPOUND_STMT.
-
---- gcc/c-common.c.jj 2002-08-28 11:20:26.000000000 +0200
-+++ gcc/c-common.c 2002-08-28 22:49:59.000000000 +0200
-@@ -3564,6 +3564,7 @@ c_expand_expr (exp, target, tmode, modif
- tree rtl_expr;
- rtx result;
- bool preserve_result = false;
-+ bool return_target = false;
-
- /* Since expand_expr_stmt calls free_temp_slots after every
- expression statement, we must call push_temp_slots here.
-@@ -3591,8 +3592,20 @@ c_expand_expr (exp, target, tmode, modif
- if (TREE_CODE (last) == SCOPE_STMT
- && TREE_CODE (expr) == EXPR_STMT)
- {
-- TREE_ADDRESSABLE (expr) = 1;
-- preserve_result = true;
-+ if (target && TREE_CODE (EXPR_STMT_EXPR (expr)) == VAR_DECL
-+ && DECL_RTL_IF_SET (EXPR_STMT_EXPR (expr)) == target)
-+ /* If the last expression is a variable whose RTL is the
-+ same as our target, just return the target; if it
-+ isn't valid expanding the decl would produce different
-+ RTL, and store_expr would try to do a copy. */
-+ return_target = true;
-+ else
-+ {
-+ /* Otherwise, note that we want the value from the last
-+ expression. */
-+ TREE_ADDRESSABLE (expr) = 1;
-+ preserve_result = true;
-+ }
- }
- }
-
-@@ -3600,7 +3613,9 @@ c_expand_expr (exp, target, tmode, modif
- expand_end_stmt_expr (rtl_expr);
-
- result = expand_expr (rtl_expr, target, tmode, modifier);
-- if (preserve_result && GET_CODE (result) == MEM)
-+ if (return_target)
-+ result = target;
-+ else if (preserve_result && GET_CODE (result) == MEM)
- {
- if (GET_MODE (result) != BLKmode)
- result = copy_to_reg (result);
---- gcc/tree-inline.c.jj 2002-08-28 11:20:27.000000000 +0200
-+++ gcc/tree-inline.c 2002-08-28 22:49:59.000000000 +0200
-@@ -773,6 +773,7 @@ expand_call_inline (tp, walk_subtrees, d
- inline_data *id;
- tree t;
- tree expr;
-+ tree stmt;
- tree chain;
- tree fn;
- tree scope_stmt;
-@@ -864,10 +865,10 @@ expand_call_inline (tp, walk_subtrees, d
- for the return statements within the function to jump to. The
- type of the statement expression is the return type of the
- function call. */
-- expr = build1 (STMT_EXPR, TREE_TYPE (TREE_TYPE (fn)), NULL_TREE);
-+ expr = build1 (STMT_EXPR, TREE_TYPE (TREE_TYPE (fn)), make_node (COMPOUND_STMT));
- /* There is no scope associated with the statement-expression. */
- STMT_EXPR_NO_SCOPE (expr) = 1;
--
-+ stmt = STMT_EXPR_STMT (expr);
- /* Local declarations will be replaced by their equivalents in this
- map. */
- st = id->decl_map;
-@@ -890,7 +891,7 @@ expand_call_inline (tp, walk_subtrees, d
- parameters. */
- expand_calls_inline (&arg_inits, id);
- /* And add them to the tree. */
-- STMT_EXPR_STMT (expr) = chainon (STMT_EXPR_STMT (expr), arg_inits);
-+ COMPOUND_BODY (stmt) = chainon (COMPOUND_BODY (stmt), arg_inits);
-
- /* Record the function we are about to inline so that we can avoid
- recursing into it. */
-@@ -925,8 +926,8 @@ expand_call_inline (tp, walk_subtrees, d
- SCOPE_BEGIN_P (scope_stmt) = 1;
- SCOPE_NO_CLEANUPS_P (scope_stmt) = 1;
- remap_block (scope_stmt, DECL_ARGUMENTS (fn), id);
-- TREE_CHAIN (scope_stmt) = STMT_EXPR_STMT (expr);
-- STMT_EXPR_STMT (expr) = scope_stmt;
-+ TREE_CHAIN (scope_stmt) = COMPOUND_BODY (stmt);
-+ COMPOUND_BODY (stmt) = scope_stmt;
-
- /* Tell the debugging backends that this block represents the
- outermost scope of the inlined function. */
-@@ -934,34 +935,34 @@ expand_call_inline (tp, walk_subtrees, d
- BLOCK_ABSTRACT_ORIGIN (SCOPE_STMT_BLOCK (scope_stmt)) = DECL_ORIGIN (fn);
-
- /* Declare the return variable for the function. */
-- STMT_EXPR_STMT (expr)
-- = chainon (STMT_EXPR_STMT (expr),
-+ COMPOUND_BODY (stmt)
-+ = chainon (COMPOUND_BODY (stmt),
- declare_return_variable (id, &use_stmt));
-
- /* After we've initialized the parameters, we insert the body of the
- function itself. */
-- inlined_body = &STMT_EXPR_STMT (expr);
-+ inlined_body = &COMPOUND_BODY (stmt);
- while (*inlined_body)
- inlined_body = &TREE_CHAIN (*inlined_body);
- *inlined_body = copy_body (id);
-
-- /* Close the block for the parameters. */
-- scope_stmt = build_stmt (SCOPE_STMT, DECL_INITIAL (fn));
-- SCOPE_NO_CLEANUPS_P (scope_stmt) = 1;
-- remap_block (scope_stmt, NULL_TREE, id);
-- STMT_EXPR_STMT (expr)
-- = chainon (STMT_EXPR_STMT (expr), scope_stmt);
--
- /* After the body of the function comes the RET_LABEL. This must come
- before we evaluate the returned value below, because that evalulation
- may cause RTL to be generated. */
-- STMT_EXPR_STMT (expr)
-- = chainon (STMT_EXPR_STMT (expr),
-+ COMPOUND_BODY (stmt)
-+ = chainon (COMPOUND_BODY (stmt),
- build_stmt (LABEL_STMT, id->ret_label));
-
- /* Finally, mention the returned value so that the value of the
- statement-expression is the returned value of the function. */
-- STMT_EXPR_STMT (expr) = chainon (STMT_EXPR_STMT (expr), use_stmt);
-+ COMPOUND_BODY (stmt) = chainon (COMPOUND_BODY (stmt), use_stmt);
-+
-+ /* Close the block for the parameters. */
-+ scope_stmt = build_stmt (SCOPE_STMT, DECL_INITIAL (fn));
-+ SCOPE_NO_CLEANUPS_P (scope_stmt) = 1;
-+ remap_block (scope_stmt, NULL_TREE, id);
-+ COMPOUND_BODY (stmt)
-+ = chainon (COMPOUND_BODY (stmt), scope_stmt);
-
- /* Clean up. */
- splay_tree_delete (id->decl_map);
+++ /dev/null
-2002-05-15 Jakub Jelinek <jakub@redhat.com>
-
- * fold-const.c (fold): Fix a typo.
-
---- gcc/fold-const.c.jj Wed May 15 14:02:54 2002
-+++ gcc/fold-const.c Wed May 15 14:06:09 2002
-@@ -6530,7 +6530,7 @@ fold (expr)
-
- else if (TREE_INT_CST_HIGH (arg1) == -1
- && (TREE_INT_CST_LOW (arg1)
-- == ((unsigned HOST_WIDE_INT) 1 << (width - 1)))
-+ == ((unsigned HOST_WIDE_INT) -1 << (width - 1)))
- && ! TREE_UNSIGNED (TREE_TYPE (arg1)))
- switch (TREE_CODE (t))
- {
+++ /dev/null
-2002-07-11 Jakub Jelinek <jakub@redhat.com>
-
- PR c/7242
- * config/i386/i386.h (CPP_CPUCOMMON_SPEC): Fix typo.
-
---- gcc/config/i386/i386.h.jj Wed Jul 10 16:56:41 2002
-+++ gcc/config/i386/i386.h Thu Jul 11 09:59:06 2002
-@@ -601,7 +601,7 @@ extern int ix86_arch;
- %{m386|mcpu=i386:-D__tune_i386__ }\
- %{m486|mcpu=i486:-D__tune_i486__ }\
- %{mpentium|mcpu=pentium|mcpu=i586|mcpu=pentium-mmx:-D__tune_i586__ -D__tune_pentium__ }\
--%{mpentiumpro|mcpu=pentiumpro|mcpu=i686|cpu=pentium2|cpu=pentium3:-D__tune_i686__ \
-+%{mpentiumpro|mcpu=pentiumpro|mcpu=i686|mcpu=pentium2|mcpu=pentium3:-D__tune_i686__ \
- -D__tune_pentiumpro__ }\
- %{mcpu=k6|mcpu=k6-2|mcpu=k6-3:-D__tune_k6__ }\
- %{mcpu=athlon|mcpu=athlon-tbird|mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:\
+++ /dev/null
-Wed Jul 10 19:12:41 CEST 2002 Janis Johnson <janis187@us.ibm.com>
-
- * loop.c (emit_prefetch_instructions): Small fix.
-
---- gcc/loop.c.jj Fri Jun 14 21:12:04 2002
-+++ gcc/loop.c Wed Aug 14 12:13:43 2002
-@@ -4090,11 +4090,17 @@ emit_prefetch_instructions (loop)
- {
- rtx reg = gen_reg_rtx (Pmode);
- rtx loop_start = loop->start;
-+ rtx init_val = info[i].class->initial_value;
- rtx add_val = simplify_gen_binary (PLUS, Pmode,
- info[i].giv->add_val,
- GEN_INT (y * PREFETCH_BLOCK));
-
-- loop_iv_add_mult_emit_before (loop, info[i].class->initial_value,
-+ /* Functions called by LOOP_IV_ADD_EMIT_BEFORE expect a
-+ non-constant INIT_VAL to have the same mode as REG, which
-+ in this case we know to be Pmode. */
-+ if (GET_MODE (init_val) != Pmode && !CONSTANT_P (init_val))
-+ init_val = convert_to_mode (Pmode, init_val, 0);
-+ loop_iv_add_mult_emit_before (loop, init_val,
- info[i].giv->mult_val,
- add_val, reg, 0, loop_start);
- emit_insn_before (gen_prefetch (reg, GEN_INT (info[i].write),
+++ /dev/null
-2002-07-29 Jakub Jelinek <jakub@redhat.com>
-
- * gcc.dg/20020729-1.c: New test.
-
-2002-05-17 Richard Sandiford <rsandifo@redhat.com>
-
- * expr.c (force_operand): Fix reversed move.
-
-Sat May 4 13:20:54 CEST 2002 Jan Hubicka <jh@suse.cz>
-
- * expr.c (force_operand): Use expand_simple_* to handle more
- cases.
-
---- gcc/expr.c.jj 2002-05-07 12:45:49.000000000 +0200
-+++ gcc/expr.c 2002-08-03 01:08:28.000000000 +0200
-@@ -5434,16 +5434,13 @@ rtx
- force_operand (value, target)
- rtx value, target;
- {
-- optab binoptab = 0;
-- /* Use a temporary to force order of execution of calls to
-- `force_operand'. */
-- rtx tmp;
-- rtx op2;
-+ rtx op1, op2;
- /* Use subtarget as the target for operand 0 of a binary operation. */
- rtx subtarget = get_subtarget (target);
-+ enum rtx_code code = GET_CODE (value);
-
- /* Check for a PIC address load. */
-- if ((GET_CODE (value) == PLUS || GET_CODE (value) == MINUS)
-+ if ((code == PLUS || code == MINUS)
- && XEXP (value, 0) == pic_offset_table_rtx
- && (GET_CODE (XEXP (value, 1)) == SYMBOL_REF
- || GET_CODE (XEXP (value, 1)) == LABEL_REF
-@@ -5455,60 +5452,88 @@ force_operand (value, target)
- return subtarget;
- }
-
-- if (GET_CODE (value) == PLUS)
-- binoptab = add_optab;
-- else if (GET_CODE (value) == MINUS)
-- binoptab = sub_optab;
-- else if (GET_CODE (value) == MULT)
-+ if (code == ZERO_EXTEND || code == SIGN_EXTEND)
- {
-- op2 = XEXP (value, 1);
-- if (!CONSTANT_P (op2)
-- && !(GET_CODE (op2) == REG && op2 != subtarget))
-- subtarget = 0;
-- tmp = force_operand (XEXP (value, 0), subtarget);
-- return expand_mult (GET_MODE (value), tmp,
-- force_operand (op2, NULL_RTX),
-- target, 1);
-+ if (!target)
-+ target = gen_reg_rtx (GET_MODE (value));
-+ convert_move (target, force_operand (XEXP (value, 0), NULL),
-+ code == ZERO_EXTEND);
-+ return target;
- }
-
-- if (binoptab)
-+ if (GET_RTX_CLASS (code) == '2' || GET_RTX_CLASS (code) == 'c')
- {
- op2 = XEXP (value, 1);
-- if (!CONSTANT_P (op2)
-- && !(GET_CODE (op2) == REG && op2 != subtarget))
-+ if (!CONSTANT_P (op2) && !(GET_CODE (op2) == REG && op2 != subtarget))
- subtarget = 0;
-- if (binoptab == sub_optab && GET_CODE (op2) == CONST_INT)
-+ if (code == MINUS && GET_CODE (op2) == CONST_INT)
- {
-- binoptab = add_optab;
-+ code = PLUS;
- op2 = negate_rtx (GET_MODE (value), op2);
- }
-
- /* Check for an addition with OP2 a constant integer and our first
-- operand a PLUS of a virtual register and something else. In that
-- case, we want to emit the sum of the virtual register and the
-- constant first and then add the other value. This allows virtual
-- register instantiation to simply modify the constant rather than
-- creating another one around this addition. */
-- if (binoptab == add_optab && GET_CODE (op2) == CONST_INT
-+ operand a PLUS of a virtual register and something else. In that
-+ case, we want to emit the sum of the virtual register and the
-+ constant first and then add the other value. This allows virtual
-+ register instantiation to simply modify the constant rather than
-+ creating another one around this addition. */
-+ if (code == PLUS && GET_CODE (op2) == CONST_INT
- && GET_CODE (XEXP (value, 0)) == PLUS
- && GET_CODE (XEXP (XEXP (value, 0), 0)) == REG
- && REGNO (XEXP (XEXP (value, 0), 0)) >= FIRST_VIRTUAL_REGISTER
- && REGNO (XEXP (XEXP (value, 0), 0)) <= LAST_VIRTUAL_REGISTER)
- {
-- rtx temp = expand_binop (GET_MODE (value), binoptab,
-- XEXP (XEXP (value, 0), 0), op2,
-- subtarget, 0, OPTAB_LIB_WIDEN);
-- return expand_binop (GET_MODE (value), binoptab, temp,
-- force_operand (XEXP (XEXP (value, 0), 1), 0),
-- target, 0, OPTAB_LIB_WIDEN);
-+ rtx temp = expand_simple_binop (GET_MODE (value), code,
-+ XEXP (XEXP (value, 0), 0), op2,
-+ subtarget, 0, OPTAB_LIB_WIDEN);
-+ return expand_simple_binop (GET_MODE (value), code, temp,
-+ force_operand (XEXP (XEXP (value,
-+ 0), 1), 0),
-+ target, 0, OPTAB_LIB_WIDEN);
-+ }
-+
-+ op1 = force_operand (XEXP (value, 0), subtarget);
-+ op2 = force_operand (op2, NULL_RTX);
-+ switch (code)
-+ {
-+ case MULT:
-+ return expand_mult (GET_MODE (value), op1, op2, target, 1);
-+ case DIV:
-+ if (!INTEGRAL_MODE_P (GET_MODE (value)))
-+ return expand_simple_binop (GET_MODE (value), code, op1, op2,
-+ target, 1, OPTAB_LIB_WIDEN);
-+ else
-+ return expand_divmod (0,
-+ FLOAT_MODE_P (GET_MODE (value))
-+ ? RDIV_EXPR : TRUNC_DIV_EXPR,
-+ GET_MODE (value), op1, op2, target, 0);
-+ break;
-+ case MOD:
-+ return expand_divmod (1, TRUNC_MOD_EXPR, GET_MODE (value), op1, op2,
-+ target, 0);
-+ break;
-+ case UDIV:
-+ return expand_divmod (0, TRUNC_DIV_EXPR, GET_MODE (value), op1, op2,
-+ target, 1);
-+ break;
-+ case UMOD:
-+ return expand_divmod (1, TRUNC_MOD_EXPR, GET_MODE (value), op1, op2,
-+ target, 1);
-+ break;
-+ case ASHIFTRT:
-+ return expand_simple_binop (GET_MODE (value), code, op1, op2,
-+ target, 0, OPTAB_LIB_WIDEN);
-+ break;
-+ default:
-+ return expand_simple_binop (GET_MODE (value), code, op1, op2,
-+ target, 1, OPTAB_LIB_WIDEN);
- }
--
-- tmp = force_operand (XEXP (value, 0), subtarget);
-- return expand_binop (GET_MODE (value), binoptab, tmp,
-- force_operand (op2, NULL_RTX),
-- target, 0, OPTAB_LIB_WIDEN);
-- /* We give UNSIGNEDP = 0 to expand_binop
-- because the only operations we are expanding here are signed ones. */
-+ }
-+ if (GET_RTX_CLASS (code) == '1')
-+ {
-+ op1 = force_operand (XEXP (value, 0), NULL_RTX);
-+ return expand_simple_unop (GET_MODE (value), code, op1, target, 0);
- }
-
- #ifdef INSN_SCHEDULING
---- gcc/testsuite/gcc.dg/20020729-1.c.jj 2002-08-03 01:08:28.000000000 +0200
-+++ gcc/testsuite/gcc.dg/20020729-1.c 2002-08-03 01:08:28.000000000 +0200
-@@ -0,0 +1,51 @@
-+/* { dg-do compile { target i?86-*-* } } */
-+/* { dg-options "-O2 -march=k6" } */
-+
-+static inline void *
-+baz (void *s, unsigned long c, unsigned int count)
-+{
-+ int d0, d1;
-+ __asm__ __volatile__ (""
-+ : "=&c" (d0), "=&D" (d1)
-+ :"a" (c), "q" (count), "0" (count / 4), "1" ((long) s)
-+ :"memory");
-+ return s;
-+}
-+
-+struct A
-+{
-+ unsigned long *a;
-+};
-+
-+inline static void *
-+bar (struct A *x, int y)
-+{
-+ char *ptr;
-+
-+ ptr = (void *) x->a[y >> 12];
-+ ptr += y % (1UL << 12);
-+ return (void *) ptr;
-+}
-+
-+int
-+foo (struct A *x, unsigned int *y, int z, int u)
-+{
-+ int a, b, c, d, e;
-+
-+ z += *y;
-+ c = z + u;
-+ a = (z >> 12) + 1;
-+ do
-+ {
-+ b = (a << 12);
-+ d = b - z;
-+ e = c - z;
-+ if (e < d)
-+ d = e;
-+ baz (bar (x, z), 0, d);
-+ z = b;
-+ a++;
-+ }
-+ while (z < c);
-+ return 0;
-+}
+++ /dev/null
-2002-08-12 Alexandre Oliva <aoliva@redhat.com>
-
- * c-tree.h (skip_evaluation): Move declaration...
- * c-common.h: ... here.
- * c-typeck.c (build_external_ref): Don't assemble_external nor
- mark a tree as used if skip_evaluation is set.
- * c-parse.in (typeof): New non-terminal to set skip_evaluation
- around TYPEOF.
- (typespec_nonreserved_nonattr): Use it.
-
---- gcc/cp/parse.y.jj 2002-05-02 12:14:49.000000000 +0200
-+++ gcc/cp/parse.y 2002-08-22 23:28:34.000000000 +0200
-@@ -1255,16 +1255,20 @@ unary_expr:
- /* Refer to the address of a label as a pointer. */
- | ANDAND identifier
- { $$ = finish_label_address_expr ($2); }
-- | SIZEOF unary_expr %prec UNARY
-- { $$ = finish_sizeof ($2); }
-- | SIZEOF '(' type_id ')' %prec HYPERUNARY
-+ | sizeof unary_expr %prec UNARY
-+ { $$ = finish_sizeof ($2);
-+ skip_evaluation--; }
-+ | sizeof '(' type_id ')' %prec HYPERUNARY
- { $$ = finish_sizeof (groktypename ($3.t));
-- check_for_new_type ("sizeof", $3); }
-- | ALIGNOF unary_expr %prec UNARY
-- { $$ = finish_alignof ($2); }
-- | ALIGNOF '(' type_id ')' %prec HYPERUNARY
-- { $$ = finish_alignof (groktypename ($3.t));
-- check_for_new_type ("alignof", $3); }
-+ check_for_new_type ("sizeof", $3);
-+ skip_evaluation--; }
-+ | alignof unary_expr %prec UNARY
-+ { $$ = finish_alignof ($2);
-+ skip_evaluation--; }
-+ | alignof '(' type_id ')' %prec HYPERUNARY
-+ { $$ = finish_alignof (groktypename ($3.t));
-+ check_for_new_type ("alignof", $3);
-+ skip_evaluation--; }
-
- /* The %prec EMPTY's here are required by the = init initializer
- syntax extension; see below. */
-@@ -1989,6 +1993,18 @@ reserved_typespecquals:
- { $$ = tree_cons ($1, NULL_TREE, NULL_TREE); }
- ;
-
-+sizeof:
-+ SIZEOF { skip_evaluation++; }
-+ ;
-+
-+alignof:
-+ ALIGNOF { skip_evaluation++; }
-+ ;
-+
-+typeof:
-+ TYPEOF { skip_evaluation++; }
-+ ;
-+
- /* A typespec (but not a type qualifier).
- Once we have seen one of these in a declaration,
- if a typedef name appears then it is being redeclared. */
-@@ -2000,12 +2016,14 @@ typespec:
- { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
- | complete_type_name
- { $$.t = $1; $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
-- | TYPEOF '(' expr ')'
-+ | typeof '(' expr ')'
- { $$.t = finish_typeof ($3);
-- $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
-- | TYPEOF '(' type_id ')'
-+ $$.new_type_flag = 0; $$.lookups = NULL_TREE;
-+ skip_evaluation--; }
-+ | typeof '(' type_id ')'
- { $$.t = groktypename ($3.t);
-- $$.new_type_flag = 0; $$.lookups = NULL_TREE; }
-+ $$.new_type_flag = 0; $$.lookups = NULL_TREE;
-+ skip_evaluation--; }
- | SIGOF '(' expr ')'
- { tree type = TREE_TYPE ($3);
-
---- gcc/cp/decl2.c.jj 2002-07-27 01:31:05.000000000 +0200
-+++ gcc/cp/decl2.c 2002-08-22 23:24:11.000000000 +0200
-@@ -5179,7 +5179,8 @@ mark_used (decl)
- TREE_USED (decl) = 1;
- if (processing_template_decl)
- return;
-- assemble_external (decl);
-+ if (!skip_evaluation)
-+ assemble_external (decl);
-
- /* Is it a synthesized method that needs to be synthesized? */
- if (TREE_CODE (decl) == FUNCTION_DECL
---- gcc/c-tree.h.jj 2002-04-02 23:17:23.000000000 +0200
-+++ gcc/c-tree.h 2002-08-22 23:24:34.000000000 +0200
-@@ -287,11 +287,6 @@ extern int current_function_returns_null
-
- extern int current_function_returns_abnormally;
-
--/* Nonzero means the expression being parsed will never be evaluated.
-- This is a count, since unevaluated expressions can nest. */
--
--extern int skip_evaluation;
--
- /* Nonzero means `$' can be in an identifier. */
-
- extern int dollars_in_ident;
---- gcc/c-common.h.jj 2002-04-17 15:34:36.000000000 +0200
-+++ gcc/c-common.h 2002-08-22 23:24:11.000000000 +0200
-@@ -464,6 +464,11 @@ extern int warn_conversion;
-
- extern int warn_long_long;
-
-+/* Nonzero means the expression being parsed will never be evaluated.
-+ This is a count, since unevaluated expressions can nest. */
-+
-+extern int skip_evaluation;
-+
- /* C types are partitioned into three subsets: object, function, and
- incomplete types. */
- #define C_TYPE_OBJECT_P(type) \
---- gcc/c-typeck.c.jj 2002-03-23 12:02:51.000000000 +0100
-+++ gcc/c-typeck.c 2002-08-22 23:24:11.000000000 +0200
-@@ -1493,7 +1493,8 @@ build_external_ref (id, fun)
- if (TREE_TYPE (ref) == error_mark_node)
- return error_mark_node;
-
-- assemble_external (ref);
-+ if (!skip_evaluation)
-+ assemble_external (ref);
- TREE_USED (ref) = 1;
-
- if (TREE_CODE (ref) == CONST_DECL)
---- gcc/c-parse.in.jj 2002-04-17 15:34:46.000000000 +0200
-+++ gcc/c-parse.in 2002-08-22 23:24:11.000000000 +0200
-@@ -534,6 +534,10 @@ alignof:
- ALIGNOF { skip_evaluation++; }
- ;
-
-+typeof:
-+ TYPEOF { skip_evaluation++; }
-+ ;
-+
- cast_expr:
- unary_expr
- | '(' typename ')' cast_expr %prec UNARY
-@@ -1376,10 +1380,10 @@ ifobjc
- | non_empty_protocolrefs
- { $$ = get_object_reference ($1); }
- end ifobjc
-- | TYPEOF '(' expr ')'
-- { $$ = TREE_TYPE ($3); }
-- | TYPEOF '(' typename ')'
-- { $$ = groktypename ($3); }
-+ | typeof '(' expr ')'
-+ { skip_evaluation--; $$ = TREE_TYPE ($3); }
-+ | typeof '(' typename ')'
-+ { skip_evaluation--; $$ = groktypename ($3); }
- ;
-
- /* typespec_nonreserved_attr does not exist. */