From patchwork Sat May 16 09:41:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erick Ochoa X-Patchwork-Id: 1291885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=theobroma-systems.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49PL0D5b9kz9sTD for ; Sat, 16 May 2020 19:42:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D63B2386F80C; Sat, 16 May 2020 09:41:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by sourceware.org (Postfix) with ESMTPS id 1C69C3851C2D for ; Sat, 16 May 2020 09:41:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1C69C3851C2D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=theobroma-systems.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=erick.ochoa@theobroma-systems.com Received: from mail.linser.at ([80.109.168.170]:62664 helo=Martins-MacBook-Air.local) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1jZtKK-0006Wy-Fx; Sat, 16 May 2020 11:41:52 +0200 To: gcc-patches@gcc.gnu.org From: Erick Ochoa Subject: [PATCH] Adds wrapper for gimple_return_retval to accept gimple* Message-ID: Date: Sat, 16 May 2020 11:41:51 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Tomsich , =?utf-8?q?Chris?= =?utf-8?q?toph_M=C3=BCllner?= Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Adds wrapper for gimple_return_retval to accept gimple* Most functions interact with GIMPLE IL using arguments of type gimple*. Functions interacting with GIMPLE_RETURN instructions still use greturn* types as arguments. This patch adds wrappers around functions taking greturn* as inputs. The wrapper takes gimple* as arguments. ChangeLog: 2020-05-16 Erick Ochoa * gcc/gimple.h (gimple_return_retval): New function (gimple_return_retval_ptr): same (gimple_return_set_retval): same * gcc/gimple.texi (gimple_return_retval): Fix documentation (gimple_return_retval_ptr): same (gimple_return_set_retval): same diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi index 5e0fc2e0dc5..d4a73b8397c 100644 --- a/gcc/doc/gimple.texi +++ b/gcc/doc/gimple.texi @@ -2234,11 +2234,15 @@ Set @code{REGION} to be the region number for @code{GIMPLE_RESX} @code{G}. Build a @code{GIMPLE_RETURN} statement whose return value is retval. @end deftypefn -@deftypefn {GIMPLE function} tree gimple_return_retval (const greturn *g) +@deftypefn {GIMPLE function} tree gimple_return_retval (const gimple *g) Return the return value for @code{GIMPLE_RETURN} @code{G}. @end deftypefn -@deftypefn {GIMPLE function} void gimple_return_set_retval (greturn *g, @ +@deftypefn {GIMPLE function} {tree *} gimple_return_retval_ptr (gimple *g) +Return the return value for @code{GIMPLE_RETURN} @code{G}. +@end deftypefn + +@deftypefn {GIMPLE function} void gimple_return_set_retval (gimple *g, @ tree retval) Set @code{RETVAL} to be the return value for @code{GIMPLE_RETURN} @code{G}. @end deftypefn diff --git a/gcc/gimple.h b/gcc/gimple.h index ca7fec6247e..730803f0924 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6502,6 +6502,14 @@ gimple_return_retval_ptr (greturn *gs) return &gs->op[0]; } +static inline tree * +gimple_return_retval_ptr (gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + greturn *gr = dyn_cast (gs); + return gimple_return_retval_ptr (gr); +} + /* Return the return value for GIMPLE_RETURN GS. */ static inline tree @@ -6510,6 +6518,15 @@ gimple_return_retval (const greturn *gs) return gs->op[0]; } +static inline tree +gimple_return_retval (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + const greturn *gr = dyn_cast (gs); + return gimple_return_retval (gr); +} + + /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ @@ -6519,6 +6536,14 @@ gimple_return_set_retval (greturn *gs, tree retval) gs->op[0] = retval; } +static inline void +gimple_return_set_retval (gimple *gs, tree retval) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + greturn *gr = dyn_cast (gs); + gimple_return_set_retval (gr, retval); +} + /* Returns true when the gimple statement STMT is any of the OMP types. */