From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id C7C4F3856275; Thu, 5 May 2022 12:08:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7C4F3856275 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] Add unqualified_addr_expr X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 75b73ced14ba50da54bf471fce62dc42df874887 X-Git-Newrev: b42abd4530ac55d9db6e86963d27aeac7165b740 Message-Id: <20220505120812.C7C4F3856275@sourceware.org> Date: Thu, 5 May 2022 12:08:12 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:08:12 -0000 https://gcc.gnu.org/g:b42abd4530ac55d9db6e86963d27aeac7165b740 commit b42abd4530ac55d9db6e86963d27aeac7165b740 Author: Richard Sandiford Date: Mon Apr 11 17:38:03 2022 +0100 Add unqualified_addr_expr Mechanically replace remaining direct uses of: ADDR_EXPR with: unqualified_addr_expr () which returns the code associated with a normal C/C++ & on the current target. The name is supposed to line up with the somewhat related unqualified_address_mode and unqualified_pointer_mode. Diff: --- gcc/ada/gcc-interface/decl.c | 14 ++++--- gcc/ada/gcc-interface/misc.c | 3 +- gcc/ada/gcc-interface/trans.c | 57 +++++++++++++++++----------- gcc/ada/gcc-interface/utils.c | 20 +++++----- gcc/ada/gcc-interface/utils2.c | 36 ++++++++++-------- gcc/c-family/c-common.c | 2 +- gcc/c-family/c-omp.c | 11 ++++-- gcc/c/c-decl.c | 3 +- gcc/c/c-parser.c | 5 ++- gcc/c/c-typeck.c | 20 +++++----- gcc/c/gimple-parser.c | 2 +- gcc/config/rs6000/rs6000-c.c | 4 +- gcc/cp/class.c | 2 +- gcc/cp/mangle.c | 2 +- gcc/cp/parser.c | 8 ++-- gcc/cp/pt.c | 2 +- gcc/cp/search.c | 3 +- gcc/cp/typeck.c | 4 +- gcc/objc/objc-act.c | 20 ++++++---- gcc/objc/objc-gnu-runtime-abi-01.c | 63 ++++++++++++++++++------------- gcc/objc/objc-next-runtime-abi-01.c | 69 ++++++++++++++++++++++------------ gcc/objc/objc-next-runtime-abi-02.c | 62 +++++++++++++++++++----------- gcc/objc/objc-runtime-shared-support.c | 12 +++--- gcc/tree-ssa-sccvn.c | 2 +- gcc/tree.c | 9 +++++ gcc/tree.h | 1 + libcc1/libcp1plugin.cc | 2 +- 27 files changed, 269 insertions(+), 169 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index b487e911738..6d949569750 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1142,7 +1142,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) const_flag = true; volatile_flag = false; - gnu_expr = build_unary_op (ADDR_EXPR, gnu_type, gnu_expr); + gnu_expr = build_unary_op (unqualified_addr_expr (), + gnu_type, gnu_expr); create_var_decl (gnu_entity_name, gnu_ext_name, TREE_TYPE (gnu_expr), gnu_expr, @@ -1154,7 +1155,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* Otherwise, instantiate the SAVE_EXPRs if needed. */ else if (TREE_SIDE_EFFECTS (gnu_expr)) - add_stmt (build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr)); + add_stmt (build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_expr)); break; } @@ -1432,7 +1434,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnu_type = build_reference_type (gnu_type); gnu_expr = build_unary_op - (ADDR_EXPR, NULL_TREE, + (unqualified_addr_expr (), NULL_TREE, build_component_ref (gnu_new_var, TYPE_FIELDS (gnu_new_type), false)); TREE_CONSTANT (gnu_expr) = 1; @@ -1481,7 +1483,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) volatile_flag, true, debug_info_p && definition, NULL, gnat_entity); - gnu_expr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_unc_var); + gnu_expr = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_unc_var); TREE_CONSTANT (gnu_expr) = 1; used_by_ref = true; @@ -1617,7 +1620,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) STACK_CHECK_MAX_VAR_SIZE) > 0))) add_stmt_with_node (build_call_n_expr (update_setjmp_buf_decl, 1, - build_unary_op (ADDR_EXPR, NULL_TREE, + build_unary_op (unqualified_addr_expr (), + NULL_TREE, get_block_jmpbuf_decl ())), gnat_entity); diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 3999f9cc2be..e88fb32f651 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -817,7 +817,8 @@ gnat_get_array_descr_info (const_tree const_type, pointers are shifted). */ tree placeholder_expr = build0 (PLACEHOLDER_EXPR, type); tree placeholder_addr - = build_unary_op (ADDR_EXPR, NULL_TREE, placeholder_expr); + = build_unary_op (unqualified_addr_expr (), NULL_TREE, + placeholder_expr); tree bounds_field = TYPE_FIELDS (type); tree bounds_type = TREE_TYPE (bounds_field); diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 7677531d742..a61258e983c 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1741,7 +1741,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) later if a static chain is requested). */ if (!build_descriptor) { - gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_prefix); + gnu_result = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_prefix); gnu_result = fold_convert (build_pointer_type (gnu_result_type), gnu_result); gnu_result = build1 (INDIRECT_REF, gnu_result_type, gnu_result); @@ -1785,7 +1786,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) = build_unary_op (((attribute == Attr_Address || attribute == Attr_Unrestricted_Access) && !Must_Be_Byte_Aligned (gnat_node)) - ? ATTR_ADDR_EXPR : ADDR_EXPR, + ? ATTR_ADDR_EXPR : unqualified_addr_expr (), gnu_result_type, gnu_prefix); /* For 'Code_Address, find an inner ADDR_EXPR and mark it so that we @@ -4119,7 +4120,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) 1, integer_zero_node); t = build_call_n_expr (unhandled_except_decl, 1, t); - etype = build_unary_op (ADDR_EXPR, NULL_TREE, unhandled_others_decl); + etype = build_unary_op (unqualified_addr_expr (), + NULL_TREE, unhandled_others_decl); etype = tree_cons (NULL_TREE, etype, NULL_TREE); t = build2 (CATCH_EXPR, void_type_node, etype, t); @@ -4821,7 +4823,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, /* Take the address of the object and convert to the proper pointer type. */ gnu_formal_type = TREE_TYPE (gnu_formal); - gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); + gnu_actual = build_unary_op (unqualified_addr_expr (), + gnu_formal_type, gnu_actual); } /* Then see if the parameter is an array passed to a foreign convention @@ -4838,7 +4841,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, getting the wrong address. Neither approach is exactly correct, but this is the most likely to work in all cases. */ gnu_formal_type = TREE_TYPE (gnu_formal); - gnu_actual = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); + gnu_actual = build_unary_op (unqualified_addr_expr (), + gnu_formal_type, gnu_actual); } /* Then see if the parameter is passed by copy. */ @@ -4888,7 +4892,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnu_formal_type = TREE_TYPE (gnu_formal_type); gnu_formal_type = build_pointer_type (gnu_formal_type); gnu_actual - = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); + = build_unary_op (unqualified_addr_expr (), + gnu_formal_type, gnu_actual); } /* Fat pointers are passed as thin pointers. */ @@ -4908,7 +4913,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, { gnu_formal_type = build_reference_type (gnu_formal_type); gnu_actual - = build_unary_op (ADDR_EXPR, gnu_formal_type, gnu_actual); + = build_unary_op (unqualified_addr_expr (), + gnu_formal_type, gnu_actual); } /* Otherwise pass by copy after applying default C promotions. */ @@ -4940,7 +4946,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, if (TREE_SIDE_EFFECTS (gnu_name)) { - tree addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_name); + tree addr = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_name); append_to_statement_list (addr, &gnu_stmt_list); } @@ -4983,8 +4990,8 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target, gnu_call = build_call_array_loc (UNKNOWN_LOCATION, gnu_result_type, - build_unary_op (ADDR_EXPR, NULL_TREE, - gnu_subprog), + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_subprog), gnu_actual_vec.length (), gnu_actual_vec.begin ()); CALL_EXPR_BY_DESCRIPTOR (gnu_call) = by_descriptor; @@ -5333,7 +5340,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) if (fe_sjlj_eh) { gnu_expr = build_call_n_expr (set_jmpbuf_decl, 1, - build_unary_op (ADDR_EXPR, NULL_TREE, + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_jmpbuf_decl)); set_expr_location_from_node (gnu_expr, gnat_node); add_stmt (gnu_expr); @@ -5422,8 +5430,8 @@ Handled_Sequence_Of_Statements_to_gnu (Node_Id gnat_node) gnu_result = build3 (COND_EXPR, void_type_node, (build_call_n_expr (setjmp_decl, 1, - build_unary_op (ADDR_EXPR, NULL_TREE, - gnu_jmpbuf_decl))), + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_jmpbuf_decl))), gnu_handler, gnu_inner_block); } else if (gcc_eh) @@ -5526,7 +5534,8 @@ Exception_Handler_to_gnu_fe_sjlj (Node_Id gnat_node) (EQ_EXPR, boolean_type_node, gnu_except_ptr_stack->last (), convert (TREE_TYPE (gnu_except_ptr_stack->last ()), - build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr))); + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_expr))); } else gcc_unreachable (); @@ -5591,7 +5600,8 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node) if (Nkind (gnat_temp) == N_Others_Choice) { gnu_expr = All_Others (gnat_temp) ? all_others_decl : others_decl; - gnu_etype = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr); + gnu_etype = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_expr); } else if (Nkind (gnat_temp) == N_Identifier || Nkind (gnat_temp) == N_Expanded_Name) @@ -5604,7 +5614,8 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node) gnat_ex_id = Renamed_Object (gnat_ex_id); gnu_expr = gnat_to_gnu_entity (gnat_ex_id, NULL_TREE, false); - gnu_etype = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr); + gnu_etype = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_expr); } else gcc_unreachable (); @@ -5681,7 +5692,8 @@ Exception_Handler_to_gnu_gcc (Node_Id gnat_node) /* CODE: __gnat_set_exception_parameter (&choice_param, EXPTR); */ add_stmt (build_call_n_expr (set_exception_parameter_decl, 2, - build_unary_op (ADDR_EXPR, NULL_TREE, gnu_param), + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_param), gnu_incoming_exc_ptr)); } @@ -6773,7 +6785,8 @@ gnat_to_gnu (Node_Id gnat_node) case N_Reference: /* Like 'Access as far as we are concerned. */ gnu_result = gnat_to_gnu (Prefix (gnat_node)); - gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_result); + gnu_result = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_result); gnu_result_type = get_unpadded_type (Etype (gnat_node)); break; @@ -6888,7 +6901,8 @@ gnat_to_gnu (Node_Id gnat_node) if (TARGET_VTABLE_USES_DESCRIPTORS && TREE_TYPE (gnu_expr) == fdesc_type_node && POINTER_TYPE_P (gnu_result_type)) - gnu_expr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr); + gnu_expr = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_expr); gnu_result = unchecked_convert (gnu_result_type, gnu_expr, No_Truncation (gnat_node)); @@ -7456,7 +7470,8 @@ gnat_to_gnu (Node_Id gnat_node) to the return value. */ if (TYPE_RETURN_BY_DIRECT_REF_P (gnu_subprog_type) || By_Ref (gnat_node)) - gnu_ret_val = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_ret_val); + gnu_ret_val = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_ret_val); /* Otherwise, if it returns an unconstrained array, we have to allocate a new version of the result and return it. */ @@ -8048,7 +8063,7 @@ gnat_to_gnu (Node_Id gnat_node) for this is that we need to have a fat pointer someplace in order to properly compute the size. */ if (TYPE_IS_THIN_POINTER_P (TREE_TYPE (gnu_ptr))) - gnu_ptr = build_unary_op (ADDR_EXPR, NULL_TREE, + gnu_ptr = build_unary_op (unqualified_addr_expr (), NULL_TREE, build_unary_op (INDIRECT_REF, NULL_TREE, gnu_ptr)); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 301802418d1..2a113257ce1 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -941,7 +941,8 @@ make_aligning_type (tree type, unsigned int align, tree size, tree record = build0 (PLACEHOLDER_EXPR, record_type); tree record_addr_st - = convert (sizetype, build_unary_op (ADDR_EXPR, NULL_TREE, record)); + = convert (sizetype, build_unary_op (unqualified_addr_expr (), + NULL_TREE, record)); /* The diagram below summarizes the shape of what we manipulate: @@ -4371,7 +4372,8 @@ convert_to_fat_pointer (tree type, tree expr) empty constructor. The middle-end will fill it in with zeros. */ t = build_constructor (template_type, NULL); TREE_CONSTANT (t) = TREE_STATIC (t) = 1; - null_bounds = build_unary_op (ADDR_EXPR, NULL_TREE, t); + null_bounds = build_unary_op (unqualified_addr_expr (), + NULL_TREE, t); SET_TYPE_NULL_BOUNDS (ptr_template_type, null_bounds); } @@ -4413,9 +4415,9 @@ convert_to_fat_pointer (tree type, tree expr) { expr = build_unary_op (INDIRECT_REF, NULL_TREE, expr); template_addr - = build_unary_op (ADDR_EXPR, NULL_TREE, + = build_unary_op (unqualified_addr_expr (), NULL_TREE, build_component_ref (expr, field, false)); - expr = build_unary_op (ADDR_EXPR, NULL_TREE, + expr = build_unary_op (unqualified_addr_expr (), NULL_TREE, build_component_ref (expr, DECL_CHAIN (field), false)); } @@ -4424,7 +4426,7 @@ convert_to_fat_pointer (tree type, tree expr) /* Otherwise, build the constructor for the template. */ else template_addr - = build_unary_op (ADDR_EXPR, NULL_TREE, + = build_unary_op (unqualified_addr_expr (), NULL_TREE, build_template (template_type, TREE_TYPE (etype), expr)); @@ -5024,7 +5026,7 @@ convert (tree type, tree expr) build_unary_op (INDIRECT_REF, NULL_TREE, convert_to_fat_pointer (TREE_TYPE (type), - build_unary_op (ADDR_EXPR, + build_unary_op (unqualified_addr_expr (), NULL_TREE, expr))); /* Do something very similar for converting one unconstrained @@ -5033,7 +5035,7 @@ convert (tree type, tree expr) return build_unary_op (INDIRECT_REF, NULL_TREE, convert (TREE_TYPE (type), - build_unary_op (ADDR_EXPR, + build_unary_op (unqualified_addr_expr (), NULL_TREE, expr))); else gcc_unreachable (); @@ -5524,8 +5526,8 @@ unchecked_convert (tree type, tree expr, bool notrunc_p) else if (ecode == code && code == UNCONSTRAINED_ARRAY_TYPE) expr = build_unary_op (INDIRECT_REF, NULL_TREE, build1 (VIEW_CONVERT_EXPR, TREE_TYPE (type), - build_unary_op (ADDR_EXPR, NULL_TREE, - expr))); + build_unary_op (unqualified_addr_expr (), + NULL_TREE, expr))); /* Another special case is when we are converting to a vector type from its representative array type; this a regular conversion. */ diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index a189b3c5f3a..a52c1bf72cb 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -705,7 +705,7 @@ build_atomic_load (tree src, bool sync) fncode = (int) BUILT_IN_ATOMIC_LOAD_N + exact_log2 (size) + 1; t = builtin_decl_implicit ((enum built_in_function) fncode); - addr = build_unary_op (ADDR_EXPR, ptr_type, src); + addr = build_unary_op (unqualified_addr_expr (), ptr_type, src); val = build_call_expr (t, 2, addr, mem_model); /* First reinterpret the loaded bits in the original type of the load, @@ -753,7 +753,7 @@ build_atomic_store (tree dest, tree src, bool sync) else src = convert (TREE_TYPE (dest), src); src = fold_build1 (VIEW_CONVERT_EXPR, int_type, src); - addr = build_unary_op (ADDR_EXPR, ptr_type, dest); + addr = build_unary_op (unqualified_addr_expr (), ptr_type, dest); return build_call_expr (t, 3, addr, src, mem_model); } @@ -1416,7 +1416,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) || (TREE_CODE (TREE_OPERAND (operand, 1)) == VAR_DECL && DECL_RETURN_VALUE_P (TREE_OPERAND (operand, 1)))) { - result = build_unary_op (ADDR_EXPR, result_type, + result = build_unary_op (unqualified_addr_expr (), result_type, TREE_OPERAND (operand, 1)); result = build2 (COMPOUND_EXPR, TREE_TYPE (result), TREE_OPERAND (operand, 0), result); @@ -1459,7 +1459,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) /* Take the address of INNER, convert it to a pointer to our type and add the offset. */ - inner = build_unary_op (ADDR_EXPR, + inner = build_unary_op (unqualified_addr_expr (), build_pointer_type (TREE_TYPE (operand)), inner); result = build_binary_op (POINTER_PLUS_EXPR, TREE_TYPE (inner), @@ -1475,7 +1475,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) if (TYPE_IS_PADDING_P (type)) { result - = build_unary_op (ADDR_EXPR, + = build_unary_op (unqualified_addr_expr (), build_pointer_type (TREE_TYPE (operand)), CONSTRUCTOR_ELT (operand, 0)->value); break; @@ -1485,7 +1485,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) case NOP_EXPR: if (AGGREGATE_TYPE_P (type) && AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (operand, 0)))) - return build_unary_op (ADDR_EXPR, result_type, + return build_unary_op (unqualified_addr_expr (), result_type, TREE_OPERAND (operand, 0)); /* ... fallthru ... */ @@ -1500,7 +1500,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) || (TYPE_MODE (type) != BLKmode && (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (TREE_OPERAND (operand, 0)))))) - return build_unary_op (ADDR_EXPR, + return build_unary_op (unqualified_addr_expr (), (result_type ? result_type : build_pointer_type (type)), TREE_OPERAND (operand, 0)); @@ -1706,8 +1706,10 @@ build_cond_expr (tree result_type, tree condition_operand, || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { result_type = build_pointer_type (result_type); - true_operand = build_unary_op (ADDR_EXPR, result_type, true_operand); - false_operand = build_unary_op (ADDR_EXPR, result_type, false_operand); + true_operand = build_unary_op (unqualified_addr_expr (), + result_type, true_operand); + false_operand = build_unary_op (unqualified_addr_expr (), + result_type, false_operand); addr_p = true; } @@ -1746,7 +1748,8 @@ build_compound_expr (tree result_type, tree stmt_operand, tree expr_operand) || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (result_type))) { result_type = build_pointer_type (result_type); - expr_operand = build_unary_op (ADDR_EXPR, result_type, expr_operand); + expr_operand = build_unary_op (unqualified_addr_expr (), + result_type, expr_operand); addr_p = true; } @@ -1796,8 +1799,8 @@ build_goto_raise (Entity_Id gnat_label, int msg) = gnat_to_gnu_entity (Get_RT_Exception_Entity (msg), NULL_TREE, false); tree gnu_call = build_call_n_expr (gnu_local_raise, 1, - build_unary_op (ADDR_EXPR, NULL_TREE, - gnu_exception_entity)); + build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_exception_entity)); gnu_result = build2 (COMPOUND_EXPR, void_type_node, gnu_call, gnu_result); } @@ -2133,7 +2136,8 @@ build_call_alloc_dealloc_proc (tree gnu_obj, tree gnu_size, tree gnu_type, tree gnu_size_type = gnat_to_gnu_type (gnat_size_type); tree gnu_pool = gnat_to_gnu (gnat_pool); - tree gnu_pool_addr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_pool); + tree gnu_pool_addr = build_unary_op (unqualified_addr_expr (), + NULL_TREE, gnu_pool); tree gnu_align = size_int (TYPE_ALIGN (gnu_type) / BITS_PER_UNIT); gnu_size = convert (gnu_size_type, gnu_size); @@ -2218,7 +2222,8 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node) false); tree aligning_field_addr - = build_unary_op (ADDR_EXPR, NULL_TREE, aligning_field); + = build_unary_op (unqualified_addr_expr (), + NULL_TREE, aligning_field); /* Then arrange to store the allocator's return value ahead and return. */ @@ -2610,7 +2615,8 @@ gnat_protect_expr (tree exp) /* Otherwise reference, protect the address and dereference. */ return build_unary_op (INDIRECT_REF, type, - save_expr (build_unary_op (ADDR_EXPR, NULL_TREE, exp))); + save_expr (build_unary_op (unqualified_addr_expr (), + NULL_TREE, exp))); } /* This is equivalent to stabilize_reference_1 in tree.c but we take an extra diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 428daf4b08f..3e82c16b42b 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -3426,7 +3426,7 @@ c_common_truthvalue_conversion (location_t location, tree expr) : truthvalue_false_node; case FUNCTION_DECL: - expr = build_unary_op (location, ADDR_EXPR, expr, false); + expr = build_unary_op (location, unqualified_addr_expr (), expr, false); goto addr_expr; CASE_ADDR_EXPR: diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 237b63d0d53..5287224dbb4 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -259,7 +259,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, /* Take and save the address of the lhs. From then on we'll reference it via indirection. */ - addr = build_unary_op (loc, ADDR_EXPR, lhs, false); + addr = build_unary_op (loc, unqualified_addr_expr (), lhs, false); if (addr == error_mark_node) return error_mark_node; if (!test) @@ -401,14 +401,16 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, loc, x, NULL_TREE); if (rhs1 && rhs1 != orig_lhs) { - tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false); + tree rhs1addr = build_unary_op (loc, unqualified_addr_expr (), + rhs1, false); if (rhs1addr == error_mark_node) return error_mark_node; x = omit_one_operand_loc (loc, type, x, rhs1addr); } if (lhs1 && lhs1 != orig_lhs) { - tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, false); + tree lhs1addr = build_unary_op (loc, unqualified_addr_expr (), + lhs1, false); if (lhs1addr == error_mark_node) return error_mark_node; if (code == OMP_ATOMIC_CAPTURE_OLD) @@ -423,7 +425,8 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, } else if (rhs1 && rhs1 != orig_lhs) { - tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false); + tree rhs1addr = build_unary_op (loc, unqualified_addr_expr (), + rhs1, false); if (rhs1addr == error_mark_node) return error_mark_node; x = omit_one_operand_loc (loc, type, x, rhs1addr); diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 0dfcf5ed4ae..8392076ec88 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5548,7 +5548,8 @@ finish_decl (tree decl, location_t init_loc, tree init, vec *v; /* Build "cleanup(&decl)" for the destructor. */ - cleanup = build_unary_op (input_location, ADDR_EXPR, decl, false); + cleanup = build_unary_op (input_location, unqualified_addr_expr (), + decl, false); vec_alloc (v, 1); v->quick_push (cleanup); cleanup = c_build_function_call_vec (DECL_SOURCE_LOCATION (decl), diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index a37e2d8c0ec..afb99f03f3f 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -8240,7 +8240,7 @@ c_parser_unary_expression (c_parser *parser) c_parser_consume_token (parser); op = c_parser_cast_expression (parser, NULL); mark_exp_read (op.value); - return parser_build_unary_op (op_loc, ADDR_EXPR, op); + return parser_build_unary_op (op_loc, unqualified_addr_expr (), op); case CPP_MULT: { c_parser_consume_token (parser); @@ -17874,7 +17874,8 @@ c_parser_omp_depobj (c_parser *parser) } else { - tree addr = build_unary_op (EXPR_LOC_OR_LOC (depobj, loc), ADDR_EXPR, + tree addr = build_unary_op (EXPR_LOC_OR_LOC (depobj, loc), + unqualified_addr_expr (), depobj, false); if (addr == error_mark_node) depobj = error_mark_node; diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 883ff00eb15..db8f3fcf25a 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -1942,7 +1942,7 @@ array_to_pointer_conversion (location_t loc, tree exp) "is ill-formed in C++"); } - adr = build_unary_op (loc, ADDR_EXPR, exp, true); + adr = build_unary_op (loc, unqualified_addr_expr (), exp, true); return convert (ptrtype, adr); } @@ -1959,7 +1959,7 @@ function_to_pointer_conversion (location_t loc, tree exp) if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp) = 1; - return build_unary_op (loc, ADDR_EXPR, exp, false); + return build_unary_op (loc, unqualified_addr_expr (), exp, false); } /* Mark EXP as read, not just set, for set but not used -Wunused @@ -2106,7 +2106,8 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, vec *params; tree nonatomic_type, tmp, tmp_addr, fndecl, func_call; tree expr_type = TREE_TYPE (exp.value); - tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, false); + tree expr_addr = build_unary_op (loc, unqualified_addr_expr (), + exp.value, false); tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); gcc_assert (TYPE_ATOMIC (expr_type)); @@ -2119,7 +2120,7 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, create the VAL temp variable to hold the RHS. */ nonatomic_type = build_qualified_type (expr_type, TYPE_UNQUALIFIED); tmp = create_tmp_var_raw (nonatomic_type); - tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, false); + tmp_addr = build_unary_op (loc, unqualified_addr_expr (), tmp, false); TREE_ADDRESSABLE (tmp) = 1; TREE_NO_WARNING (tmp) = 1; @@ -4089,7 +4090,7 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, tree loop_label, loop_decl, done_label, done_decl; tree lhs_type = TREE_TYPE (lhs); - tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, false); + tree lhs_addr = build_unary_op (loc, unqualified_addr_expr (), lhs, false); tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); tree rhs_semantic_type = TREE_TYPE (rhs); tree nonatomic_rhs_semantic_type; @@ -4139,7 +4140,7 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, if (modifycode == NOP_EXPR) { /* Build __atomic_store (&lhs, &val, SEQ_CST) */ - rhs = build_unary_op (loc, ADDR_EXPR, val, false); + rhs = build_unary_op (loc, unqualified_addr_expr (), val, false); fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_STORE); params->quick_push (lhs_addr); params->quick_push (rhs); @@ -4244,12 +4245,12 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, cas_loop: /* Create the variables and labels required for the op= form. */ old = create_tmp_var_raw (nonatomic_lhs_type); - old_addr = build_unary_op (loc, ADDR_EXPR, old, false); + old_addr = build_unary_op (loc, unqualified_addr_expr (), old, false); TREE_ADDRESSABLE (old) = 1; TREE_NO_WARNING (old) = 1; newval = create_tmp_var_raw (nonatomic_lhs_type); - newval_addr = build_unary_op (loc, ADDR_EXPR, newval, false); + newval_addr = build_unary_op (loc, unqualified_addr_expr (), newval, false); TREE_ADDRESSABLE (newval) = 1; TREE_NO_WARNING (newval) = 1; @@ -14844,7 +14845,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) } if (!remove) { - tree addr = build_unary_op (OMP_CLAUSE_LOCATION (c), ADDR_EXPR, + tree addr = build_unary_op (OMP_CLAUSE_LOCATION (c), + unqualified_addr_expr (), t, false); if (addr == error_mark_node) remove = true; diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index f9c1530c89f..5ab987772b9 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -1085,7 +1085,7 @@ c_parser_gimple_unary_expression (gimple_parser &parser) c_parser_consume_token (parser); op = c_parser_gimple_postfix_expression (parser); mark_exp_read (op.value); - return parser_build_unary_op (op_loc, ADDR_EXPR, op); + return parser_build_unary_op (op_loc, unqualified_addr_expr (), op); case CPP_MULT: { c_parser_consume_token (parser); diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index f5982907e90..2c86befd100 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -1484,7 +1484,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, innerptrtype = build_pointer_type (arg1_inner_type); - stmt = build_unary_op (loc, ADDR_EXPR, stmt, 0); + stmt = build_unary_op (loc, unqualified_addr_expr (), stmt, 0); stmt = convert (innerptrtype, stmt); stmt = build_binary_op (loc, PLUS_EXPR, stmt, arg2, 1); stmt = build_indirect_ref (loc, stmt, RO_NULL); @@ -1596,7 +1596,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, innerptrtype = build_pointer_type (arg1_inner_type); - stmt = build_unary_op (loc, ADDR_EXPR, stmt, 0); + stmt = build_unary_op (loc, unqualified_addr_expr (), stmt, 0); stmt = convert (innerptrtype, stmt); stmt = build_binary_op (loc, PLUS_EXPR, stmt, arg2, 1); stmt = build_indirect_ref (loc, stmt, RO_NULL); diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 07881cecd0c..6a2ff440caa 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -550,7 +550,7 @@ build_simple_base_path (tree expr, tree binfo) into `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only an lvalue in the front end; only _DECLs and _REFs are lvalues in the back end. */ - temp = unary_complex_lvalue (ADDR_EXPR, expr); + temp = unary_complex_lvalue (unqualified_addr_expr (), expr); if (temp) expr = cp_build_fold_indirect_ref (temp); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 1210cc82a20..e7934f91449 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -2940,7 +2940,7 @@ write_expression (tree expr) nodes. */ if (code == PTRMEM_CST) { - expr = build_nt (ADDR_EXPR, + expr = build_nt (unqualified_addr_expr (), build_qualified_name (/*type=*/NULL_TREE, PTRMEM_CST_CLASS (expr), PTRMEM_CST_MEMBER (expr), diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1bf67cc1a5d..6bb98672b23 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8655,7 +8655,7 @@ cp_parser_unary_operator (cp_token* token) return INDIRECT_REF; case CPP_AND: - return ADDR_EXPR; + return unqualified_addr_expr (); case CPP_PLUS: return UNARY_PLUS_EXPR; @@ -17455,8 +17455,8 @@ cp_parser_template_argument (cp_parser* parser) if (cp_parser_parse_definitely (parser)) { if (address_p) - argument = build_x_unary_op (loc, ADDR_EXPR, argument, - tf_warning_or_error); + argument = build_x_unary_op (loc, unqualified_addr_expr (), + argument, tf_warning_or_error); else argument = convert_from_reference (argument); return argument; @@ -21855,7 +21855,7 @@ cp_parser_ptr_operator (cp_parser* parser, if (token->type == CPP_MULT) code = INDIRECT_REF; else if (token->type == CPP_AND) - code = ADDR_EXPR; + code = unqualified_addr_expr (); else if ((cxx_dialect != cxx98) && token->type == CPP_AND_AND) /* C++0x only */ code = NON_LVALUE_EXPR; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7b2de7db25d..c35fe372df1 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -19527,7 +19527,7 @@ tsubst_copy_and_build (tree t, else op1 = tsubst_non_call_postfix_expression (op1, args, complain, in_decl); - RETURN (build_x_unary_op (input_location, ADDR_EXPR, op1, + RETURN (build_x_unary_op (input_location, unqualified_addr_expr (), op1, complain|decltype_flag)); case PLUS_EXPR: diff --git a/gcc/cp/search.c b/gcc/cp/search.c index e36a8aed8f8..5011ce9bfbf 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1718,7 +1718,8 @@ reference_accessor_p (tree init_expr, tree field_decl, tree field_type, tree field_pointer_type = build_pointer_type (field_type); tree addr_expr = STRIP_NOPS (TREE_OPERAND (init_expr, 1)); - if (!matches_code_and_type_p (addr_expr, ADDR_EXPR, field_pointer_type)) + if (!matches_code_and_type_p (addr_expr, unqualified_addr_expr (), + field_pointer_type)) return false; tree component_ref = STRIP_NOPS (TREE_OPERAND (addr_expr, 0)); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index ff4ee7dbfa1..6cb53a4b86b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2567,7 +2567,7 @@ build_class_member_access_expr (cp_expr object, tree member, `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only an lvalue in the front end; only _DECLs and _REFs are lvalues in the back end. */ { - tree temp = unary_complex_lvalue (ADDR_EXPR, object); + tree temp = unary_complex_lvalue (unqualified_addr_expr (), object); if (temp) { temp = cp_build_fold_indirect_ref (temp); @@ -6409,7 +6409,7 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain) /* Handle complex lvalues (when permitted) by reduction to simpler cases. */ - val = unary_complex_lvalue (ADDR_EXPR, arg); + val = unary_complex_lvalue (unqualified_addr_expr (), arg); if (val != 0) return val; diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index e3e1831fe61..26cc9520ec5 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -3220,8 +3220,8 @@ objc_build_string_object (tree string) } addr = convert (build_pointer_type (constant_string_type), - build_unary_op (input_location, - ADDR_EXPR, desc->constructor, 1)); + build_unary_op (input_location, unqualified_addr_expr (), + desc->constructor, 1)); return addr; } @@ -3576,7 +3576,8 @@ objc_build_ivar_assignment (tree outervar, tree lhs, tree rhs) : objc_assign_ivar_decl); offs = convert (integer_type_node, build_unary_op (input_location, - ADDR_EXPR, offs, 0)); + unqualified_addr_expr (), + offs, 0)); offs = fold (offs); func_params = tree_cons (NULL_TREE, convert (objc_object_type, rhs), @@ -3593,7 +3594,8 @@ objc_build_global_assignment (tree lhs, tree rhs) tree func_params = tree_cons (NULL_TREE, convert (objc_object_type, rhs), tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type), - build_unary_op (input_location, ADDR_EXPR, lhs, 0)), + build_unary_op (input_location, unqualified_addr_expr (), + lhs, 0)), NULL_TREE)); return build_function_call (input_location, @@ -3606,7 +3608,8 @@ objc_build_strong_cast_assignment (tree lhs, tree rhs) tree func_params = tree_cons (NULL_TREE, convert (objc_object_type, rhs), tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type), - build_unary_op (input_location, ADDR_EXPR, lhs, 0)), + build_unary_op (input_location, unqualified_addr_expr (), + lhs, 0)), NULL_TREE)); return build_function_call (input_location, @@ -7315,7 +7318,8 @@ objc_synthesize_getter (tree klass, tree class_methods ATTRIBUTE_UNUSED, tree pr tree_cons /* &__objc_property_temp_decl */ /* Warning: note that using build_fold_addr_expr_loc() here causes invalid code to be generated. */ - (NULL_TREE, build_unary_op (location, ADDR_EXPR, objc_property_temp_decl, 0), + (NULL_TREE, build_unary_op (location, unqualified_addr_expr (), + objc_property_temp_decl, 0), tree_cons /* &(self->PROPERTY_IVAR_NAME); */ (NULL_TREE, build_fold_addr_expr_loc (location, objc_lookup_ivar @@ -8847,8 +8851,8 @@ get_super_receiver (void) super_expr_list = build_compound_expr (input_location, super_expr_list, super_expr); - super_expr = build_unary_op (input_location, - ADDR_EXPR, UOBJC_SUPER_decl, 0); + super_expr = build_unary_op (input_location, unqualified_addr_expr (), + UOBJC_SUPER_decl, 0); super_expr_list = build_compound_expr (input_location, super_expr_list, super_expr); diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c index 7adf7e6b40f..a4c148d25d7 100644 --- a/gcc/objc/objc-gnu-runtime-abi-01.c +++ b/gcc/objc/objc-gnu-runtime-abi-01.c @@ -643,7 +643,7 @@ gnu_runtime_abi_01_build_typed_selector_reference (location_t loc, tree ident, (b) provide better diagnostics for the first time an undefined selector is used. */ return_at_index: - expr = build_unary_op (loc, ADDR_EXPR, + expr = build_unary_op (loc, unqualified_addr_expr (), build_array_ref (loc, UOBJC_SELECTOR_TABLE_decl, build_int_cst (NULL_TREE, index)), 1); @@ -749,7 +749,8 @@ gnu_runtime_abi_01_get_protocol_reference (location_t loc, tree p) if (!PROTOCOL_FORWARD_DECL (p)) PROTOCOL_FORWARD_DECL (p) = gnu_runtime_abi_01_protocol_decl (p); - expr = build_unary_op (loc, ADDR_EXPR, PROTOCOL_FORWARD_DECL (p), 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + PROTOCOL_FORWARD_DECL (p), 0); /* ??? Ideally we'd build the reference with objc_protocol_type directly, if we have it, rather than converting it here. */ @@ -912,8 +913,9 @@ gnu_runtime_abi_01_build_const_string_constructor (location_t loc, tree string, CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0)); fields = DECL_CHAIN (fields); - CONSTRUCTOR_APPEND_ELT (v, fields, build_unary_op (loc, - ADDR_EXPR, string, 1)); + CONSTRUCTOR_APPEND_ELT (v, fields, + build_unary_op (loc, unqualified_addr_expr (), + string, 1)); fields = DECL_CHAIN (fields); CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, length)); @@ -959,7 +961,7 @@ build_module_initializer_routine (void) execclass_decl, build_tree_list (NULL_TREE, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, unqualified_addr_expr (), UOBJC_MODULES_decl, 0)))); add_stmt (c_end_compound_stmt (input_location, body, true)); @@ -1109,13 +1111,15 @@ build_protocol_initializer (tree type, tree protocol_name, tree protocol_list, ttyp = objc_method_proto_list_ptr; if (inst_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); if (class_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); @@ -1164,7 +1168,7 @@ generate_protocol_list (tree i_or_p, tree klass_ctxt) { tree fwref = PROTOCOL_FORWARD_DECL (pval); location_t loc = DECL_SOURCE_LOCATION (fwref) ; - e = build_unary_op (loc, ADDR_EXPR, fwref, 0); + e = build_unary_op (loc, unqualified_addr_expr (), fwref, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, e); } } @@ -1335,7 +1339,8 @@ generate_protocols (void) refs_expr = convert (build_pointer_type (build_pointer_type (objc_protocol_template)), build_unary_op (input_location, - ADDR_EXPR, refs_decl, 0)); + unqualified_addr_expr (), + refs_decl, 0)); else refs_expr = build_int_cst (NULL_TREE, 0); @@ -1395,13 +1400,15 @@ build_category_initializer (tree type, tree cat_name, tree class_name, ltyp = objc_method_list_ptr; if (inst_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); if (class_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1409,7 +1416,8 @@ build_category_initializer (tree type, tree cat_name, tree class_name, /* protocol_list = */ ltyp = build_pointer_type (build_pointer_type (objc_protocol_template)); if (protocol_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, protocol_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + protocol_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1523,7 +1531,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, else { expr = convert (objc_ivar_list_ptr, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, unqualified_addr_expr (), ivar_list, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1535,7 +1543,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, else { expr = convert (objc_method_list_ptr, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, unqualified_addr_expr (), dispatch_table, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1567,7 +1575,7 @@ build_shared_structure_initializer (tree type, tree isa, tree super, else { expr = convert (ltyp, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, unqualified_addr_expr (), protocol_list, 0)); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1737,7 +1745,7 @@ generate_class_structures (struct imp_entry *impent) initlist = build_shared_structure_initializer (TREE_TYPE (class_decl), - build_unary_op (loc, ADDR_EXPR, meta_decl, 0), + build_unary_op (loc, unqualified_addr_expr (), meta_decl, 0), super_expr, name_expr, convert (integer_type_node, TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE @@ -1884,14 +1892,15 @@ generate_static_references (void) class_name = get_objc_string_decl (OBJC_TYPE_NAME (klass), class_names); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_unary_op (input_location, - ADDR_EXPR, class_name, 1)); + unqualified_addr_expr (), + class_name, 1)); /* Output {..., instance, ...}. */ for (in_chain = TREE_PURPOSE (cl_chain); in_chain; in_chain = TREE_CHAIN (in_chain)) { - expr = build_unary_op (input_location, - ADDR_EXPR, TREE_VALUE (in_chain), 1); + expr = build_unary_op (input_location, unqualified_addr_expr (), + TREE_VALUE (in_chain), 1); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } @@ -1903,7 +1912,8 @@ generate_static_references (void) finish_var_decl (decl, expr); CONSTRUCTOR_APPEND_ELT (decls, NULL_TREE, build_unary_op (input_location, - ADDR_EXPR, decl, 1)); + unqualified_addr_expr (), + decl, 1)); } CONSTRUCTOR_APPEND_ELT (decls, NULL_TREE, build_int_cst (NULL_TREE, 0)); @@ -1930,8 +1940,8 @@ init_def_list (tree type) if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE) { loc = DECL_SOURCE_LOCATION (impent->class_decl); - expr = build_unary_op (loc, - ADDR_EXPR, impent->class_decl, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + impent->class_decl, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } } @@ -1942,8 +1952,8 @@ init_def_list (tree type) if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE) { loc = DECL_SOURCE_LOCATION (impent->class_decl); - expr = build_unary_op (loc, - ADDR_EXPR, impent->class_decl, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + impent->class_decl, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } } @@ -1951,7 +1961,8 @@ init_def_list (tree type) loc = UNKNOWN_LOCATION; /* statics = { ..., _OBJC_STATIC_INSTANCES, ... } */ if (static_instances_decl) - expr = build_unary_op (loc, ADDR_EXPR, static_instances_decl, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + static_instances_decl, 0); else expr = integer_zero_node; CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -2022,7 +2033,7 @@ init_objc_symtab (tree type) ltyp = build_pointer_type (objc_selector_type); if (sel_ref_chain) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), UOBJC_SELECTOR_TABLE_decl, 1)); else expr = convert (ltyp, null_pointer_node); diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 5c34fcb05cb..f6783e1c7be 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -912,7 +912,8 @@ next_runtime_abi_01_get_protocol_reference (location_t loc, tree p) if (!PROTOCOL_FORWARD_DECL (p)) PROTOCOL_FORWARD_DECL (p) = next_runtime_abi_01_protocol_decl (p); - expr = build_unary_op (loc, ADDR_EXPR, PROTOCOL_FORWARD_DECL (p), 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + PROTOCOL_FORWARD_DECL (p), 0); return convert (objc_protocol_type, expr); } @@ -1013,11 +1014,13 @@ next_runtime_abi_01_build_const_string_constructor (location_t loc, tree string, /* NeXT: (NSConstantString *) & ((__builtin_ObjCString) { isa, string, length }) */ fields = TYPE_FIELDS (internal_const_str_type); CONSTRUCTOR_APPEND_ELT (v, fields, - build_unary_op (loc, ADDR_EXPR, string_class_decl, 0)); + build_unary_op (loc, unqualified_addr_expr (), + string_class_decl, 0)); fields = DECL_CHAIN (fields); CONSTRUCTOR_APPEND_ELT (v, fields, - build_unary_op (loc, ADDR_EXPR, string, 1)); + build_unary_op (loc, unqualified_addr_expr (), + string, 1)); /* ??? check if this should be long. */ fields = DECL_CHAIN (fields); @@ -1210,7 +1213,8 @@ generate_v1_objc_protocol_extension (tree proto_interface, /* struct objc_method_list *optional_instance_methods; */ if (opt_instance_meth) expr = convert (objc_method_list_ptr, - build_unary_op (loc, ADDR_EXPR, opt_instance_meth, 0)); + build_unary_op (loc, unqualified_addr_expr (), + opt_instance_meth, 0)); else expr = convert (objc_method_list_ptr, null_pointer_node); @@ -1219,7 +1223,8 @@ generate_v1_objc_protocol_extension (tree proto_interface, /* struct objc_method_list *optional_class_methods; */ if (opt_class_meth) expr = convert (objc_method_list_ptr, - build_unary_op (loc, ADDR_EXPR, opt_class_meth, 0)); + build_unary_op (loc, unqualified_addr_expr (), + opt_class_meth, 0)); else expr = convert (objc_method_list_ptr, null_pointer_node); @@ -1227,7 +1232,8 @@ generate_v1_objc_protocol_extension (tree proto_interface, /* struct objc_prop_list *instance_properties; */ if (instance_props) expr = convert (objc_prop_list_ptr, - build_unary_op (loc, ADDR_EXPR, instance_props, 0)); + build_unary_op (loc, unqualified_addr_expr (), + instance_props, 0)); else expr = convert (objc_prop_list_ptr, null_pointer_node); @@ -1404,7 +1410,7 @@ generate_v1_protocol_list (tree i_or_p, tree klass_ctxt) { tree fwref = PROTOCOL_FORWARD_DECL (pval); location_t loc = DECL_SOURCE_LOCATION (fwref) ; - e = build_unary_op (loc, ADDR_EXPR, fwref, 0); + e = build_unary_op (loc, unqualified_addr_expr (), fwref, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, e); } } @@ -1461,7 +1467,8 @@ build_v1_protocol_initializer (tree type, tree protocol_name, tree protocol_list /* Instead of jamming the protocol version number into the isa, we pass either a pointer to the protocol extension - or NULL. */ if (protocol_ext) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, protocol_ext, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + protocol_ext, 0)); else expr = convert (ttyp, null_pointer_node); @@ -1471,13 +1478,15 @@ build_v1_protocol_initializer (tree type, tree protocol_name, tree protocol_list ttyp = objc_method_proto_list_ptr; if (inst_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); if (class_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); @@ -1622,7 +1631,8 @@ generate_v1_protocols (void) build_pointer_type (build_pointer_type (objc_protocol_template)); if (refs_decl) refs_expr = convert (refs_type, - build_unary_op (loc, ADDR_EXPR, refs_decl, 0)); + build_unary_op (loc, unqualified_addr_expr (), + refs_decl, 0)); else refs_expr = convert (refs_type, null_pointer_node); @@ -1704,13 +1714,15 @@ build_v1_category_initializer (tree type, tree cat_name, tree class_name, ltyp = objc_method_list_ptr; if (inst_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); if (class_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1718,7 +1730,8 @@ build_v1_category_initializer (tree type, tree cat_name, tree class_name, /* protocol_list = */ ltyp = build_pointer_type (build_pointer_type (objc_protocol_template)); if (protocol_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, protocol_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + protocol_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1730,7 +1743,8 @@ build_v1_category_initializer (tree type, tree cat_name, tree class_name, CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); ltyp = objc_prop_list_ptr; if (property_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, property_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + property_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1840,7 +1854,8 @@ generate_objc_class_ext (tree property_list, tree context) /* struct _prop_list_t *properties; */ ltyp = objc_prop_list_ptr; if (property_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, property_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + property_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1911,7 +1926,8 @@ build_v1_shared_structure_initializer (tree type, tree isa, tree super, /* objc_ivar_list = */ ltyp = objc_ivar_list_ptr; if (ivar_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, ivar_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + ivar_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1919,7 +1935,8 @@ build_v1_shared_structure_initializer (tree type, tree isa, tree super, /* objc_method_list = */ ltyp = objc_method_list_ptr; if (dispatch_table) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, dispatch_table, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + dispatch_table, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1932,7 +1949,8 @@ build_v1_shared_structure_initializer (tree type, tree isa, tree super, /* protocol_list = */ ltyp = build_pointer_type (build_pointer_type (objc_protocol_template)); if (protocol_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, protocol_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + protocol_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -1946,7 +1964,8 @@ build_v1_shared_structure_initializer (tree type, tree isa, tree super, build_objc_class_ext_template (); ltyp = build_pointer_type (objc_class_ext_template); if (class_ext) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, class_ext, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + class_ext, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -2119,7 +2138,7 @@ generate_v1_class_structs (struct imp_entry *impent) initlist = build_v1_shared_structure_initializer (TREE_TYPE (class_decl), - build_unary_op (loc, ADDR_EXPR, meta_decl, 0), + build_unary_op (loc, unqualified_addr_expr (), meta_decl, 0), super_expr, name_expr, convert (integer_type_node, TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE (impent->imp_template))), @@ -2149,8 +2168,8 @@ init_def_list (tree type) if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE) { loc = DECL_SOURCE_LOCATION (impent->class_decl); - expr = build_unary_op (loc, - ADDR_EXPR, impent->class_decl, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + impent->class_decl, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } } @@ -2161,8 +2180,8 @@ init_def_list (tree type) if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE) { loc = DECL_SOURCE_LOCATION (impent->class_decl); - expr = build_unary_op (loc, - ADDR_EXPR, impent->class_decl, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), + impent->class_decl, 0); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); } } diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index e401906ed01..fc48bde5304 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -1710,7 +1710,7 @@ next_runtime_abi_02_build_objc_method_call (location_t loc, message_func_decl); /* selector = &_msg; */ - selector = build_unary_op (loc, ADDR_EXPR, selector, 0); + selector = build_unary_op (loc, unqualified_addr_expr (), selector, 0); selector = build_c_cast (loc, (super ? objc_v2_super_selector_type : objc_v2_selector_type), @@ -1759,11 +1759,13 @@ next_runtime_abi_02_build_const_string_constructor (location_t loc, tree string, /* NeXT: (NSConstantString *) & ((__builtin_ObjCString) { isa, string, length }) */ fields = TYPE_FIELDS (internal_const_str_type); CONSTRUCTOR_APPEND_ELT (v, fields, - build_unary_op (loc, ADDR_EXPR, string_class_decl, 0)); + build_unary_op (loc, unqualified_addr_expr (), + string_class_decl, 0)); fields = DECL_CHAIN (fields); CONSTRUCTOR_APPEND_ELT (v, fields, - build_unary_op (loc, ADDR_EXPR, string, 1)); + build_unary_op (loc, unqualified_addr_expr (), + string, 1)); /* ??? check if this should be long. */ fields = DECL_CHAIN (fields); @@ -1914,7 +1916,7 @@ void build_v2_message_ref_translation_table (void) initializer = NULL; /* First 'IMP messenger' field... */ - expr = build_unary_op (loc, ADDR_EXPR, ref->func, 0); + expr = build_unary_op (loc, unqualified_addr_expr (), ref->func, 0); expr = convert (objc_v2_imp_type, expr); CONSTRUCTOR_APPEND_ELT (initializer, NULL_TREE, expr); @@ -2195,7 +2197,7 @@ generate_v2_protocol_list (tree i_or_p, tree klass_ctxt) { tree fwref = PROTOCOL_FORWARD_DECL (pval); location_t loc = DECL_SOURCE_LOCATION (fwref) ; - e = build_unary_op (loc, ADDR_EXPR, fwref, 0); + e = build_unary_op (loc, unqualified_addr_expr (), fwref, 0); CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, e); } } @@ -2480,32 +2482,37 @@ build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list ttyp = objc_method_proto_list_ptr; if (inst_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); if (class_methods) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); if (opt_ins_meth) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, opt_ins_meth, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + opt_ins_meth, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); if (opt_cls_meth) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, opt_cls_meth, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + opt_cls_meth, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); ttyp = objc_prop_list_ptr; if (property_list) - expr = convert (ttyp, build_unary_op (loc, ADDR_EXPR, property_list, 0)); + expr = convert (ttyp, build_unary_op (loc, unqualified_addr_expr (), + property_list, 0)); else expr = convert (ttyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr); @@ -2583,7 +2590,8 @@ generate_v2_protocols (void) if (refs_decl) refs_expr = convert (build_pointer_type (objc_v2_protocol_template), - build_unary_op (loc, ADDR_EXPR, refs_decl, 0)); + build_unary_op (loc, unqualified_addr_expr (), + refs_decl, 0)); else refs_expr = build_int_cst (NULL_TREE, 0); @@ -2654,13 +2662,15 @@ build_v2_category_initializer (tree type, tree cat_name, tree class_name, ltyp = objc_method_list_ptr; if (inst_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, inst_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + inst_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); if (class_methods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, class_methods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + class_methods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -2668,14 +2678,16 @@ build_v2_category_initializer (tree type, tree cat_name, tree class_name, /* protocol_list = */ ltyp = build_pointer_type (objc_v2_protocol_template); if (protocol_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, protocol_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + protocol_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); ltyp = objc_prop_list_ptr; if (property_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, property_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + property_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); @@ -2832,7 +2844,7 @@ build_v2_ivar_list_initializer (tree class_name, tree type, tree field_decl) /* Set offset. */ CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE, build_unary_op (input_location, - ADDR_EXPR, + unqualified_addr_expr (), ivar_offset_ref (class_name, field_decl), 0)); @@ -3018,7 +3030,8 @@ build_v2_class_ro_t_initializer (tree type, tree name, /* baseMethods */ ltyp = objc_method_list_ptr; if (baseMethods) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, baseMethods, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + baseMethods, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr); @@ -3027,7 +3040,8 @@ build_v2_class_ro_t_initializer (tree type, tree name, ltyp = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_V2_PROTOCOL_LIST))); if (baseProtocols) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, baseProtocols, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + baseProtocols, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr); @@ -3035,7 +3049,8 @@ build_v2_class_ro_t_initializer (tree type, tree name, /* ivars */ ltyp = objc_v2_ivar_list_ptr; if (ivars) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, ivars, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + ivars, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr); @@ -3048,7 +3063,8 @@ build_v2_class_ro_t_initializer (tree type, tree name, /* property list */ ltyp = objc_prop_list_ptr; if (property_list) - expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, property_list, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + property_list, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr); @@ -3153,8 +3169,10 @@ generate_v2_class_structs (struct imp_entry *impent) else { /* Root class. */ - root_expr = build_unary_op (loc, ADDR_EXPR, metaclass_decl, 0); - metaclass_superclass_expr = build_unary_op (loc, ADDR_EXPR, class_decl, 0); + root_expr = build_unary_op (loc, unqualified_addr_expr (), + metaclass_decl, 0); + metaclass_superclass_expr + = build_unary_op (loc, unqualified_addr_expr (), class_decl, 0); class_superclass_expr = build_int_cst (NULL_TREE, 0); flags |= 0x02; /* RO_ROOT: it is also a root meta class. */ } diff --git a/gcc/objc/objc-runtime-shared-support.c b/gcc/objc/objc-runtime-shared-support.c index 4aecc7f339f..8bf4c6f0f27 100644 --- a/gcc/objc/objc-runtime-shared-support.c +++ b/gcc/objc/objc-runtime-shared-support.c @@ -324,7 +324,8 @@ add_objc_string (tree ident, string_section section) if (TREE_VALUE (*chain) == ident) return convert (string_type_node, build_unary_op (input_location, - ADDR_EXPR, TREE_PURPOSE (*chain), 1)); + unqualified_addr_expr (), + TREE_PURPOSE (*chain), 1)); chain = &TREE_CHAIN (*chain); } @@ -337,7 +338,8 @@ add_objc_string (tree ident, string_section section) *chain = tree_cons (decl, ident, NULL_TREE); return convert (string_type_node, - build_unary_op (input_location, ADDR_EXPR, decl, 1)); + build_unary_op (input_location, unqualified_addr_expr (), + decl, 1)); } /* --- shared metadata routines --- */ @@ -390,7 +392,7 @@ build_dispatch_table_initializer (tree type, tree entries) meth_var_types)); expr = convert (ptr_type_node, - build_unary_op (input_location, ADDR_EXPR, + build_unary_op (input_location, unqualified_addr_expr (), METHOD_DEFINITION (entries), 1)); CONSTRUCTOR_APPEND_ELT (elems, NULL_TREE, expr); @@ -459,8 +461,8 @@ init_module_descriptor (tree type, long vers) ltyp = build_pointer_type (xref_tag (RECORD_TYPE, get_identifier (UTAG_SYMTAB))); if (UOBJC_SYMBOLS_decl) - expr = convert (ltyp, build_unary_op (loc, - ADDR_EXPR, UOBJC_SYMBOLS_decl, 0)); + expr = convert (ltyp, build_unary_op (loc, unqualified_addr_expr (), + UOBJC_SYMBOLS_decl, 0)); else expr = convert (ltyp, null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr); diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index dca2bc12153..24cf6fee70e 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -922,7 +922,7 @@ copy_reference_ops_from_ref (tree ref, vec *result) temp.op0 = build_int_cst (build_pointer_type (TREE_TYPE (ref)), 0); temp.off = 0; result->safe_push (temp); - temp.opcode = ADDR_EXPR; + temp.opcode = unqualified_addr_expr (); temp.op0 = build_addr_expr (TREE_TYPE (temp.op0), ref); temp.type = TREE_TYPE (temp.op0); temp.off = -1; diff --git a/gcc/tree.c b/gcc/tree.c index 40cad1e6c86..fb3734cbb3d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -14195,6 +14195,15 @@ addr_expr_code (const_tree res_type) return ADDR_EXPR; } +/* Return the *ADDR_EXPR code that should be used if the type of the + result is an unqualified pointer, as for ptr_type_node. */ + +tree_code +unqualified_addr_expr () +{ + return CAPABILITY_MODE_P (Pmode) ? CAP_ADDR_EXPR : NONCAP_ADDR_EXPR; +} + /* Return the machine mode of T. For vectors, returns the mode of the inner type. The main use case is to feed the result to HONOR_NANS, avoiding the BLKmode that a direct TYPE_MODE (T) might return. */ diff --git a/gcc/tree.h b/gcc/tree.h index 89bda180a87..477e68e488a 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2035,6 +2035,7 @@ extern tree build_replace_address_value_loc (location_t, tree, tree); extern tree build_cap_global_data_get_loc (location_t, tree); extern bool valid_capability_code_p (tree_code); extern tree_code addr_expr_code (const_tree); +extern tree_code unqualified_addr_expr (); extern scalar_addr_mode pointer_address_mode (const_tree); extern scalar_addr_mode unqualified_address_mode (const_tree); diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc index a83bfeb0a16..0628629ee45 100644 --- a/libcc1/libcp1plugin.cc +++ b/libcc1/libcp1plugin.cc @@ -2715,7 +2715,7 @@ plugin_build_unary_expr (cc1_plugin::connection *self, opcode = NEGATE_EXPR; break; case CHARS2 ('a', 'd'): // operator & (unary) - opcode = ADDR_EXPR; + opcode = unqualified_addr_expr (); break; case CHARS2 ('d', 'e'): // operator * (unary) opcode = INDIRECT_REF;