From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id EE0BF3858CDA; Mon, 22 Apr 2024 17:56:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE0BF3858CDA 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 EE0BF3858CDA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::429 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713808595; cv=none; b=jSaIfpKqMpLltjnscLTWk7seOIzQDjprpz7qwPX8dINQGoj7YsbiOAlqx3VPnBzfUbCLm2G8OksUxMiOID/tboAcRBb7c0Xln8Y7RBVIsvz4xw/V/yfbJAmB9tqHcb1UJgRz4X9XfgM2LMh4rR+QCxzfWn/kE8W1BCdGwjW8T5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713808595; c=relaxed/simple; bh=EUhG6BLC1Pfg/Sf/njaRr9O88Nx+T7LRiF3L5ASVU+g=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=HYby2K9fC/R5Xwfiy9omOcEP78Luy3Z490LfIeuo6lTXHOgoibC3Xw8Q/0lHDYyAjs/D3+FlHztPaSMd8t5wZHz52gpfO5OjDv+/rqBV06ditM3JjBvlHJTzoBktSj59tj3C7lMwfIiQ2MKcuuJNM1xpT8GZJnjNL0YVXOCgXiE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-343d2b20c4bso3809097f8f.2; Mon, 22 Apr 2024 10:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713808592; x=1714413392; 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=hPDoPkvz3gwhC2zUXfhDELWfoE4JUQLkltEMMokOjCY=; b=BqO27muHrnr7+L7zB+CG/6PniOFwbjacDpKDD/7dk7STY4XYM9e9Azn/5XTPF2p3Q/ nGbtKcYBy+aTmm0bdAAX6rOmeijGMxTMvleJrOma7D8wm+2tNnBfxOyRKpQbmu4RfWmb 3hqauQD+YmWVZvXJteKfRPaPcvA32oXi9yDkI5r17wTs6rmcv9WvpbypmrjNUQXn4uH6 d2qzOGaJb/xT1oOSDOREVbsIyC3KlXxc+X+Aufs1sWhwAiEyYAERULLc9AqBEIlOwmWd ra7DOODoHqYb9sWlTMZ9OQiaaHCck1Vz/PY/pzeYtVeDOS3Pt1Oza+GdRWFotHayvvnH QZlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713808592; x=1714413392; 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=hPDoPkvz3gwhC2zUXfhDELWfoE4JUQLkltEMMokOjCY=; b=ttaRo/Y5bzV8f2RznBXd8IdE51TJO5Zw/qUp6InEda6hT3I2eYbeET7pmnawvSxTm8 BNHYDEEB7KgjdfMf4onICdYwM+3xlMCFpDSjPy2pJMFdVYBw/IDUi+NquyOjaJqOmBA1 tBVJGUkfMxAUEg7llKX5hEcfIVhWEDQHXgrV8IMmkmBuEASyWPJuHwW0WcKtBnM6LyZe jZnybgE8f/cMQ3n157m3W811H8jE1uGmlWB16GF+Z6WotCV+tHLq2mc7G0imWP80IXM9 N7UbJUNi+H0Uuq+MPttjXGl0dUQ7hWgCJ8QPO5c0xuxZt8Zi/CiKBH5PUOVvejzQp+WA 1/tQ== X-Forwarded-Encrypted: i=1; AJvYcCV7WgV6YsUGgfkIF0hZeMgHSOc8XuliN8diqHH2FVHwl1811NGRNCmi5RVwzswhyursTUEojU9Qtj3mydizNtq68ZlYEWkhKdP3t3EjSjOJ2YyQwFY8RRQ2 X-Gm-Message-State: AOJu0YwKzjYOcr3Qh5pjeAdlFe8sG6RYcjGwbrw5x9345Ufi3X66H/QL WdmBD144Vqv89R8iKLOUFEIfHEB6kpoVhR9UWlb4Dkt29Xic/wKj9t2IiC17RFDpGq7erteu4rP eO8sBHM7GzQADzUe6WwrJ8TWcqu8= X-Google-Smtp-Source: AGHT+IEbMrKU1D1UyihxYXS4COY1XQ8aE5YbdkeMycb5ANTmmcNpxDQZX6daNB7yRG+uPyRenspnbJDhbwFPnnV0elY= X-Received: by 2002:adf:cf06:0:b0:34b:147f:df67 with SMTP id o6-20020adfcf06000000b0034b147fdf67mr2615812wrj.53.1713808592393; Mon, 22 Apr 2024 10:56:32 -0700 (PDT) MIME-Version: 1.0 References: <7346764f-bf4d-4075-8191-671201f6f8da@embecosm.com> <1c705ee1-ada7-4a93-9e8a-c17b68e66331@zoho.com> In-Reply-To: <1c705ee1-ada7-4a93-9e8a-c17b68e66331@zoho.com> From: Guillaume Gomez Date: Mon, 22 Apr 2024 19:56:21 +0200 Message-ID: Subject: Re: [PATCH] Add rvalue::get_name method (and its C equivalent) To: Antoni Boucher Cc: Arthur Cohen , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org, David Malcolm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 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: `param` is also inheriting from `lvalue`. I don't think adding this check is a good idea because it will not evolve nicely if more changes are done in libgccjit. Le lun. 22 avr. 2024 =C3=A0 17:19, Antoni Boucher a =C3= =A9crit : > > For your new API endpoint, please add a check like: > > RETURN_IF_FAIL (lvalue->is_global () || lvalue->is_local (), > NULL, > NULL, > "lvalue should be a variable"); > > > Le 2024-04-22 =C3=A0 09 h 16, Guillaume Gomez a =C3=A9crit : > > Good point! > > > > New patch attached. > > > > Le lun. 22 avr. 2024 =C3=A0 15:13, Antoni Boucher a = =C3=A9crit : > >> > >> Please move the function to be on lvalue since there are no rvalue typ= es > >> that are not lvalues that have a name. > >> > >> Le 2024-04-22 =C3=A0 09 h 04, Guillaume Gomez a =C3=A9crit : > >>> Hey Arthur :) > >>> > >>>> Is there any reason for that getter to return a mutable pointer to t= he > >>>> name? Would something like this work instead if you're just looking = at > >>>> getting the name? > >>>> > >>>> + virtual string * get_name () const { return NULL; } > >>>> > >>>> With of course adequate modifications to the inheriting classes. > >>> > >>> Good catch, thanks! > >>> > >>> Updated the patch and attached the new version to this email. > >>> > >>> Cordially. > >>> > >>> Le lun. 22 avr. 2024 =C3=A0 11:51, Arthur Cohen a =C3=A9crit : > >>>> > >>>> Hey Guillaume :) > >>>> > >>>> On 4/20/24 01:05, Guillaume Gomez wrote: > >>>>> Hi, > >>>>> > >>>>> I just encountered the need to retrieve the name of an `rvalue` (if > >>>>> there is one) while working on the Rust GCC backend. > >>>>> > >>>>> This patch adds a getter to retrieve the information. > >>>>> > >>>>> Cordially. > >>>> > >>>>> virtual bool get_wide_int (wide_int *) const { return false; } > >>>>> > >>>>> + virtual string * get_name () { return NULL; } > >>>>> + > >>>>> private: > >>>>> virtual enum precedence get_precedence () const =3D 0; > >>>> > >>>> Is there any reason for that getter to return a mutable pointer to t= he > >>>> name? Would something like this work instead if you're just looking = at > >>>> getting the name? > >>>> > >>>> + virtual string * get_name () const { return NULL; } > >>>> > >>>> With of course adequate modifications to the inheriting classes. > >>>> > >>>> Best, > >>>> > >>>> Arthur