[LLVMdev] code gen variable mapping
Duncan Sands
baldrick at free.fr
Mon Apr 1 01:18:43 PDT 2013
Hi Niko,
> Since variables in the source code are renamed in the IR, I wanted to ask you how and where this mapping is done in Clang.
> I am interested in converting the variable names in some C strings to the one in the IR.
> For example if at a certain point of the program I have a string like "x>0" I want to change it in "%x>0" (I already implemented a parser to recognize the identifiers so I only need to translate the name).
> If you have any suggestion in how to do it easily (like if there is already a data structure or a method to call) it will be really appreciated.
this is essentially hopeless. Most names in LLVM IR have no meaning, they are
just there to make debugging easier: they can be removed altogether and all will
still work fine. Even if the front-end is kind enough to set a name, optimizers
can change them. Why do you want this name mapping? Maybe you should be using
debug info instead?
Ciao, Duncan.
More information about the llvm-dev
mailing list