[cfe-dev] Constructing use-def chains

Simone Pellegrini spellegrini at dps.uibk.ac.at
Tue Sep 15 09:24:23 PDT 2009


Hello, I am back :),
so I fix most of the comments, I still need to address a couple of 
issues, i.e. use of llvm::DenseMap in place of std::map and virtual 
methods in DefUseHelper.

About the usage of llvm::DenseMap, the problem is that every time I 
change from std:::map to llvm::DenseMap I get several errors (compile 
time), which is weird as the 2 classes expose the same interface, anyway 
I need some time to understand which is the source of problems.

About the virtual methods in DefUseHelper, you are right! :) most of the 
time the user will use the default one and I see the performance problem 
with the virtual calls. Actually, I have introduced this virtual 
dispatch because in the project where I am using this implementation of 
DefUse, I need to implement  specific semantics of MPI calls. So mostly 
I am overloading the semantics of method calls (CallExpr). By default 
when a variable is passed to a function as a pointer type (or 
reference), during the DefUse analysis we have to state that this is a 
definition for the variable. Anyway, if we know the semantics of the 
specific method, and we know that it will not change the variable (for 
example the buffer in MPI_Send) we can state that the method call will a 
use for the variable.

Now I don't know if this mechanism is useful for others... and if it 
should be here in the first place, but it makes sense for me :) Anyway, 
I guess I can avoid the virtual calls by using templates. I will be 
working on it the next days.

For the rest I properly formatted the code, for the test cases I have to 
learn how to write test cases for LLVM :)

Btw, I would like to thanks you for your time and the useful hints.

cheers, Simone

Ted Kremenek wrote:
>
> On Sep 9, 2009, at 4:37 AM, Simone Pellegrini wrote:
>
>> Hi Ted,
>> Thanks for going through all that messy code, I read the code 
>> reviews, I definitely agree with them, I will fix it before the end 
>> of the week and I will send you a better version hopefully next 
>> Monday, so we can go through another iteration.
>> Sorry for the 80 columns formatting and white spaces issues, I didn't 
>> have time to fix it last week and I wanted to send you this code 
>> before the end of the week... so I try to get lucky :)
>
>> I have a couple of questions: Should I provide patch files? or we can 
>> continue with sending C++ files at this stage? Should I also provide 
>> some test cases?
>> cheers, Simone
>
>
> Hi Simone,
>
> I'm fine with either a patch or files (as long as they are brand new 
> files).  In either case, can you please modify Thunderbird to not 
> inline your attachments?  Instructions are here:
>
>   http://llvm.org/docs/DeveloperPolicy.html#patches
>
> Test cases would be great.  Thanks!
>
> Cheers,
> Ted

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DefUse.h
Type: text/x-chdr
Size: 7383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090915/4accc281/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DefUse.cpp
Type: text/x-c++src
Size: 32713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090915/4accc281/attachment.cpp>


More information about the cfe-dev mailing list