From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id E0ACA384772B for ; Fri, 5 Apr 2024 12:47:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E0ACA384772B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E0ACA384772B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712321224; cv=none; b=DjX16T1kttslyCHZHvwIAaUAQMHll3SNS8b47RkPIb8qbnlGHKUD+OMDEnw8pS8ULJLRNJtCGNegXytF/aCg5VtXsSiHWpVm6Pf2zAZ/TfZviYVwZfG9P6YB8eQYEvcq77SjX4fO7XJ0kYUjD/xitKVHCOTcgAkyYa7OeX0ScWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712321224; c=relaxed/simple; bh=eJo64C2uDBERYInVVi2eCZBmK7JpbZRS1q3vdzjpyuA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=VsN7nw200ZWlEGLfMaf58C/mW56ndUV8FjqSPTOiFhMB42EFggwEsyU3EHMJYM8Ueg0oy2yQDFfWWoglfW0Kilz1C0OZbXzKQnjPym82zJnfuSK2y22t9khU/rMsCS4ZUad+sRiaLpgkBuVoN3R8yZUh9qjfUEL5icatig/IZ0Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-516c403c2e4so2044887e87.0 for ; Fri, 05 Apr 2024 05:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712321219; x=1712926019; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Dtv0+QqCuRSevyYNezbUhSkGM4gLMc2tO60E6zzwKTo=; b=l1wdh8wdviSxiGlPawSfeVg/nMtqttj2yhLNyFKw8aeiD9SzMyIzELYvq2CqirwbtM yAvuwr0o0qPWcrdQVatJ0+pXsXTMtbWszSJ22v8lWUcnBRkumnhHTdeVeyk8dn/mlGuQ 1N/vsbsj1EHSd0ezTwR09KP3cgMEzvBterAb8rfu8ALyaBwXcZ9ds4Hsrkk74R8CaHvI qDlgi4vv1L0fIBJQBVvuyTq3lLmeyFVyyjBnjsD/kS1K/OBqLPE2hDLn+Cc7f5Z2MtRX d/LPm7kQWJvP0Vh7QcvyMHAC5jKVtbsRZUh7Qedzgwe2G4kuC0CrOqp5uQxRF3ZcmQbX foEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712321219; x=1712926019; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Dtv0+QqCuRSevyYNezbUhSkGM4gLMc2tO60E6zzwKTo=; b=NRuC3YNP/j+zrFwOOY628/rempLPI39uBb6QhysgmfUjZVJN2Y29IdErdKZmkZ+Wx4 cwaFhB1gNFqnztOy5zMFWLlTth/84DOlo2fYUoeuttw4q9g58Bhw+tbEBErydqfckx0S AMml7Q8ADSEonyMEISbKPGtE1mfmhtpnseVRLJtlPfySUnaWCl9J01rHjJNx9G0bw5lY WAuOChA+xqvWiq/PuwNrf+EYxC9sV1fhubAy+GpbktdozWSPsh41JOfH41XMqHeSp/WH kQGcpY1Ix3dvNOI2CFgyb1kP3FZlUYG9NgnVT4aHdWNqHfLVnKYhGheaIWZpbV/2LD6H jMyQ== X-Gm-Message-State: AOJu0YxaqmFIyBcFONNklT+FVHUmuy1VdItZG3SR9SuU+JtSC8RjC6a0 FTJviyoOGAl/3wgjiLgFqPqksTa/4bkZJ/vypo3f5hast20KY9EmtRUNqOvy3Ocon6Nfpk3RjTL ZdOSlFEf9U4bmnwbwEnbQLLExW7U= X-Google-Smtp-Source: AGHT+IHg4cpd1QcXDKc8gJHxwjc7ffDc/6aBFPr91JVa00b8WNOYrZeh0Rg5hhFm4v2vxfPEOypd/qVhNLo1enaaigg= X-Received: by 2002:a19:4310:0:b0:513:c5d1:a537 with SMTP id q16-20020a194310000000b00513c5d1a537mr573942lfa.10.1712321219098; Fri, 05 Apr 2024 05:46:59 -0700 (PDT) MIME-Version: 1.0 References: <7b63c4ff-b32e-44ad-9b25-3f8f2d138056@irisa.fr> In-Reply-To: <7b63c4ff-b32e-44ad-9b25-3f8f2d138056@irisa.fr> From: Richard Biener Date: Fri, 5 Apr 2024 14:46:48 +0200 Message-ID: Subject: Re: [gimple-ssa] result_decl and ssa_name To: Pierrick Philippe Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: On Fri, Apr 5, 2024 at 1:59=E2=80=AFPM Pierrick Philippe wrote: > > Hi all, > > I do have a question regarding ssa_name and result_decl. > > For example on the following gimple function: > > int f () > { > int x; > int D.2747; > int _2; > > : > x_1 =3D 42; > _2 =3D x_1; > > : > : > return _2; > > } > > On the above example, using the macro SSA_NAME_VAR() on _2 does not > yield anything usable. > Neither to call ssa_default_def() on the result of the result_decl > obtain through macro DECL_RESULT(). > > Is there a way to get the ssa_name corresponding to the result_decl of a > function obtained through the use of macro DECL_RESULT() on a fn_decl? > And/or the other way around? I.e., from the returned ssa_name of a > function to the result_decl of that function? > > I totally might be missing something here, but I cannot figure out what. DECL_RESULT isn't always used (as in your example). Not all SSA names have corresponding declarations, we have "anonymous" SSA names which have a NULL_TREE SSA_NAME_VAR (such as the _2 in your example). What do you try to find in the end? If you want to find all returns you ca= n walk predecessors of EXIT_BLOCK and look at their last stmt whether they are greturn statements. Richard. > Thanks for your time, > > Pierrick >