[LLVMdev] Local variable information in scope
Pankaj Gode
godepankaj at yahoo.com
Thu Oct 13 01:43:54 PDT 2011
Hi,
I want to list some additional information on this.
The variable collection I am looking at is, "variables 'declared' in scope".
1. When I traverse the MachineInstructions in the LexicalScopes ranges, and check for variables, I get variables used in this scope.
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.)
I do this by checking if the instruction uses memoperands then I collect name of value.
So, for the example below
int func( int t)
{
int x;
//scope 1
{
int a;
....
}
return x;
}
what I am expecting is as below:
<scope name>: <list of variables declared in scope>
func scope: t, x
scope 1: a
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.
I am not sure whether there is any other way to get to variables declared in scope.
Regards,
Pankaj
On Oct 12, 2011, at 3:14 AM, Pankaj Gode wrote:
Hi all,
>
>Using "CodeGen/LexicalScopes" pass, I could collect scope information i.e. start and end line numbers.
>
>I also want to collect information of variables within the scope.
>
>For the below example:
>
>int global;
>int func( int t)
>{
> //scope 1
> {
> int a;
> ....
> }
> return x;
>}
>
>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.
>
>Regards,
>Pankaj_______________________________________________
>LLVM Developers mailing list
>LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111013/21bcca29/attachment.html>
More information about the llvm-dev
mailing list