[LLVMdev] debug stoppoint nodes with -fast option

Dale Johannesen dalej at apple.com
Wed Apr 8 09:40:59 PDT 2009

On Apr 7, 2009, at 9:52 PMPDT, vasudev wrote:

> Thanks for the info regarding DebugLoc field.  Another related  
> question
> that I have is  regarding debug info for local variables.  With -fast
> option, ISD::DECLARE nodes are created in DAG for debug info of local
> variables. I am planning to custom handle these nodes, get the  
> required
> info from llvm.dbg.variable global address and emit it in ISel.  But
> without -fast option ISD::DECLARE nodes are not created. How can i
> access the debug info for local variables in that case? Is it  
> available
> directly somewhere in AsmPrinter  like the debug info for  global  
> variables?

Not yet.  The Declare nodes interfere with optimizations, as do the  
Stoppoint nodes:  they count as an extra Use, which affects many  
optimizations that are looking for a single Use (of the alloca node,  
or whatever).   Rather than try to hunt these all down, the plan is to  
reimplement declarations in a way that isn't represented as a Use.   
This is in the early stages yet and I can't give you a date when it  
will work, sorry.

> Dale Johannesen wrote:
>> On Apr 5, 2009, at 11:54 PMPDT, vasudev wrote:
>>> I need to generate line number debug information for PIC16 target.
>>> PIC16 does not support dwarf format. It supports coff format. So I
>>> need
>>> to custom handle the STOPPOINT nodes. Without -fast option the
>>> nodes are not created in dag because of the below check in
>>> SelectionDAGBuild.cpp
>>>    if (Fast)
>>>       DAG.setRoot(DAG.getDbgStopPoint(getRoot(),
>>> If I give -fast option then the Fast flag is true, but the dag  
>>> doesn't
>>> contain STOPPOINT nodes.
>> Right.  Currently, the way we tell whether optimization was requested
>> at the command line level is to look at -fast; -O0 == -fast.
>> The stoppoint nodes enforce an ordering of loads and stores
>> corresponding to the original source, which means that putting them  
>> in
>> without -fast would lead to codegen (scheduling) differences  
>> between -
>> O and -O -g.  We don't want that.
>> Instead, the debug info is transferred at this point from stoppoint
>> nodes to the DebugLoc field in each MachineInstr node.  You should
>> probably use that.
>> (The current state of debug info with -O is that we think -g never
>> affects codegen; violations of that should be reported as bugs.  The
>> quality of the debug info has not been worked on much and is
>> problematic.)
>>> If  I have simple loads and stores in source
>>> code, the dag doesn't contain them too. Why are these nodes not  
>>> being
>>> created?
>> I don't know.  Something to do with your target, they appear for me.
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list