[llvm-dev] distinguish program and temporary variables
John Criswell via llvm-dev
llvm-dev at lists.llvm.org
Mon Feb 8 07:35:28 PST 2016
On 2/8/16 9:39 AM, Mohammad Norouzi via llvm-dev wrote:
> I need to check if a variable belongs to the program originally.
> Consider the following code line:
> y = x + 4
> and its corresponding llvm ir (roughly):
> %16 = load i32 %x
> %add = add i32 %16, i32 4
> store i32 %add, %y
> I need to distinguish between %16, %add and %x, %y.
You might be able to use the Debug information embedded within the LLVM
IR to determine what is an original variable and what is a temporary
added by LLVM. However, I think that such an approach is fragile.
It sounds like you need to be analyzing Clang ASTs instead of LLVM IR.
The Clang AST represents a program in its original source form, so you
can tell what is a program variable, in what file it was defined, its
original source type, etc.
> Any help is appreciated.
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
Department of Computer Science, University of Rochester
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev