Paul Biggar writes: > I've come to a bit of an impasse in the (java) escape analysis. In > order to do interprocedural analysis effectively, I need to know what > methods are called. However, it is rarely the case that this > information is available. For example, a call to System.out.println > looks like this: > > out.0 = out; > out.1 = (struct *) out.0; > D.966 = out.1->vtable; > D.967 = D.966 + 124B; > D.968 = *D.967; > D.969 = (java.io.PrintStream:: *) D.968; > D.970 = _CD_HelloDate[1]; > D.971 = (struct *) D.970; > D.969 (out.0, D.971); > > So its all vtables, function lookups and indirect function calls. I > appreciate that that's how it works, but its not terribly useful to > me, and severely restricts what I can do. > > Ideally, I would have a list of methods that could be called at a > particular polymorphic function call. From there I can do whatever > analysis is appropriate. > > Any ideas how I'd go about this?
Yes. You'll need to represent virtual function calls at the GIMPLE level, or to keep track of which calls are associated with which methods. This is key to getting IPA to work. It should be fairly easy, given a class and a vtable offset, to find the method. This will require a callback into the front end. Andrew.