[llvm-dev] Annotate LLVM IR instruction to use later in a machine pass

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 8 13:35:34 PST 2016

     How do you recommend to annotate an LLVM IR instruction with some info in a 
middle-tier pass (namely LoopVectorize.cpp) that should be printed in the back end, in a 
MachineFunctionPass, etc?

     Basically, what I did so far is to create an InlineAsm instruction just before the 
respective LLVM IR instruction in order to transmit the extra-info to the back end and 
used [Target]InstrPrinter.cpp to retrieve this extra-info and print it accordingly.

     This is not necessarily the best solution since we can have LLVM stores that get 
lowered to several machine instructions, like the following LLVM instruction:
         store <8 x i16> <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>, <8 x 
i16>* inttoptr (i16 100 to <8 x i16>*)

   Thank you,

More information about the llvm-dev mailing list