[LLVMdev] Local variable information in scope
godepankaj at yahoo.com
Thu Oct 13 01:43:54 PDT 2011
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)
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.
On Oct 12, 2011, at 3:14 AM, Pankaj Gode wrote:
>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 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.
>LLVM Developers mailing list
>LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev