Right now I am writing passes just to look for arrays & structs <div>I am trying to identify the array by parsing the memory description(use regex's)<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px; "></span></div>
<div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px; ">ex./ { [20 x i8], i32 } *- for a struct. is a structure with a character array of size 20 and an integer.</span></div><div>
<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px;">I'm not sure if llvm provides an easier way to do this?</span></div><div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px; ">The type id for most arrays comes out to be a pointer rather than an array, its pretty much the same case for structs.</span></div>
<div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px; "> </span></div><div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px;">I haven't yet been able to extend this to "logical" structures, and objects still looking into it. Any ideas?</span></div>
<div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px;"><br></span></div><div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px;">Thanks</span></div>
<div><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px;">Nipun</span></div><div><br><div class="gmail_quote">On Sun, Nov 2, 2008 at 4:57 PM, Vikram S. Adve <span dir="ltr"><<a href="mailto:vadve@cs.uiuc.edu">vadve@cs.uiuc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">How do you define a data structure for this purpose?  Do you mean<br>
individual data types like structs or arrays?  Or higher-level<br>
"logical" structures like lists, trees, or hash tables?  The former is<br>
obviously easier but even the latter is possible, in some cases.<br>
<br>
--Vikram<br>
Associate Professor, Computer Science<br>
University of Illinois at Urbana-Champaign<br>
<a href="http://llvm.org/~vadve" target="_blank">http://llvm.org/~vadve</a><br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
On Nov 2, 2008, at 12:55 AM, Nipun Arora wrote:<br>
<br>
> Hey Devang,<br>
><br>
> Thanks for the assist, I'm trying to extract a signature which<br>
> uniquely identifies a block of code.... this is required for a<br>
> project I am doing.<br>
> The no of data structures is one of the identifying features of this<br>
> signature.<br>
><br>
> Thanks<br>
> Nipun<br>
><br>
><br>
> On Fri, Oct 31, 2008 at 1:05 PM, Devang Patel <<a href="mailto:dpatel@apple.com">dpatel@apple.com</a>><br>
> wrote:<br>
> Hi Nipun,<br>
><br>
> On Oct 30, 2008, at 9:31 PM, Nipun Arora wrote:<br>
><br>
>> Hi<br>
>><br>
>> I am trying to count the no of datastructures and the type, say for<br>
>> example the number of arrays in a given code. Which pass would give<br>
>> me this info? And what do I need to use in it?<br>
><br>
> What are you trying to achieve here with this information ?<br>
><br>
> You can iterate over types to collect the info you need. For example,<br>
><br>
> TypeSymbolTable &TST = MyModule.getTypeSymbolTable();<br>
> for(TypeSymbolTable::iterator TI = TST.begin(), TE =TST.end(); TI !=<br>
> TE; ++TI) {<br>
> const Type *Ty = TI->second;<br>
>         ...<br>
> }<br>
><br>
> <a href="http://llvm.org/docs/ProgrammersManual.html" target="_blank">http://llvm.org/docs/ProgrammersManual.html</a> is very useful document<br>
> for beginners.<br>
><br>
>><br>
>> Thanks for the help<br>
>><br>
>> Cheers<br>
>> Nipun :)<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
> -<br>
> Devang<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
</div></div>> <ATT00001.txt><br>
<div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>