Developing a pass for the backend


Is there a way to map a MachineInstr to the respective LLVM IR using a
MachineFunctionPass (or something else) in my backend?

I need to read some metadata associated with LLVM IR instructions and
I was thinking of using some debug information (DebugLoc?) to do so.
However, By inspecting the LLVM source code I have not been able to
find any mapping between a MachineInstr and a LLVM IR Instruction.


​See if this thread help.​


Unfortunately, I think it does not help.

I need a complete mapping from IR (class Instruction) to MachineInstr
(?). I need to know, for a specific IR instruction, which assembly
instructions are generated.
I think that post doesn't go that far as I believe MachineInstr have
no connection to the SelectionDAG.