code gen variable mapping

Hi all,

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.

Thank you in advance,

Niko

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.