> This may be a a long shot but I'll ask anyway. Does LLVM have any
> way of mapping an Instruction or Value back to the original position
> (file, line number) in the source code? I'm writing a pass that among
Nope, unfortunately it doesn't. About the closest mapping you could get
is by function, and even that would be invalidated if the -inline pass is
used...
> If LLVM doesn't have this, how would one add it? Maybe this info
> could be stored in an Annotation that the frontend attaches to each
> Instruction it creates?
This would require modifying the GCC frontend to do this, which is
very-nontrivial. We take our input from the RTL level information. There
must be some kind of mapping from the RTL to source level (for debug
output), so it can probably be obtained from there.
After that, you'd have to come up with some way to represent it in the
.ll files so that the assembler can attach it to the instruction nodes.
Optimizations would have to be taught to update these annotations as
appropriate or something as well.
Overall, it isn't very likely to happen in the near future. Sorry! :(
-Chris
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/