From 0f59171d711aaa9623e2ebc708324299662e55bd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 22 Jun 2004 17:26:04 -0700 Subject: tree.def (VTABLE_REF): Remove. * tree.def (VTABLE_REF): Remove. (OBJ_TYPE_REF): New. (TRY_CATCH_EXPR, TRY_FINALLY_EXPR): Set type 's'. * expr.c (expand_expr_real_1): Replace VTABLE_REF with OBJ_TYPE_REF. * fold-const.c (non_lvalue): Likewise. * gimplify.c (gimplify_expr): Likewise. (gimplify_call_expr): Use is_gimple_call_addr. * langhooks-def.h (LANG_HOOKS_FOLD_OBJ_TYPE_REF): New. * langhooks.h (fold_obj_type_ref): New. * tree-gimple.c (is_gimple_call_addr): New. * tree-gimple.h (is_gimple_call_addr): Declare. * tree-inline.c (inlinable_function_p): Fix merge error. (estimate_num_insns_1): Replace VTABLE_REF with OBJ_TYPE_REF. * tree-pretty-print.c (dump_generic_node): Likewise. (print_call_name): Handle OBJ_TYPE_REF. * tree-ssa-ccp.c (fold_stmt): Fold OBJ_TYPE_REF. * tree-ssa-operands.c (get_expr_operands): Handle OBJ_TYPE_REF. * tree.h (OBJ_TYPE_REF_EXPR): New. (OBJ_TYPE_REF_OBJECT, OBJ_TYPE_REF_TOKEN): New. * doc/c-tree.texi (VTABLE_REF): Remove. * objc/objc-act.c (build_objc_method_call): Build an OBJ_TYPE_REF. cp/ * class.c (build_vfn_ref): Take a pointer not object. Build an OBJ_TYPE_REF. (cp_fold_obj_type_ref): New. * call.c (build_over_call): Update build_vfn_ref call. * cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): New. * cp-tree.h (cp_fold_obj_type_ref): Declare. testsuite/ * g++.dg/opt/devirt1.C: New. From-SVN: r83531 --- gcc/objc/objc-act.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'gcc/objc/objc-act.c') diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index bf73956..9664273 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -5866,6 +5866,7 @@ build_objc_method_call (int super_flag, tree method_prototype, (ret_type, get_arg_type_list (method_prototype, METHOD_REF, super_flag))); + tree method, t; lookup_object = build_c_cast (rcv_p, lookup_object); @@ -5886,38 +5887,33 @@ build_objc_method_call (int super_flag, tree method_prototype, method_params = tree_cons (NULL_TREE, lookup_object, tree_cons (NULL_TREE, selector, method_params)); - TREE_USED (sender) = 1; - assemble_external (sender); - /* We want to cast the sender, not convert it. */ - return build_function_call (build_c_cast (sender_cast, sender), - method_params); + method = build_fold_addr_expr (sender); } else { /* This is the portable (GNU) way. */ - tree method, object; + tree object; /* First, call the lookup function to get a pointer to the method, then cast the pointer, then call it with the method arguments. Use SAVE_EXPR to avoid evaluating the receiver twice. */ lookup_object = save_expr (lookup_object); object = (super_flag ? self_decl : lookup_object); - TREE_USED (sender) = 1; - assemble_external (sender); - method - = build_function_call (sender, - tree_cons (NULL_TREE, lookup_object, - tree_cons (NULL_TREE, selector, - NULL_TREE))); + + t = tree_cons (NULL_TREE, selector, NULL_TREE); + t = tree_cons (NULL_TREE, lookup_object, t); + method = build_function_call (sender, t); /* Pass the object to the method. */ - TREE_USED (method) = 1; - assemble_external (method); - return build_function_call - (build_c_cast (sender_cast, method), - tree_cons (NULL_TREE, object, - tree_cons (NULL_TREE, selector, method_params))); + method_params = tree_cons (NULL_TREE, object, + tree_cons (NULL_TREE, selector, + method_params)); } + + /* ??? Selector is not at this point something we can use inside + the compiler itself. Set it to garbage for the nonce. */ + t = build (OBJ_TYPE_REF, sender_cast, method, lookup_object, size_zero_node); + return build_function_call (t, method_params); } static void @@ -7607,7 +7603,8 @@ comp_method_with_proto (tree method, tree proto) function1_template = make_node (FUNCTION_TYPE); /* Install argument types - normally set by build_function_type. */ - TYPE_ARG_TYPES (function1_template) = get_arg_type_list (proto, METHOD_DEF, 0); + TYPE_ARG_TYPES (function1_template) + = get_arg_type_list (proto, METHOD_DEF, 0); /* install return type */ TREE_TYPE (function1_template) = groktypename (TREE_TYPE (proto)); -- cgit v1.1