[LLVMdev] Source level debugging

Chris Lattner sabre at nondot.org
Fri Jul 29 17:27:54 PDT 2005


On Fri, 29 Jul 2005, Anna Zaks wrote:
> I am planning to use LLVM for a compiler validation
> project that checks if the optimized version of the
> code is the correct translation of the unoptimized
> code. And I have a couple of questions.

ok

> I need two pieces of information from the compiler:
>
> 1) Some kind of mapping between the structure of the
> unoptimized and optimized code. It seems, that can be
> obtained via the llvm.dbg.stoppoint intrinsic
> functions.

This is very hard.

> 2) Mapping between the variables of the source code
> (or  unoptimized LLVM code) and  the
> variables/registers in the optimized code. My
> understanding is that such mapping could be a part of
> the debug information, but has not been implemented
> yet. It seems that LLVM symbol table is not designed
> to keep such information either.
> Any suggestions on how to obtain this mapping?

Not really.  You could implement debug info, that's really the only way to 
get what you want.

> As a side note, does anyone have examples of tail call
> elimination performed with debugging information
> enabled? It seems that it should be possible according
> to the Source Level Debugging with LLVM:
> "you get accurate stack traces despite tail call
> elimination and inlining),". However, in my examples,
> %llvm.dbg.stoppoint and %llvm.dbg.region.end get
> inserted between the tail call and the return
> statement, which stop tailcallelim unless I remove
> them manually.

I haven't tried it with tail call elim, though inlining certainly works.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list