Dipanjan Das via llvm-dev
2017-May-12 15:34 UTC
[llvm-dev] How to get the textual representation of an IR instruction?
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170512/d18ce9b8/attachment.html>
Krzysztof Parzyszek via llvm-dev
2017-May-12 15:39 UTC
[llvm-dev] How to get the textual representation of an IR instruction?
There is raw_string_ostream which prints to a std::string. -Krzysztof On 5/12/2017 10:34 AM, Dipanjan Das via llvm-dev 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 > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Dipanjan Das via llvm-dev
2017-May-16 18:09 UTC
[llvm-dev] How to get the textual representation of an IR instruction?
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>