This is the mail archive of the
mailing list for the GCC project.
Re: Identifying Chain of Recurrence
- From: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: Pritam Gharat <pritam01gharat at gmail dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sat, 30 May 2015 10:46:25 +0800
- Subject: Re: Identifying Chain of Recurrence
- Authentication-results: sourceware.org; auth=none
- References: <CAPHYrQXaHg-kC_1wuW8Os-OXiJB3t9a90NXyrBp9Wr0hOARPHA at mail dot gmail dot com> <CAHFci2_2t5saAk3QvMTgoAk1eSA+r_Uqhn=835epF8=X0GqX=w at mail dot gmail dot com> <CAPHYrQWECPXUjxfuGfkCcm2XFmLCaBfevvv99nnt0QMNDnNesA at mail dot gmail dot com>
On Fri, May 29, 2015 at 11:14 PM, Pritam Gharat
> 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.
find_var_scev_info is for internal use only. I think the proper
interface is simple_iv. You may refer to other users of that
interface in GCC.
Also, please don't top-reply the message.
> 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
> Pritam Gharat
> On Fri, May 29, 2015 at 10:34 AM, Bin.Cheng <email@example.com> wrote:
>> On Fri, May 29, 2015 at 12:41 PM, Pritam Gharat
>> <firstname.lastname@example.org> 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.
>>> Pritam Gharat