From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id 3010B3858D3C for ; Sun, 16 Jan 2022 13:22:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3010B3858D3C Received: by mail-wm1-x32f.google.com with SMTP id w26so15034898wmi.0 for ; Sun, 16 Jan 2022 05:22:41 -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:from:date:message-id:subject:to; bh=v0ux4tibAbAfjPhR19fWYsCnXDGaOHe9/xWFvg9znjI=; b=AmcYmmZuHNo0/A0+WImINeBB8hnkuZJPh/7Y8wLBYBh8bK7nKTab9mx1r0oPn5RUCr 3SO8rwXiDf7B/+q2ji8cG65/rPYWlH0Z7zXmxHkSPrQvho+InOfWUBVu3/3jOIiMl0JR ns/1NQiGE2M4Eea5FYg4GNBLblK+ViYWhs7sj4rSf99cNhTbvc12IKC4lewmAcK7lOJo NvI90pTSSxa/GNqOPvUV85K9iWL+ljugs5ZTVQNVA88Ha0TIaeL/Y8Mhd3o4Ee0pa97c IKvjcZ6VIOV6IlTuLiFoOBpA1FbH6hJ8XJWgJckN2pWQpmXw+eO4vPxrECngeBFkphQZ VceQ== X-Gm-Message-State: AOAM531p2J7vQggoudI1JzMzQHCwoHnV27XdlEk1IOWmInEu/WVspa3p RXyJ2fUA8XuwsQi/Gm4pqI6YoKwE4b9YRYHkzTnBaBTK2JE= X-Google-Smtp-Source: ABdhPJy1B/ANnc5dgPSaQZihIT6wK5tBpRCuc739NU16Ec9tK2qONUo+bHgbefbjKBJtQ+RrOfI49+Wfa49AFFa7FmY= X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr1703007wri.33.1642339359911; Sun, 16 Jan 2022 05:22:39 -0800 (PST) MIME-Version: 1.0 From: Shubham Narlawar Date: Sun, 16 Jan 2022 18:52:29 +0530 Message-ID: Subject: Accessing const parameter of GIMPLE_CALL To: GCC Development Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.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 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: Sun, 16 Jan 2022 13:22:43 -0000 Hello, My aim is to iterate over gimple call stmt parameters and check whether it is constant or constant expression and mark/store them for some gimple transformation. I have an intrinsic function call of the following - __builtin_xyz(void*, 7, addr + 10); I want to find its parameters which are either constant or constant expression i.e. 7 and addr + 10 from above case. [1] I tried below macro but there is very less usage in the entire source code - tree fn_ptr = gimple_call_fn (dyn_cast (stmt)); //stmt = gimple_call function_args_iterator iter; tree argtype; if (TREE_CODE (fn_ptr) == ADDR_EXPR) { FOREACH_FUNCTION_ARGS (fn_ptr, argtype, iter) { if (TREE_CONSTANT (argtype)) // Found a constant expression parameter } } The problem is I am getting only one parameter tree but there are 2 constants in the above function call. Even if "addr + 10" is treated differently, I want to mark it for the transformation. a. Is the above correct method to iterate over function call parameters? b. Is there a different way to achieve the above goal? Thanks and Regards, Shubham