[LLVMdev] Recover variable name after mem2reg

Jim Grosbach grosbach at apple.com
Fri Jun 15 11:30:50 PDT 2012


Debug info metadata is your best bet. There's no guaranteed mapping.

-Jim

On Jun 15, 2012, at 8:06 AM, Julien Henry <julienhenry23 at gmail.com> wrote:

> Hi everybody,
> 
> I have some issues trying to recover the name of the variables from the metadata.
> Let me explain : I have a LLVM IR file, compiled with -g, on which I apply the -mem2reg optimization pass. This pass has the effect of removing the dbg.declare function calls from the bitcode, and replaces them by calls to the intrinsic function dbg.value. However, these function calls do not allow to easily associate each of the llvm instructions to its corresponding variable name in my C code.
> For instance, I don't figure out how to recover the name in the C program of a Phi value "%x.1", which is clearly my "x" variable in C.
> 
> Do I miss something ?
> 
> Thanks for your help.
> -- 
> Julien
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list