[llvm-dev] Conversion of const llvm::MCExpr * to string

hameeza ahmed via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 5 11:10:48 PDT 2017


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>


More information about the llvm-dev mailing list