A question about LLVM and x86 instruction mapping


I have a question about mapping between LLVM IR and the generated binary’s
instruction. Is there an easy way to map an LLVM instruction to a (or
group of) x86 instructions spit by LLVM code generation. More

I am trying to harden some pointer dereference(against the null ptr
dereference). I have done some analysis around some pointer dereferences
at the LLVM level and inject LLVM IR code to harden them. Also I used
llvm-g++ to link my hardened LLVM bit code with libraries to generate a
x86 binary.

Once a seg fault occurs, in my segfault handler, I will look up the binary
PC(program counter) and see if this is something that has been hardened by
me, if so, I have some mechanism to recover this failure.

So here is a problem, I don’t have the mapping information between my LLVM
IR and x86 instructions. I feel if it is supported by the LLVM
infrastructure, that will be great. Could you let me know if such
information is available? If not, could you make some suggestions how to retrieve such information easily?

Thank you very much!