From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id A1B9C3858C83 for ; Mon, 7 Feb 2022 09:17:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A1B9C3858C83 Received: by mail-ej1-x62e.google.com with SMTP id k25so39730709ejp.5 for ; Mon, 07 Feb 2022 01:17:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tym1ds8C8p/nPAJFBseQSAy1uSzcTn9Ex0CMef1USNs=; b=FY3LtaY0plJJHGfIDCO6Z7vlYTfYke4kgzGeewkKGSiweCY83ZsrXzW2IiwHDHLdqa FI25HxQSQE08g7vLapTLE2x+hQ0AFp4LrpTmEKkBKQ63UOcvSkr4Jkt0wKiIScaoGrmW mNkkPHI2dqWKsxj/88MhM4FNNSCIkauOlhaHRFlP4o9HB48Snj/+nejglIrctftOjcm2 LjuG1YpHx++OQrp55iDfYKVb05M0k1ruNW4pK1ZWgKVZhUCUG4mM7yJt7xPVQ9/GRKBu sP/0XXwnN5gsCdRSb91tNBHI/pT4fse1FPUFX4l/2jb9g/WUliMbAgDA7dPkMVu/hu4G WW9g== X-Gm-Message-State: AOAM532PaqinzNSpOlxToTP+yyKq6DT7kuuFFKZuQbPMTst17+ND2s+S 4IxXvdC37ms60iRRoPp8/Laxd4FiZ9d1uNzDJKI= X-Google-Smtp-Source: ABdhPJylV0+LcKpWcqulJOUUXrhU8tDhU2rccxaYd7uW+ZyspZEqgohG+m0/yZyl/UruoF5yGMEJc/LsfYuGMypVrFs= X-Received: by 2002:a17:907:1627:: with SMTP id hb39mr9485057ejc.407.1644225465518; Mon, 07 Feb 2022 01:17:45 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 7 Feb 2022 10:17:34 +0100 Message-ID: Subject: Re: Query regarding generating NOTE instruction at GIMPLE level To: Shubham Narlawar Cc: GCC Development Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2022 09:17:48 -0000 On Sun, Feb 6, 2022 at 8:42 PM Shubham Narlawar via Gcc wrote: > > Hello, > > Is it possible to generate a NOTE instruction at GIMPLE level? > > My use case scenario is as below - > I want to create a note for __builtin_xyz(_x) such that there is a > placeholder just before function call and in RTL pass, I want to > modify/assign register number at this placeholder location. > > _x = (unsigned int) _y; > __builtin_xyz(_x); //_x is constant expression > > For above builtin function call, I want to insert a note just before the > function call. I tried generating GIMPLE_NOP instruction as below - > > _x = (unsigned int) _y; > GIMPLE_NOP > __builtin_xyz(_x); > > But as per my understanding, a NOTE instruction behaves similar to > GIMPLE_NOP that is to create a placeholder for some computation. > > > 1. Is there any attribute that can be added to GIMPLE instruction? If yes, > then there must be a mechanism that translates those attributes to NOTE > instructions in the RTL pass? There is no machinery to add attributes or notes to GIMPLE statements. The existing information pieces that would qualify as those are instead embedded directly into the corresponding data structures. > 2. Is there any different approach on achieving above goal? >From your description it isn't clear whether the information you want to put into the NOTE is recoverable at RTL expansion time. Trying to second-guess it's an equivalency of the constant (at RTL expansion time) _x to something else which is still available in a register? > > Thanks and Regards, > Shubham