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

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 16 08:00:07 PST 2019


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


More information about the llvm-dev mailing list