hameeza ahmed via llvm-dev
2017-Oct-05 01:05 UTC
[llvm-dev] Conversion of const llvm::MCExpr * to string
Hello, I need the expression in string. How can i convert llvm::MCExpr * to string? Please help. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171005/50817330/attachment.html>
Florian Hahn via llvm-dev
2017-Oct-05 11:34 UTC
[llvm-dev] Conversion of const llvm::MCExpr * to string
Hi, On 05/10/2017 02:05, hameeza ahmed via llvm-dev wrote:> I need the expression in string. How can i convert llvm::MCExpr * to string? >Using MCExpr::print [1] with raw_string_ostream [2] should do what you want to do. Cheers, Florian [1] http://llvm.org/doxygen/classllvm_1_1MCExpr.html#ae3067756d9df7843be2d25cedab37da4 [2] http://llvm.org/doxygen/classllvm_1_1raw__string__ostream.html
hameeza ahmed via llvm-dev
2017-Oct-05 18:10 UTC
[llvm-dev] Conversion of const llvm::MCExpr * to string
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. string imm; llvm::raw_string_ostream rso(imm); MI.getOperand(4).getExpr()->print(rso, MAI); getting error. What to do now? Please help. On Thu, Oct 5, 2017 at 4:34 PM, Florian Hahn <florian.hahn at arm.com> wrote:> Hi, > > On 05/10/2017 02:05, hameeza ahmed via llvm-dev wrote: > >> I need the expression in string. How can i convert llvm::MCExpr * to >> string? >> >> > Using MCExpr::print [1] with raw_string_ostream [2] should do what you > want to do. > > Cheers, > Florian > > > > [1] http://llvm.org/doxygen/classllvm_1_1MCExpr.html#ae3067756d9 > df7843be2d25cedab37da4 > > [2] http://llvm.org/doxygen/classllvm_1_1raw__string__ostream.html >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171005/092f8958/attachment.html>