<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr"><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span style="font-family: Helvetica; font-size: 12pt; ">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.</span></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span style="font-family: Helvetica; font-size: 12pt; ">I am interested in converting the variable names in some C strings to the one in the IR.</span></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span style="font-family: Helvetica; font-size: 12pt; ">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).</span></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>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.</div></blockquote></blockquote><div><blockquote type="cite" style="font-family: Helvetica; font-size: medium; "><blockquote type="cite"></blockquote></blockquote><blockquote type="cite" style="font-family: Helvetica; font-size: medium; "><blockquote type="cite"></blockquote></blockquote><blockquote type="cite" style="font-family: Helvetica; font-size: medium; "><blockquote type="cite"></blockquote></blockquote><blockquote type="cite" style="font-family: Helvetica; font-size: medium; "><br>this is essentially hopeless.  Most names in LLVM IR have no meaning, they are<br>just there to make debugging easier: they can be removed altogether and all will<br>still work fine.  Even if the front-end is kind enough to set a name, optimizers<br>can change them.  Why do you want this name mapping?  Maybe you should be using<br>debug info instead?<br></blockquote><div style="font-family: Helvetica; font-size: medium; "><br></div><div style="font-family: Helvetica; font-size: medium; ">I am interested in using the information a programmer can put in some annotation comments in order to improve the optimization on the source code.</div><div style="font-family: Helvetica; font-size: medium; ">Since the programmer will write those annotations using the source code names, I need to find a way to carry on these comments in the IR generation in order to make them available for later optimization passes. </div><div style="font-family: Helvetica; font-size: medium; ">I thought about attaching those comment as a metadata string to the next instruction after the comment.</div><div style="font-family: Helvetica; font-size: medium; ">I am new to LLVM and by reading the .s output files I thought that clang does some kind of renaming to the variables. </div><div style="font-family: Helvetica; font-size: medium; ">Do you think there is an easier way to do that?</div><div style="font-family: Helvetica; font-size: medium; "><br></div><div style="font-family: Helvetica; font-size: medium; ">Thank you again,</div><div style="font-family: Helvetica; font-size: medium; "><br></div><div style="font-family: Helvetica; font-size: medium; ">Niko</div></div></div>
                                          </div></body>
</html>