From 0fb57034770aa20adced4d176f34ca611c2945bf Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 5 Dec 2021 17:11:12 +0100 Subject: d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b. D front-end changes: - Import dmd v2.098.0 - New ImportC module for compiling preprocessed C11 code into D. - New -ftransition=in switch. - Improved handling of new 'noreturn' type. Druntime changes: - Import druntime v2.098.0 - Fix broken import in core.sys.linux.perf_event module (PR103558). Phobos changes: - Import phobos v2.098.0 - All sources are now compiled with -fpreview=fieldwise. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 568496d5b. * Make-lang.in (D_FRONTEND_OBJS): Add d/common-file.o, d/common-outbuffer.o, d/common-string.o, d/file_manager.o, d/importc.o. Remove d/root-outbuffer.o. (d/common-%.o): New recipe. * d-builtins.cc (build_frontend_type): Update for new front-end interface. (d_build_d_type_nodes): Set noreturn_type_node. * d-codegen.cc (d_build_call): Don't call function if one of the arguments is type 'noreturn'. (build_vthis_function): Propagate TYPE_QUAL_VOLATILE from original function type. * d-frontend.cc (eval_builtin): Update signature. (getTypeInfoType): Likewise. (toObjFile): New function. * d-gimplify.cc (d_gimplify_call_expr): Always evaluate arguments from left to right. * d-lang.cc (d_handle_option): Handle OPT_ftransition_in. (d_parse_file): Don't generate D main if it is declared in user code. * d-tree.h (CALL_EXPR_ARGS_ORDERED): Remove. (enum d_tree_index): Add DTI_BOTTOM_TYPE. (noreturn_type_node): New. * decl.cc (apply_pragma_crt): Remove. (DeclVisitor::visit): Update for new front-end interface. (DeclVisitor::visit (PragmaDeclaration *)): Don't handle crt_constructor and crt_destructor pragmas. (DeclVisitor::visit (VarDeclaration *)): Don't generate declarations of type 'noreturn'. (DeclVisitor::visit (FuncDeclaration *)): Stop adding parameters when 'noreturn' type has been encountered. (get_symbol_decl): Set DECL_STATIC_CONSTRUCTOR and DECL_STATIC_DESTRUCTOR on decl node if requested. (aggregate_initializer_decl): Update for new front-end interface. * expr.cc (ExprVisitor::visit (CallExp *)): Always use the 'this' object as the result of calling any constructor function. (ExprVisitor::visit): Update for new front-end interface. * gdc.texi (Runtime Options): Document -fmain and -ftransition=in. * lang.opt (ftransition=in): New option. * modules.cc (get_internal_fn): Update for new front-end interface. * types.cc (TypeVisitor::visit): Likewise. (TypeVisitor::visit (TypeNoreturn *)): Return noreturn_type_node. (TypeVisitor::visit (TypeFunction *)): Stop adding parameters when 'notreturn' type has been encountered. Qualify function types that return 'noreturn' as TYPE_QUAL_VOLATILE. libphobos/ChangeLog: PR d/103558 * libdruntime/MERGE: Merge upstream druntime 178c44ff. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/syscalls.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/pthread_np.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 574bf883b. * src/Makefile.am (D_EXTRA_DFLAGS): Add -fpreview=fieldwise. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/assert_fail.d: Update test. * testsuite/libphobos.betterc/test22336.d: New test. --- gcc/d/d-gimplify.cc | 65 +++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 35 deletions(-) (limited to 'gcc/d/d-gimplify.cc') diff --git a/gcc/d/d-gimplify.cc b/gcc/d/d-gimplify.cc index 0fa7442..e366881 100644 --- a/gcc/d/d-gimplify.cc +++ b/gcc/d/d-gimplify.cc @@ -120,52 +120,47 @@ d_gimplify_addr_expr (tree *expr_p) static gimplify_status d_gimplify_call_expr (tree *expr_p, gimple_seq *pre_p) { - if (CALL_EXPR_ARGS_ORDERED (*expr_p)) - { - /* Strictly evaluate all arguments from left to right. */ - int nargs = call_expr_nargs (*expr_p); - location_t loc = EXPR_LOC_OR_LOC (*expr_p, input_location); + /* Strictly evaluate all arguments from left to right. */ + int nargs = call_expr_nargs (*expr_p); + location_t loc = EXPR_LOC_OR_LOC (*expr_p, input_location); - /* No need to enforce evaluation order if only one argument. */ - if (nargs < 2) - return GS_UNHANDLED; + /* No need to enforce evaluation order if only one argument. */ + if (nargs < 2) + return GS_UNHANDLED; - /* Or if all arguments are already free of side-effects. */ - bool has_side_effects = false; - for (int i = 0; i < nargs; i++) + /* Or if all arguments are already free of side-effects. */ + bool has_side_effects = false; + for (int i = 0; i < nargs; i++) + { + if (TREE_SIDE_EFFECTS (CALL_EXPR_ARG (*expr_p, i))) { - if (TREE_SIDE_EFFECTS (CALL_EXPR_ARG (*expr_p, i))) - { - has_side_effects = true; - break; - } + has_side_effects = true; + break; } + } - if (!has_side_effects) - return GS_UNHANDLED; - - /* Leave the last argument for gimplify_call_expr. */ - for (int i = 0; i < nargs - 1; i++) - { - tree new_arg = CALL_EXPR_ARG (*expr_p, i); + if (!has_side_effects) + return GS_UNHANDLED; - /* If argument has a side-effect, gimplify_arg will handle it. */ - if (gimplify_arg (&new_arg, pre_p, loc) == GS_ERROR) - return GS_ERROR; + /* Leave the last argument for gimplify_call_expr. */ + for (int i = 0; i < nargs - 1; i++) + { + tree new_arg = CALL_EXPR_ARG (*expr_p, i); - /* Even if an argument itself doesn't have any side-effects, it - might be altered by another argument in the list. */ - if (new_arg == CALL_EXPR_ARG (*expr_p, i) - && !really_constant_p (new_arg)) - new_arg = get_formal_tmp_var (new_arg, pre_p); + /* If argument has a side-effect, gimplify_arg will handle it. */ + if (gimplify_arg (&new_arg, pre_p, loc) == GS_ERROR) + return GS_ERROR; - CALL_EXPR_ARG (*expr_p, i) = new_arg; - } + /* Even if an argument itself doesn't have any side-effects, it + might be altered by another argument in the list. */ + if (new_arg == CALL_EXPR_ARG (*expr_p, i) + && !really_constant_p (new_arg)) + new_arg = get_formal_tmp_var (new_arg, pre_p); - return GS_OK; + CALL_EXPR_ARG (*expr_p, i) = new_arg; } - return GS_UNHANDLED; + return GS_OK; } /* Gimplify an UNSIGNED_RSHIFT_EXPR node. */ -- cgit v1.1