diff options
-rw-r--r-- | gcc/ChangeLog | 24 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 16 | ||||
-rw-r--r-- | gcc/gimplify.c | 48 |
4 files changed, 67 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0eb71f..8c1b4a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-07-14 Jason Merrill <jason@redhat.com> + + PR middle-end/15885 + * gimplify.c (gimplify_arg): New fn, split out from... + (gimplify_call_expr): Here. Special-case BUILT_IN_VA_START. + 2004-07-15 Roman Zippel <zippel@linux-m68k.org> * config/m68k/m68k.c (output_move_qimode): Abort on an attempt to @@ -12,14 +18,14 @@ 2004-07-15 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.md ("bunordered"): Disable for e500. - ("bordered"): Same. + * config/rs6000/rs6000.md ("bunordered"): Disable for e500. + ("bordered"): Same. 2004-07-15 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.md ("*cceq_ior_compare"): Allow - unconditionally. - * config/rs6000/spe.md ("e500_cceq_ior_compare"): Remove. + * config/rs6000/rs6000.md ("*cceq_ior_compare"): Allow + unconditionally. + * config/rs6000/spe.md ("e500_cceq_ior_compare"): Remove. 2004-07-15 Richard Sandiford <rsandifo@redhat.com> @@ -59,7 +65,7 @@ * print-tree.c (print_node): Fix casts last change. -2004-07-15 Paul Brook <paul@codesourcery.com> +2004-07-15 Paul Brook <paul@codesourcery.com> * dwarf2out.c (dwarf2out_begin_prologue): Rename IA64_UNWIND_INFO to TARGET_UNWIND_INFO. @@ -95,7 +101,7 @@ Use alias set 0 for memory, do proper mode calculations and adjust address for memories. -2004-07-14 Per Bothner <per@bothner.com> +2004-07-14 Per Bothner <per@bothner.com> * input.h: If USE_MAPPED_LOCATION, define separate expanded_location structure with extra column field. @@ -124,10 +130,10 @@ * config/sh/sh.c (sh_gimplify_va_arg_expr): Likewise. * config/xtensa/xtensa.c (xtensa_gimplify_va_arg_expr): Likewise. -2004-07-14 Mike Stump <mrs@apple.com> +2004-07-14 Mike Stump <mrs@apple.com> * config/darwin.h (WINT_TYPE): Define to be int to match - system header files. + system header files. 2004-07-14 Bob Wilson <bob.wilson@acm.org> diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c93ce69..830fc4b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-07-15 Jason Merrill <jason@redhat.com> + + * cp-lang.c (cxx_types_compatible_p): To the middle-end, + references and pointers are compatible. + 2004-07-15 Nathan Sidwell <nathan@codesourcery.com> * decl.c (xref_basetypes): Refactor. @@ -16,7 +21,7 @@ 2004-07-15 Nathan Sidwell <nathan@codesourcery.com> - * class.c(finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. + * class.c (finish_struct_bits): Don't set TYPE_HAS_CONVERSION here. * decl.c (xref_basetypes): Set it here. * class.c (check_bases): Don't set CLASSTYPE_NON_AGGREGATE here. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 5f38fbb..b6e933f 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -317,9 +317,23 @@ cp_var_mod_type_p (tree type, tree fn) return false; } +/* This compares two types for equivalence ("compatible" in C-based languages). + This routine should only return 1 if it is sure. It should not be used + in contexts where erroneously returning 0 causes problems. */ + static int cxx_types_compatible_p (tree x, tree y) { - return same_type_ignoring_top_level_qualifiers_p (x, y); + if (same_type_ignoring_top_level_qualifiers_p (x, y)) + return 1; + + /* Once we get to the middle-end, references and pointers are + interchangeable. FIXME should we try to replace all references with + pointers? */ + if (POINTER_TYPE_P (x) && POINTER_TYPE_P (y) + && same_type_p (TREE_TYPE (x), TREE_TYPE (y))) + return 1; + + return 0; } /* Construct a C++-aware pretty-printer for CONTEXT. It is assumed diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d1b9618..642cff9 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1788,6 +1788,31 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p, } } +/* Subroutine of gimplify_call_expr: Gimplify a single argument. */ + +static enum gimplify_status +gimplify_arg (tree *expr_p, tree *pre_p) +{ + bool (*test) (tree); + fallback_t fb; + + /* In general, we allow lvalues for function arguments to avoid + extra overhead of copying large aggregates out of even larger + aggregates into temporaries only to copy the temporaries to + the argument list. Make optimizers happy by pulling out to + temporaries those types that fit in registers. */ + if (is_gimple_reg_type (TREE_TYPE (*expr_p))) + test = is_gimple_val, fb = fb_rvalue; + else + test = is_gimple_lvalue, fb = fb_either; + + /* There is a sequence point before a function call. Side effects in + the argument list must occur before the actual call. So, when + gimplifying arguments, force gimplify_expr to use an internal + post queue which is then appended to the end of PRE_P. */ + return gimplify_expr (expr_p, pre_p, NULL, test, fb); +} + /* Gimplify the CALL_EXPR node pointed by EXPR_P. PRE_P points to the list where side effects that must happen before *EXPR_P should be stored. WANT_VALUE is true if the result of the call is desired. */ @@ -1847,6 +1872,11 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) *expr_p = new; return GS_OK; } + + if (DECL_FUNCTION_CODE (decl) == BUILT_IN_VA_START) + /* Avoid gimplifying the second argument to va_start, which needs + to be the plain PARM_DECL. */ + return gimplify_arg (&TREE_VALUE (TREE_OPERAND (*expr_p, 1)), pre_p); } /* There is a sequence point before the call, so any side effects in @@ -1861,24 +1891,8 @@ gimplify_call_expr (tree *expr_p, tree *pre_p, bool want_value) arglist = TREE_CHAIN (arglist)) { enum gimplify_status t; - bool (*test) (tree); - fallback_t fb; - - /* In general, we allow lvalues for function arguments to avoid - extra overhead of copying large aggregates out of even larger - aggregates into temporaries only to copy the temporaries to - the argument list. Make optimizers happy by pulling out to - temporaries those types that fit in registers. */ - if (is_gimple_reg_type (TREE_TYPE (TREE_VALUE (arglist)))) - test = is_gimple_val, fb = fb_rvalue; - else - test = is_gimple_lvalue, fb = fb_either; - /* There is a sequence point before a function call. Side effects in - the argument list must occur before the actual call. So, when - gimplifying arguments, force gimplify_expr to use an internal - post queue which is then appended to the end of PRE_P. */ - t = gimplify_expr (&TREE_VALUE (arglist), pre_p, NULL, test, fb); + t = gimplify_arg (&TREE_VALUE (arglist), pre_p); if (t == GS_ERROR) ret = GS_ERROR; |