[llvm-dev] How to get the textual representation of an IR instruction?

Dipanjan Das via llvm-dev llvm-dev at lists.llvm.org
Tue May 16 11:09:22 PDT 2017


Answering my own question, the solution will be:

std::string str;
llvm::raw_string_ostream rso(str);
I.print(rso);


On 12 May 2017 at 08:34, Dipanjan Das <mail.dipanjan.das at gmail.com> wrote:

>
> If 'I' is of type llvm::Instruction, we can print out the human-readable
> form (textual representation) of it by by, errs() << I;
>
> I want the assign the exact same representation to a std::string to C type
> string. How can I do that?
>
> --
>
> Thanks & Regards,
> Dipanjan
>



-- 

Thanks & Regards,
Dipanjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170516/835d12f6/attachment.html>


More information about the llvm-dev mailing list