Commit a59ca936 by Jason Merrill Committed by Jason Merrill

call.c (build_call): Still evaluate the actual argument.

	* call.c (build_call): Still evaluate the actual argument.
	* class.c (is_empty_class): Update for -fnew-abi.
	* decl2.c: -fnew-abi implies -fsquangle.
	* method.c (do_build_assign_ref): Don't do anything to copy
	an empty class.
	(do_build_copy_constructor): Likewise.
	* call.c (build_over_call): Likewise.

From-SVN: r19029
parent cd36edbd
Mon Apr 6 02:25:05 1998 Jason Merrill <jason@yorick.cygnus.com>
* call.c (build_call): Still evaluate the actual argument.
* class.c (is_empty_class): Update for -fnew-abi.
* decl2.c: -fnew-abi implies -fsquangle.
* method.c (do_build_assign_ref): Don't do anything to copy
an empty class.
(do_build_copy_constructor): Likewise.
* call.c (build_over_call): Likewise.
Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com> Sat Apr 4 18:43:58 1998 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (avoid_overlap): Return a value. * tree.c (avoid_overlap): Return a value.
......
...@@ -525,7 +525,8 @@ build_call (function, result_type, parms) ...@@ -525,7 +525,8 @@ build_call (function, result_type, parms)
TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp)); TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
RTL_EXPR_RTL (t) = const0_rtx; RTL_EXPR_RTL (t) = const0_rtx;
RTL_EXPR_SEQUENCE (t) = NULL_RTX; RTL_EXPR_SEQUENCE (t) = NULL_RTX;
TREE_VALUE (tmp) = t; TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
TREE_VALUE (tmp), t);
} }
function = build_nt (CALL_EXPR, function, parms, NULL_TREE); function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
...@@ -3351,6 +3352,12 @@ build_over_call (fn, convs, args, flags) ...@@ -3351,6 +3352,12 @@ build_over_call (fn, convs, args, flags)
{ {
tree to = stabilize_reference tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (args), 0)); (build_indirect_ref (TREE_VALUE (args), 0));
/* Don't copy the padding byte; it might not have been allocated
if to is a base subobject. */
if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
return to;
val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg); val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
TREE_SIDE_EFFECTS (val) = 1; TREE_SIDE_EFFECTS (val) = 1;
return build_unary_op (ADDR_EXPR, val, 0); return build_unary_op (ADDR_EXPR, val, 0);
...@@ -3358,10 +3365,16 @@ build_over_call (fn, convs, args, flags) ...@@ -3358,10 +3365,16 @@ build_over_call (fn, convs, args, flags)
} }
else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR] else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
&& copy_args_p (fn) && copy_args_p (fn)
&& TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn))) && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn)))
{ {
tree to = stabilize_reference tree to = stabilize_reference
(build_indirect_ref (TREE_VALUE (converted_args), 0)); (build_indirect_ref (TREE_VALUE (converted_args), 0));
/* Don't copy the padding byte; it might not have been allocated
if to is a base subobject. */
if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
return to;
arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0); arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg); val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
TREE_SIDE_EFFECTS (val) = 1; TREE_SIDE_EFFECTS (val) = 1;
......
...@@ -5486,7 +5486,13 @@ is_empty_class (type) ...@@ -5486,7 +5486,13 @@ is_empty_class (type)
{ {
tree t; tree t;
if (! IS_AGGR_TYPE (type) || TYPE_BINFO_BASETYPES (type)) if (! IS_AGGR_TYPE (type))
return 0;
if (flag_new_abi)
return CLASSTYPE_SIZE (type) == integer_zero_node;
if (TYPE_BINFO_BASETYPES (type))
return 0; return 0;
t = TYPE_FIELDS (type); t = TYPE_FIELDS (type);
while (t && TREE_CODE (t) != FIELD_DECL) while (t && TREE_CODE (t) != FIELD_DECL)
......
...@@ -401,7 +401,9 @@ int flag_new_for_scope = 1; ...@@ -401,7 +401,9 @@ int flag_new_for_scope = 1;
int flag_weak = 1; int flag_weak = 1;
int flag_new_abi = 1; /* Nonzero to enable experimental ABI changes. */
int flag_new_abi;
/* Maximum template instantiation depth. Must be at least 17 for ANSI /* Maximum template instantiation depth. Must be at least 17 for ANSI
compliance. */ compliance. */
...@@ -469,8 +471,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] = ...@@ -469,8 +471,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
{"check-new", &flag_check_new, 1}, {"check-new", &flag_check_new, 1},
{"repo", &flag_use_repository, 1}, {"repo", &flag_use_repository, 1},
{"for-scope", &flag_new_for_scope, 2}, {"for-scope", &flag_new_for_scope, 2},
{"weak", &flag_weak, 1}, {"weak", &flag_weak, 1}
{"new-abi", &flag_new_abi, 1}
}; };
/* Decode the string P as a language-specific option. /* Decode the string P as a language-specific option.
...@@ -562,6 +563,16 @@ lang_decode_option (p) ...@@ -562,6 +563,16 @@ lang_decode_option (p)
error ("-fno-ansi-overloading is no longer supported"); error ("-fno-ansi-overloading is no longer supported");
found = 1; found = 1;
} }
else if (!strcmp (p, "new-abi"))
{
flag_new_abi = 1;
flag_do_squangling = 1;
}
else if (!strcmp (p, "no-new-abi"))
{
flag_new_abi = 0;
flag_do_squangling = 0;
}
else if (!strncmp (p, "template-depth-", 15)) else if (!strncmp (p, "template-depth-", 15))
{ {
char *endp = p + 15; char *endp = p + 15;
......
...@@ -2047,7 +2047,11 @@ do_build_copy_constructor (fndecl) ...@@ -2047,7 +2047,11 @@ do_build_copy_constructor (fndecl)
parm = TREE_CHAIN (parm); parm = TREE_CHAIN (parm);
parm = convert_from_reference (parm); parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)) if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
{ {
t = build (INIT_EXPR, void_type_node, current_class_ref, parm); t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1; TREE_SIDE_EFFECTS (t) = 1;
...@@ -2159,7 +2163,11 @@ do_build_assign_ref (fndecl) ...@@ -2159,7 +2163,11 @@ do_build_assign_ref (fndecl)
parm = convert_from_reference (parm); parm = convert_from_reference (parm);
if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)) if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
&& is_empty_class (current_class_type))
/* Don't copy the padding byte; it might not have been allocated
if *this is a base subobject. */;
else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
{ {
tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm); tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
TREE_SIDE_EFFECTS (t) = 1; TREE_SIDE_EFFECTS (t) = 1;
......
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