LLVM Instr from MachineInstr

Hi,

Is there any way to get a pointer to the LLVM Instr from which a
particular MachineInstr is generated ?

Although I understand it goes through many optimization after a LLVM
instruction is converted to SDAG node, so maintaining such a mapping
will be hard. Still is the mapping stored some where which can give
some sane results at least in case of -O0?

Thanks and regards,
Ankur

Hi Ankur,

For a MachineBasicBlock you can call getBasicBlock() to find the IR level BasicBlock from which it was generated (if there isn't a one, it will return NULL). I don't know of a way to get a finer granularity than that, though.

-Jim

Thanks Jim,

That is what found out. The only way seem to be to iterate through
the LLVM-basic block and trying to match LLVM-instructions to the
MachineInstr.
Though the matching logic has to written separately for each group of
instructions ( e.g. binary, call ..etc.)

Thanks and regards,
Ankur