diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1997-12-18 14:52:24 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-12-18 09:52:24 -0500 |
commit | 0253134551ad49baaba9fb7ab4b6cfe3374316ba (patch) | |
tree | c726c6b091f665d017918111954fb31f428d7a35 /gcc/cp/expr.c | |
parent | 63d96a955940981de3a4bdf2645080068d10faa1 (diff) | |
download | gcc-0253134551ad49baaba9fb7ab4b6cfe3374316ba.zip gcc-0253134551ad49baaba9fb7ab4b6cfe3374316ba.tar.gz gcc-0253134551ad49baaba9fb7ab4b6cfe3374316ba.tar.bz2 |
except.c: Remove register_exception_table{,_p}.
* except.c: Remove register_exception_table{,_p}.
* decl2.c (finish_file): Remove call to register_exception_table.
* cp-tree.def: Add AGGR_INIT_EXPR.
* error.c, tree.c, typeck.c: Replace uses of NEW_EXPR with
AGGR_INIT_EXPR where appropriate.
* expr.c (cplus_expand_expr): Likewise. Simplify.
From-SVN: r17132
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r-- | gcc/cp/expr.c | 110 |
1 files changed, 25 insertions, 85 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 2162b0d..a2c1669 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -59,7 +59,7 @@ cplus_expand_expr (exp, target, tmode, modifier) switch (code) { - case NEW_EXPR: + case AGGR_INIT_EXPR: { /* Something needs to be initialized, but we didn't know where that thing was when building the tree. For example, @@ -76,8 +76,6 @@ cplus_expand_expr (exp, target, tmode, modifier) tree func = TREE_OPERAND (exp, 0); tree args = TREE_OPERAND (exp, 1); tree type = TREE_TYPE (exp), slot; - tree fn_type = TREE_TYPE (TREE_TYPE (func)); - tree return_type = TREE_TYPE (fn_type); tree call_exp; rtx call_target, return_target; int pcc_struct_return = 0; @@ -86,14 +84,8 @@ cplus_expand_expr (exp, target, tmode, modifier) `target' represents. SLOT holds the slot for TARGET. */ slot = TREE_OPERAND (exp, 2); - if (target == 0) - { - /* Should always be called with a target in BLKmode case. */ - my_friendly_assert (mode != BLKmode, 205); - my_friendly_assert (DECL_RTL (slot) != 0, 206); - - target = gen_reg_rtx (mode); - } + /* Should always be called with a target. */ + my_friendly_assert (target != NULL_RTX, 205); /* The target the initializer will initialize (CALL_TARGET) must now be directed to initialize the target we are @@ -118,11 +110,6 @@ cplus_expand_expr (exp, target, tmode, modifier) TREE_VALUE (args) = build1 (ADDR_EXPR, type, slot); call_target = 0; } - else if (TREE_CODE (return_type) == REFERENCE_TYPE) - { - type = return_type; - call_target = 0; - } else { #ifdef PCC_STATIC_STRUCT_RETURN @@ -132,89 +119,42 @@ cplus_expand_expr (exp, target, tmode, modifier) call_target = target; #endif } - if (call_target) - { - /* Make this a valid memory address now. The code below assumes - that it can compare rtx and make assumptions based on the - result. The assumptions are true only if the address was - valid to begin with. */ - call_target = validize_mem (call_target); - - /* If this is a reference to a symbol, expand_inline_function - will do this transformation and return a different target - than the one we gave it, though functionally equivalent. Do - the transformation here to avoid confusion. */ - if (! cse_not_expected && GET_CODE (call_target) == MEM - && GET_CODE (XEXP (call_target, 0)) == SYMBOL_REF) - { - call_target = gen_rtx - (MEM, mode, memory_address (mode, XEXP (call_target, 0))); - MEM_IN_STRUCT_P (call_target) = 1; - } - } call_exp = build (CALL_EXPR, type, func, args, NULL_TREE); TREE_SIDE_EFFECTS (call_exp) = 1; return_target = expand_call (call_exp, call_target, ignore); - if (call_target == 0) - { - if (pcc_struct_return) - { - extern int flag_access_control; - int old_ac = flag_access_control; - - tree init = build_decl (VAR_DECL, 0, type); - TREE_ADDRESSABLE (init) = 1; - DECL_RTL (init) = return_target; - - flag_access_control = 0; - expand_aggr_init (slot, init, 0, LOOKUP_ONLYCONVERTING); - flag_access_control = old_ac; - - if (TYPE_NEEDS_DESTRUCTOR (type)) - { - init = build_decl (VAR_DECL, 0, - build_reference_type (type)); - DECL_RTL (init) = XEXP (return_target, 0); - - init = maybe_build_cleanup (convert_from_reference (init)); - if (init != NULL_TREE) - expand_expr (init, const0_rtx, VOIDmode, 0); - } - call_target = return_target = DECL_RTL (slot); - } - else - call_target = return_target; - } - if (call_target != return_target) + if (call_target) { - my_friendly_assert (TYPE_HAS_TRIVIAL_INIT_REF (type), 317); - if (GET_MODE (return_target) == BLKmode) - emit_block_move (call_target, return_target, expr_size (exp), - TYPE_ALIGN (type) / BITS_PER_UNIT); - else - emit_move_insn (call_target, return_target); + my_friendly_assert (rtx_equal_p (call_target, return_target) + || TYPE_HAS_TRIVIAL_INIT_REF (type), 317); + return return_target; } - if (TREE_CODE (return_type) == REFERENCE_TYPE) + /* If we're suffering under the ancient PCC_STATIC_STRUCT_RETURN + calling convention, we need to copy the return value out of + the static return buffer into slot. */ + if (pcc_struct_return) { - tree init; - - if (GET_CODE (call_target) == REG - && REGNO (call_target) < FIRST_PSEUDO_REGISTER) - my_friendly_abort (39); + extern int flag_access_control; + int old_ac = flag_access_control; - type = TREE_TYPE (exp); + tree init = build_decl (VAR_DECL, NULL_TREE, + build_reference_type (type)); + DECL_RTL (init) = XEXP (return_target, 0); - init = build (RTL_EXPR, return_type, 0, call_target); - /* We got back a reference to the type we want. Now initialize - target with that. */ + flag_access_control = 0; expand_aggr_init (slot, init, 0, LOOKUP_ONLYCONVERTING); + flag_access_control = old_ac; + + if (TYPE_NEEDS_DESTRUCTOR (type)) + { + init = maybe_build_cleanup (convert_from_reference (init)); + if (init != NULL_TREE) + expand_expr (init, const0_rtx, VOIDmode, 0); + } } - if (DECL_RTL (slot) != target) - emit_move_insn (DECL_RTL (slot), target); return DECL_RTL (slot); } |