<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto"><BR style="RIGHT: auto" class=yui-cursor></SPAN></div>
<div style="RIGHT: auto">Hi,</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">I want to list some additional information on this.</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">The variable collection I am looking at is, "variables 'declared' in scope".</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">1. When I traverse the MachineInstructions in the LexicalScopes ranges, and check for variables, I get variables used in this scope. </div>
<div style="RIGHT: auto"> The variables listed include variables which may not have been declared in the scope. (for example "int t", which is not declared in scope1, is listed.)</div>
<div style="RIGHT: auto"> I do this by checking if the instruction uses memoperands then I collect name of value.</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">So, for the example below</div>
<DIV style="RIGHT: auto">int func( int t)</DIV>
<DIV style="RIGHT: auto">{ </DIV>
<DIV style="RIGHT: auto"> int x;</DIV>
<DIV style="RIGHT: auto"> //scope 1</DIV>
<DIV style="RIGHT: auto"> { </DIV>
<DIV style="RIGHT: auto"> int a;</DIV>
<DIV style="RIGHT: auto"> ....</DIV>
<DIV style="RIGHT: auto"> } </DIV>
<DIV style="RIGHT: auto"> return x;</DIV>
<DIV style="RIGHT: auto">} <VAR id=yiv2040551241yui-ie-cursor></VAR></DIV>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">what I am expecting is as below:</div>
<div style="RIGHT: auto"><scope name>: <list of variables declared in scope></div>
<div style="RIGHT: auto">func scope: t, x</div>
<div style="RIGHT: auto">scope 1: a</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">2. I checked the "CodeGen/AsmPrinter/DwarfDebug.cpp" as reference, to find mapping of "MachineInstruction" to "llvm.dbg.declare", to extract variables declared in scope.</div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">I am not sure whether there is any other way to get to variables declared in scope. </div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto"> </div>
<div style="RIGHT: auto">Regards,</div>
<div style="RIGHT: auto">Pankaj</div>
<div style="RIGHT: auto"> </div>
<DIV style="FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; FONT-SIZE: 10pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="RIGHT: auto" id=yiv2040551241>
<DIV style="RIGHT: auto"> </DIV>
<DIV style="RIGHT: auto">
<DIV style="RIGHT: auto">
<DIV style="RIGHT: auto">On Oct 12, 2011, at 3:14 AM, Pankaj Gode wrote:</DIV><BR class=yiv2040551241Apple-interchange-newline>
<BLOCKQUOTE style="RIGHT: auto" type="cite">
<DIV style="RIGHT: auto">
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: Courier New, courier, monaco, monospace, sans-serif; COLOR: #000; FONT-SIZE: 10pt">
<DIV style="RIGHT: auto"><VAR id=yui-ie-cursor></VAR>Hi all,</DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV style="RIGHT: auto">Using "CodeGen/LexicalScopes" pass, I could collect scope information i.e. start and end line numbers.</DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV style="RIGHT: auto">I also want to collect information of variables within the scope. </DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV style="RIGHT: auto">For the below example:</DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV style="RIGHT: auto">int global;</DIV>
<DIV style="RIGHT: auto">int func( int t)</DIV>
<DIV>{ </DIV>
<DIV> //scope 1</DIV>
<DIV style="RIGHT: auto"> { </DIV>
<DIV> int a;</DIV>
<DIV> ....</DIV>
<DIV style="RIGHT: auto"> } </DIV>
<DIV> return x;</DIV>
<DIV>} <VAR id=yiv2040551241yui-ie-cursor></VAR></DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV><VAR id=yiv2040551241yui-ie-cursor></VAR>For "scope 1", I should be able to collect that "a" is a local variable in scope1 and should also be able to identify whether "a" is static or non-static.</DIV>
<DIV style="RIGHT: auto"> </DIV>
<DIV>Regards,<BR>Pankaj</DIV></DIV></DIV>_______________________________________________<BR>LLVM Developers mailing list<BR><A href="mailto:LLVMdev@cs.uiuc.edu" rel=nofollow target=_blank ymailto="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A> http://llvm.cs.uiuc.edu<BR>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<BR></BLOCKQUOTE></DIV><BR></DIV></DIV><BR><BR></DIV></DIV></div></body></html>