From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 29EF73889E26 for ; Tue, 21 Feb 2023 12:04:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29EF73889E26 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x430.google.com with SMTP id t13so4091936wrv.13 for ; Tue, 21 Feb 2023 04:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=O+eVsLskO//1T8m9ezVwPdHxARyYtOAjaAGX8aDDa28=; b=L78VhTBP6jzDXbqD4gKNh1d+oal3tfy5on7GMPV2MdnNsqgW0UKFoHNbd7P6nej8Q+ wFCGbliI6zWh+3j+b4Qv853FMiGU7duXkgknu2MHxRxiwnf0K1JMEaJPOD72f2CKT1Jz dxhIwSFp+YtftYyRNAGfB8Tavdq6pZ9eLC6aIHy6qNcjrmnWqbcDG0xb0nVcW6s3ivrm M5BrYS+P4SlHqDobTRUWlrOg7K63kgq7aIKxsv8Jae1JBdMR8Ol+ocxRy7aXpid1/8ud 9KOgUdebegESb9Qbrv9Ay+EKirAmwusrp2Y8hqtA18ZFDuPHa8PRHwPD00TGD1hNlG2i h0zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O+eVsLskO//1T8m9ezVwPdHxARyYtOAjaAGX8aDDa28=; b=Tga2xnWTOY+zQiwFajaurb9am1kG1BP17OZD5nherFET3zWiIL2NcYbnGvKkJ/kdiU UHs6y/pM5IgImhxdrYOQMmqVFnZZVReybRmMpoJ651jHD40AuNPOzsPJeZG75bN+6g36 e5Xc1BNam6iyQFAOODPvM3dBBPy0fMfqhsDbi4qsB0AESSr8XwELmV2bqWDEvuURAgof pKapYwEJbzYGJoeOuVZb7So7h1B2Vr+n62D9ysi94I0gyIjVl3pn+86PYi6so/Up3Nyf 3rv3zEbIXDwNzwiFYO9t9WIFELDNi+h8KL0eoeRiVZllT23q888hWULhRBRGXBh827HT QEeQ== X-Gm-Message-State: AO0yUKU3/st5VUqEI/r/yVKvyIZfXxWe2Mj77ut4C8Ex5D4kLgWoXjvu 9GEYUTjXhXyo8WarDmu2HS41 X-Google-Smtp-Source: AK7set+Mu1u/GiBTLr6d7+8G1YB7uTUAc0EU46m9gz6aONe6UZ3UzuE0JZ3JJHgoJj3fl74m3J5E3Q== X-Received: by 2002:a5d:5985:0:b0:2c5:7dd2:319f with SMTP id n5-20020a5d5985000000b002c57dd2319fmr3893874wri.32.1676981083747; Tue, 21 Feb 2023 04:04:43 -0800 (PST) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id c15-20020adffb4f000000b002c55b0e6ef1sm5013811wrs.4.2023.02.21.04.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 04:04:43 -0800 (PST) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Arthur Cohen Subject: [committed 102/103] gccrs: const evaluator: Remove get_nth_callarg Date: Tue, 21 Feb 2023 13:02:32 +0100 Message-Id: <20230221120230.596966-103-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230221120230.596966-1-arthur.cohen@embecosm.com> References: <20230221120230.596966-1-arthur.cohen@embecosm.com> Reply-To: arthur.cohen@embecosm.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Arthur Cohen We only used one path of the C++ folder's get_nth_callarg function: CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to CALL_EXPR_ARG gcc/rust/ChangeLog: * backend/rust-constexpr.cc (get_nth_callarg): Remove function. (rs_bind_parameters_in_call): Use CALL_EXPR_ARG instead. (potential_constant_expression_1): Likewise. --- gcc/rust/backend/rust-constexpr.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc index 912d73b5d7c..4e581a3f2cf 100644 --- a/gcc/rust/backend/rust-constexpr.cc +++ b/gcc/rust/backend/rust-constexpr.cc @@ -81,8 +81,6 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, bool potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, tsubst_flags_t flags); -inline tree -get_nth_callarg (tree t, int n); tree unshare_constructor (tree t MEM_STAT_DECL); void @@ -3081,7 +3079,7 @@ rs_bind_parameters_in_call (const constexpr_ctx *ctx, tree t, tree fun, tree type = parms ? TREE_TYPE (parms) : void_type_node; if (parms && DECL_BY_REFERENCE (parms)) type = TREE_TYPE (type); - x = get_nth_callarg (t, i); + x = CALL_EXPR_ARG (t, i); if (TREE_ADDRESSABLE (type)) /* Undo convert_for_arg_passing work here. */ @@ -4080,17 +4078,6 @@ maybe_constexpr_fn (tree t) return (DECL_DECLARED_CONSTEXPR_P (t)); } -// forked from gcc/cp/constexpr.cc get_nth_callarg - -/* We have an expression tree T that represents a call, either CALL_EXPR. - Return the Nth argument. */ - -inline tree -get_nth_callarg (tree t, int n) -{ - return CALL_EXPR_ARG (t, n); -} - // forked from gcc/cp/constexpr.cc var_in_maybe_constexpr_fn /* True if T was declared in a function that might be constexpr: either a @@ -5808,7 +5795,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) && !DECL_CONSTRUCTOR_P (fun)) { - tree x = get_nth_callarg (t, 0); + tree x = CALL_EXPR_ARG (t, 0); /* Don't require an immediately constant value, as constexpr substitution might not use the value. */ @@ -5837,7 +5824,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, } for (; i < nargs; ++i) { - tree x = get_nth_callarg (t, i); + tree x = CALL_EXPR_ARG (t, i); /* In a template, reference arguments haven't been converted to REFERENCE_TYPE and we might not even know if the parameter is a reference, so accept lvalue constants too. */ -- 2.39.1