basic bloc chaining: using dominance

Pierre Vittet piervit@pvittet.com
Tue May 10 13:55:00 GMT 2011


Hello,

I am working on a plugin at the GIMPLE state, I am parsing basic blocks 
and I need to check that a call to foo() is only present once in a 
function. Howerver, it can be present several times if it is in 
different basic blocks and only one is executed at execution time.

I think the most convenient way is to use dominance relation between the 
basic blocks: I can warn in a basic block A calling the foo() function 
only if there is a block B calling foo and dominating A. In others 
cases, I cannot be sure that there is several calls to foo().

In the file gcc/dominance.c, there is a dominated_by_p function which 
allows to test dominance between 2 basic blocks and I would like to use 
it to solve this problem.

I would like to have your opinion, does it looks the google solution to 
the problem or is there another way to do this?

If this is a good solution, I will implement a primitive in MELT 
allowing to use dominated_by_p function in MELT.

Thanks!

Pierre Vittet

My Google Summer Of Code projet: 
http://www.google-melange.com/gsoc/project/google/gsoc2011/piervit/15001



More information about the Gcc mailing list