<div dir="ltr">Thank you. I did as you mentioned. Now i am getting error because MAI is not defined in my code. I am adding the print statement in x86mccodeemitter.cpp.<div><br></div><div><div>string imm;</div><div>llvm::raw_string_ostream rso(imm);</div><div> <br></div><div>MI.getOperand(4).getExpr()->print(rso, MAI);</div></div><div><br></div><div>getting error. What to do now?</div><div><br></div><div>Please help.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 5, 2017 at 4:34 PM, Florian Hahn <span dir="ltr"><<a href="mailto:florian.hahn@arm.com" target="_blank">florian.hahn@arm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<span class=""><br>
<br>
On 05/10/2017 02:05, hameeza ahmed via llvm-dev wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I need the expression in string. How can i convert llvm::MCExpr * to string?<br>
<br>
</blockquote>
<br></span>
Using MCExpr::print [1] with raw_string_ostream [2] should do what you want to do.<br>
<br>
Cheers,<br>
Florian<br>
<br>
<br>
<br>
[1] <a href="http://llvm.org/doxygen/classllvm_1_1MCExpr.html#ae3067756d9df7843be2d25cedab37da4" rel="noreferrer" target="_blank">http://llvm.org/doxygen/classl<wbr>lvm_1_1MCExpr.html#ae3067756d9<wbr>df7843be2d25cedab37da4</a><br>
<br>
[2] <a href="http://llvm.org/doxygen/classllvm_1_1raw__string__ostream.html" rel="noreferrer" target="_blank">http://llvm.org/doxygen/classl<wbr>lvm_1_1raw__string__ostream.<wbr>html</a><br>
</blockquote></div><br></div>