From patchwork Wed Jan 24 19:30:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1890401 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=eiI9Y4W8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKvJh21Jtz23dq for ; Thu, 25 Jan 2024 06:33:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 318FC3857349 for ; Wed, 24 Jan 2024 19:33:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7C0DC3858420 for ; Wed, 24 Jan 2024 19:31:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C0DC3858420 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7C0DC3858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706124719; cv=none; b=RBoQZNn6Sowb2mhThXrl7mNWQLQ4xs1Fa1f8tNNGdKk7Nx8ZRnt7zckGBcpCoCw0FPlOqRh0YDKa+Z0rMvGLUZ52P2iDyE3iZNQk+yDnRuABKKWWirODqLVtPMJA+2NZw6Up+nz5VkZSX7MYJ4aUyDNarqgeFpEDPPww96+E2gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706124719; c=relaxed/simple; bh=nTISuNEyjoXs+sCdvH4czB9Bp1Fhbe519Jqk0/temj8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=pk+kcJ/j0d8Vobomwb+xegMu9CTU0MPPIRjsumYCvCwrMwodUHZSh7/a8vx5yzZO6+O79E7MYSlfXmaov8x7t96nj/lJWFHPBc7Ah1wEVwiuZasy3fvZTtvt5h43elOhFgx2K0kRg7HCLvnhFI05a0zCKzn+R5es4fXiRzt2SgM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mgamail.intel.com ([192.55.52.88]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rSiyX-0007Ze-Iv for gcc-patches@gnu.org; Wed, 24 Jan 2024 14:31:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706124713; x=1737660713; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nTISuNEyjoXs+sCdvH4czB9Bp1Fhbe519Jqk0/temj8=; b=eiI9Y4W8THwNPfjc05ILwwVTWmtv0RrAIC+tyxaXaAkPnlDPn/PnRjV9 WZpjZHnotq8WbLAuo5FBAtfTolS25hlpvze/qT4/Uq6UJACnB74pPTSAG w+mspR6U9i0bh/OUIalqxUlFBFA1H2USS+UMQg7kdhUBTmC4giqrtekV4 8TT2GilaDAdixxYiBLks/eKhcIoG+LeiSAVF60e0uFrD1zka2eoAiejED k1nvvidAv2BrQPBg4+M5Om6a+beKZ4e4ggovC13bj/hSDMXZI/f1b/xbd i2SOFW4B62breAkjD29L4j770o18ph1SBJYGDSbx+TmoTD5PyHcG6fZFE w==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="433111211" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="433111211" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 11:31:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="856810885" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="856810885" Received: from tassilo.jf.intel.com ([10.54.38.190]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2024 11:31:43 -0800 From: Andi Kleen To: gcc-patches@gnu.org Cc: Andi Kleen Subject: [PATCH v2 5/5] Add documentation for musttail attribute Date: Wed, 24 Jan 2024 11:30:45 -0800 Message-ID: <20240124193134.622934-6-ak@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124193134.622934-1-ak@linux.intel.com> References: <20240124193134.622934-1-ak@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=192.55.52.88; envelope-from=ak@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -57 X-Spam_score: -5.8 X-Spam_bar: ----- X-Spam_report: (-5.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org --- gcc/doc/extend.texi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0bc586d120e7..c68d32bed8de 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -9867,6 +9867,22 @@ foo (int x, int y) @code{y} is not actually incremented and the compiler can but does not have to optimize it to just @code{return 42 + 42;}. +@cindex @code{musttail} statement attribute +@item musttail + +The @code{gnu::musttail} or @code{clang::hottail} attribute +can be applied to a return statement that returns the value +of a call to indicate that the call must be a tail call +that does not allocate extra stack space. + +@smallexample +[[gnu::musttail]] return foo(); +@end smallexample + +If the compiler cannot generate a tail call it will generate +an error. Tail calls generally require enabling optimization. +On some targets they may not be supported. + @end table @node Attribute Syntax