From d25cee4d2b1a7c4f387a47c4163d8f7c241f2a1c Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 16 Jul 2004 14:13:08 -0700 Subject: tree-def (WITH_SIZE_EXPR): New. * tree-def (WITH_SIZE_EXPR): New. * explow.c (expr_size, int_expr_size): Handle WITH_SIZE_EXPR. * expr.c (expand_expr_real_1): Likewise. * gimplify.c (maybe_with_size_expr): New. (gimplify_arg, gimplify_modify_expr): Use it. (gimplify_modify_expr_to_memcpy): Take size parameter. (gimplify_modify_expr_to_memset): Likewise. (gimplify_expr): Handle WITH_SIZE_EXPR. * tree-alias-common.c (find_func_aliases): Likewise. * tree-eh.c (tree_could_trap_p): Likewise. (tree_could_throw_p): Likewise. * tree-gimple.c (is_gimple_lvalue): Likewise. (get_call_expr_in): Likewise. * tree-inline.c (estimate_num_insns_1): Likewise. (expand_calls_inline): Likewise. * tree-nested.c (convert_call_expr): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-sra.c (sra_walk_expr): Likewise. * tree-ssa-alias.c (add_pointed_to_expr): Likewise. * tree-ssa-ccp.c (get_rhs, set_rhs): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-tailcall.c (find_tail_calls): Likewise. * calls.c (expand_call): Reset old_stack_allocated after calling emit_stack_restore. * gcc.c-torture/compile/20020210-1.c: Remove XFAIL. From-SVN: r84833 --- gcc/explow.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'gcc/explow.c') diff --git a/gcc/explow.c b/gcc/explow.c index 54a8635..3fb0f94 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -240,7 +240,12 @@ eliminate_constant_term (rtx x, rtx *constptr) rtx expr_size (tree exp) { - tree size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (lang_hooks.expr_size (exp), exp); + tree size; + + if (TREE_CODE (exp) == WITH_SIZE_EXPR) + size = TREE_OPERAND (exp, 1); + else + size = SUBSTITUTE_PLACEHOLDER_IN_EXPR (lang_hooks.expr_size (exp), exp); return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0); } @@ -251,17 +256,17 @@ expr_size (tree exp) HOST_WIDE_INT int_expr_size (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) + tree size; + + if (TREE_CODE (exp) == WITH_SIZE_EXPR) + size = TREE_OPERAND (exp, 1); + else + size = lang_hooks.expr_size (exp); + + if (size == 0 || !host_integerp (size, 0)) return -1; - return TREE_INT_CST_LOW (t); + return tree_low_cst (size, 0); } /* Return a copy of X in which all memory references -- cgit v1.1