Commit 02531345 by Jason Merrill Committed by Jason Merrill

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
parent 63d96a95
Thu Dec 18 14:51:12 1997 Jason Merrill <jason@yorick.cygnus.com>
* except.c: Remove register_exception_table{,_p}.
Thu Dec 18 14:57:29 1997 Gavin Koch <gavin@cygnus.com>
* dwarf2out.c (dwarf2out_frame_debug): Handle adjustments of the
......
Thu Dec 18 14:43:19 1997 Jason Merrill <jason@yorick.cygnus.com>
* 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.
* decl2.c (finish_file): Remove call to register_exception_table.
Wed Dec 17 17:08:52 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
* pt.c (instantiate_class_template): Don't do injection when
......
......@@ -29,6 +29,12 @@ Boston, MA 02111-1307, USA. */
just won't work for us. */
DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
/* For NEW_EXPR, operand 0 is the placement list.
Operand 1 is the new-declarator.
Operand 2 is the initializer. */
DEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3)
DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3)
/* For DELETE_EXPR, operand 0 is the store to be destroyed.
Operand 1 is the value to pass to the destroying function
saying whether the store should be deallocated as well. */
......@@ -50,11 +56,10 @@ DEFTREECODE (MEMBER_REF, "member_ref", 'r', 2)
operator converts to. Operand is expression to be converted. */
DEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1)
/* For NEW_EXPR, operand 0 is function which performs initialization,
/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization,
operand 1 is argument list to initialization function,
and operand 2 is the slot which was allocated for this expression. */
DEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3)
DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3)
DEFTREECODE (AGGR_INIT_EXPR, "nw_expr", 'e', 3)
/* A throw expression. operand 0 is the expression, if there was one,
else it is NULL_TREE. */
......
......@@ -2971,7 +2971,7 @@ finish_file ()
rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
vars = static_aggregates;
if (static_ctors || vars || register_exception_table_p ())
if (static_ctors || vars)
needs_messing_up = 1;
if (static_dtors)
needs_cleaning = 1;
......@@ -3070,9 +3070,6 @@ finish_file ()
push_momentary ();
expand_start_bindings (0);
if (register_exception_table_p ())
register_exception_table ();
while (vars)
{
tree decl = TREE_VALUE (vars);
......
......@@ -1205,7 +1205,7 @@ dump_expr (t, nop)
}
break;
case NEW_EXPR:
case AGGR_INIT_EXPR:
OB_PUTID (TYPE_IDENTIFIER (TREE_TYPE (t)));
OB_PUTC ('(');
if (TREE_OPERAND (t, 1))
......
......@@ -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);
}
......
......@@ -244,13 +244,13 @@ build_cplus_new (type, init)
tree slot;
tree rval;
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != NEW_EXPR)
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
return init;
slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;
layout_decl (slot, 0);
rval = build (NEW_EXPR, type,
rval = build (AGGR_INIT_EXPR, type,
TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), slot);
TREE_SIDE_EFFECTS (rval) = 1;
rval = build (TARGET_EXPR, type, slot, rval, NULL_TREE, NULL_TREE);
......@@ -1498,7 +1498,7 @@ mapcar (t, func)
case COND_EXPR:
case TARGET_EXPR:
case NEW_EXPR:
case AGGR_INIT_EXPR:
t = copy_node (t);
TREE_OPERAND (t, 0) = mapcar (TREE_OPERAND (t, 0), func);
TREE_OPERAND (t, 1) = mapcar (TREE_OPERAND (t, 1), func);
......@@ -1761,7 +1761,7 @@ bot_manip (t)
return t;
else if (TREE_CODE (t) == TARGET_EXPR)
{
if (TREE_CODE (TREE_OPERAND (t, 1)) == NEW_EXPR)
if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR)
{
mark_used (TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (t, 1), 0), 0));
return build_cplus_new
......
......@@ -7310,10 +7310,10 @@ c_expand_return (retval)
return;
}
/* We can't initialize a register from a NEW_EXPR. */
/* We can't initialize a register from a AGGR_INIT_EXPR. */
else if (! current_function_returns_struct
&& TREE_CODE (retval) == TARGET_EXPR
&& TREE_CODE (TREE_OPERAND (retval, 1)) == NEW_EXPR)
&& TREE_CODE (TREE_OPERAND (retval, 1)) == AGGR_INIT_EXPR)
retval = build (COMPOUND_EXPR, TREE_TYPE (retval), retval,
TREE_OPERAND (retval, 0));
......@@ -7337,7 +7337,7 @@ c_expand_return (retval)
if (TREE_CODE (whats_returned) == ADDR_EXPR)
{
whats_returned = TREE_OPERAND (whats_returned, 0);
while (TREE_CODE (whats_returned) == NEW_EXPR
while (TREE_CODE (whats_returned) == AGGR_INIT_EXPR
|| TREE_CODE (whats_returned) == TARGET_EXPR)
{
/* Get the target. */
......
......@@ -1559,18 +1559,6 @@ exception_table_p ()
return 0;
}
/* 1 if we need a static constructor to register EH table info. */
int
register_exception_table_p ()
{
#if defined (DWARF2_UNWIND_INFO)
return 0;
#endif
return exception_table_p ();
}
/* Output the entry of the exception table corresponding to to the
exception region numbered N to file FILE.
......@@ -1628,18 +1616,6 @@ output_exception_table ()
assemble_integer (constm1_rtx, POINTER_SIZE / BITS_PER_UNIT, 1);
putc ('\n', asm_out_file); /* blank line */
}
/* Generate code to initialize the exception table at program startup
time. */
void
register_exception_table ()
{
emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__register_exceptions"), 0,
VOIDmode, 1,
gen_rtx (SYMBOL_REF, Pmode, "__EXCEPTION_TABLE__"),
Pmode);
}
/* Emit code to get EH context.
......
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