Identifying Chain of Recurrence
GCC builds a chain of recurrence to capture a pattern in which an array is accessed in a loop. Is there any function which identifies that gcc has built a chain of recurrence? Is this information associated to the gimple assignment which accesses the array elements? Thanks, Pritam Gharat
Identifying Pure and Const Functions
Hi, How do we identify whether a function is a pure or a const function? Is there any flag associated with its cgraph_node or the tree node (decl of cgraph_node)? Thanks, Pritam Gharat
Re: Identifying Pure and Const Functions
I had a look at the file ipa-pure-const.c. I have wriiten a Simple IPA Pass which identifies pure and const functions in the program. I have inserted this pass after ipa-pta pass which is executed after ipa-pure-const pass. Also, the option -fipa-pure-const is enabled. I am using DECL_PURE_P(t) and TREE_READONLY(t) to identify whether t is a pure or a const function. I tested this code on a sample program which consists of a function "error" which returns a constant value. gcc fails to identify it as a pure function. However, if I specify the function as pure as shown below, gcc identifies it as pure function __attribute__((pure)) int error() { return 2; } I am unable to understand why error function is not identified as a pure function by gcc? Are the checks to identify pure and const functions correct? Thanks, Pritam Gharat On Fri, May 29, 2015 at 1:26 PM, Marek Polacek wrote: > On Fri, May 29, 2015 at 01:16:32PM +0530, Pritam Gharat wrote: >> How do we identify whether a function is a pure or a const function? >> Is there any flag associated with its cgraph_node or the tree node >> (decl of cgraph_node)? > > You'll want to look into ipa-pure-const.c. > > Marek
Re: Identifying Chain of Recurrence
I am writing a Simple IPA Pass which is inserted after ipa-pta. This pass identifies whether a chain of recurrence is built by gcc or not. I have used tree_is_chrec(t) to check if t represents chain of recurrence and function find_var_scev_info(bb, var) to obtain the scev information generated (which comprises of chrec information). However, find_var_scev_info() is a static function and cannot be called from my plugin. Is there any alternative way to get the chain of recurrence information? Or do we need to change the gcc source code by making the function find_var_scev_info() non-static and recompiling the source code? Thanks, Pritam Gharat On Fri, May 29, 2015 at 10:34 AM, Bin.Cheng wrote: > On Fri, May 29, 2015 at 12:41 PM, Pritam Gharat > wrote: >> GCC builds a chain of recurrence to capture a pattern in which an >> array is accessed in a loop. Is there any function which identifies >> that gcc has built a chain of recurrence? Is this information >> associated to the gimple assignment which accesses the array elements? >> > GCC analyzes evolution of scalar variables on SSA representation. > Each ssa var is treated as unique and can be analyzed. If the address > expression itself is a ssa var, it can be analyzed by scev; otherwise, > the users of scev have to compute by themselves on the bases of other > scev vars. For example, address of MEM[scev_var] can be analyzed by > scev; while address of MEM[invariant_base+scev_iv] is computed by > users. Well, at least this is how IVOPT works. You can refer to > top-file comment in tree-scalar-evolution.c for detailed information. > General routines for chain of recurrence is in file tree-chrec.c. > > Thanks, > bin >> >> Thanks, >> Pritam Gharat
How to include header of stl in gcc?
Hi, I am using sets of stl in gcc. I need to perform operations like set union, set intersection and set difference for my analysis. These functions are defined in the header . However, when I include this header in my file, I get the following error: /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:76:8: error: attempt to use poisoned "calloc" /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:83:8: error: attempt to use poisoned "malloc" /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:89:8: error: attempt to use poisoned "realloc" /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:112:11: error: attempt to use poisoned "calloc" /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:119:11: error: attempt to use poisoned "malloc" /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:127:11: error: attempt to use poisoned "realloc" make: *** [pointsto-callstrings.o] Error 1 How can I resolve this problem? -- Thanks, Pritam Gharat
Re: How to include header of stl in gcc?
It worked. Thank You :-) On Thursday 20 February 2014 06:03 PM, Marc Glisse wrote: On Thu, 20 Feb 2014, Pritam Gharat wrote: I am using sets of stl in gcc. I need to perform operations like set union, set intersection and set difference for my analysis. These functions are defined in the header . However, when I include this header in my file, I get the following error: /home/pritam/GCC_BUILDS/gcc_4.7/install/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/cstdlib:76:8: error: attempt to use poisoned "calloc" Include before any gcc header, i.e. before things can be poisoned.