[LLVMdev] Associate IR instruction with corresponding assembly

Tobias Grosser
Sat, 17 May 2014 21:57:55 -0000

On 17/05/2014 23:05, shruti padmanabha wrote:
> Hi,
>
> Is there a way to associate LLVM IR instructions with the instructions they
> finally generate in the assembly file emitted by LLC? I need to track the
> PC's corresponding to certain IR level instructions for ARM.
> One way to do this is to tag an IR instruction with a special flag and pass
> that flag onto the Machine IR created by LLC and then onto Machine Code. It
> would be helpful if I could get some pointers on how to do this.

You may want to look at the -debug-ir pass, which creates METADATA to
emit debugging information that allows you to associate machine
instructions with IR instructions. This may or may not be what you want.

Tobias