This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Correct way to access predecessors of a gimple statement?
- From: Kartik Singhal <kartiksinghal at gmail dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Sun, 5 May 2013 10:05:34 +0530
- Subject: Correct way to access predecessors of a gimple statement?
Hi
I am trying to implement a GVN algorithm as a plugin for GCC 4.6.
With help from GCC IRC channel, internals doc and reading the source,
I was able to get a prototype working for the case of a single block.
Now, I am trying to handle the case of confluence of multiple edges
i.e. obtain redundancy information from multiple paths at a merge
point. I am stuck trying to figure out how to access all the immediate
predecessors of a statement. I have looked into CFG chapter of
internals doc (block and edge), though edge data structure seems to
give a hint, I couldn't clearly find out how to leverage it for my
purpose. Any hints or code example would be a great help.
If it is of any help, the algorithm is at [1] and my code at [2]
(*very* naive and not considering performance at all in the first
implementation attempt).
[1]: http://arxiv.org/abs/1303.1880
[2]: https://github.com/k4rtik/btp-gvn/blob/master/gvn-plugin/plugin.c
Thanks
--
Kartik
http://k4rtik.wordpress.com/