Peng Yu via llvm-dev
2019-Jan-16 15:24 UTC
[llvm-dev] How to get the string representation of an instruction?
Hi, I don't see a way to convert an Instruction to a string or const char *, although '<<' works on it. http://llvm.org/doxygen/classllvm_1_1Instruction.html How to figure this out? Thanks. -- Regards, Peng
Ryan Taylor via llvm-dev
2019-Jan-16 15:42 UTC
[llvm-dev] How to get the string representation of an instruction?
Is Value::getName() not what you want? On Wed, Jan 16, 2019 at 10:25 AM Peng Yu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I don't see a way to convert an Instruction to a string or const char > *, although '<<' works on it. > > http://llvm.org/doxygen/classllvm_1_1Instruction.html > > How to figure this out? Thanks. > > -- > Regards, > Peng > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190116/20db347a/attachment.html>
mayuyu.io via llvm-dev
2019-Jan-16 15:44 UTC
[llvm-dev] How to get the string representation of an instruction?
he probably means text representation like in text IR Zhang> 在 2019年1月16日,15:42,Ryan Taylor via llvm-dev <llvm-dev at lists.llvm.org> 写道: > > Is Value::getName() not what you want? > >> On Wed, Jan 16, 2019 at 10:25 AM Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> Hi, >> >> I don't see a way to convert an Instruction to a string or const char >> *, although '<<' works on it. >> >> http://llvm.org/doxygen/classllvm_1_1Instruction.html >> >> How to figure this out? Thanks. >> >> -- >> Regards, >> Peng >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190116/8a111299/attachment.html>
Krzysztof Parzyszek via llvm-dev
2019-Jan-16 16:00 UTC
[llvm-dev] How to get the string representation of an instruction?
On 1/16/2019 9:24 AM, Peng Yu via llvm-dev wrote:> > I don't see a way to convert an Instruction to a string or const char > *, although '<<' works on it. > > http://llvm.org/doxygen/classllvm_1_1Instruction.html > > How to figure this out? Thanks.Create a raw_string_ostream object and use << to print to it. The underlying string will contain the textual representation. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Peng Yu via llvm-dev
2019-Jan-16 16:39 UTC
[llvm-dev] How to get the string representation of an instruction?
> Create a raw_string_ostream object and use << to print to it. The > underlying string will contain the textual representation.This is cumbersome. There is not a way to directly get the std::string or char * representation of IR text? -- Regards, Peng
Daniel Sanders via llvm-dev
2019-Jan-16 21:21 UTC
[llvm-dev] How to get the string representation of an instruction?
> On Jan 16, 2019, at 08:00, Krzysztof Parzyszek via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On 1/16/2019 9:24 AM, Peng Yu via llvm-dev wrote: >> I don't see a way to convert an Instruction to a string or const char >> *, although '<<' works on it. >> http://llvm.org/doxygen/classllvm_1_1Instruction.html >> How to figure this out? Thanks. > > Create a raw_string_ostream object and use << to print to it. The underlying string will contain the textual representation.llvm/Support/ScopedPrinter.h has a to_string() template which does this.> -Krzysztof > > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > hosted by The Linux Foundation > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev