From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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* Cc: =?UTF-8?Q?Christoph_M=c3=bcllner?= , Philipp Tomsich 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-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , X-List-Received-Date: Sat, 16 May 2020 09:41:56 -0000 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. */