[llvm-commits] [llvm] r82077 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner clattner at apple.com
Sun Sep 27 15:40:16 PDT 2009


On Sep 16, 2009, at 1:39 PM, Devang Patel wrote:
Author: dpatel
> Date: Wed Sep 16 15:39:11 2009
> New Revision: 82077
>
> URL: http://llvm.org/viewvc/llvm-project?rev=82077&view=rev
> Log:
> At iSel time, update DebugLoc based on debug info attached with an  
> instruction.

Ok,

>   // Lower all of the non-terminator instructions. If a call is  
> emitted
>   // as a tail call, cease emitting nodes for this block.
> -  for (BasicBlock::iterator I = Begin; I != End && !SDL- 
> >HasTailCall; ++I)
> +  for (BasicBlock::iterator I = Begin; I != End && !SDL- 
> >HasTailCall; ++I) {
> +    if (MDDbgKind) {
> +      // Update DebugLoc if debug information is attached with this
> +      // instruction.
> +      if (MDNode *Dbg =
> +	  dyn_cast_or_null<MDNode>(TheMetadata.getMD(MDDbgKind, I))) {

This cast should not be needed, getMD returns an MDNode*.

> +  Metadata &TheMetadata = Fn.getContext().getMetadata();
> +  MDKindID MDDbgKind = TheMetadata.getMDKind("dbg");
> +
>   // Iterate over all basic blocks in the function.
>   for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
>     BasicBlock *LLVMBB = &*I;
> @@ -722,6 +739,18 @@
>       FastIS->startNewBlock(BB);
>       // Do FastISel on as many instructions as possible.
>       for (; BI != End; ++BI) {
> +	if (MDDbgKind) {
> +	  // Update DebugLoc if debug information is attached with this
> +	  // instruction.
> +	  if (MDNode *Dbg =
> +	      dyn_cast_or_null<MDNode>(TheMetadata.getMD(MDDbgKind, BI))) {

Likewise, also, why is this code duplicated in two places?

-Chris

> +	    DILocation DILoc(Dbg);
> +	    DebugLoc Loc = ExtractDebugLocation(DILoc,
> +						MF.getDebugLocInfo());
> +	    FastIS->setCurDebugLoc(Loc);
> +	  }
> +	}
> +
>         // Just before the terminator instruction, insert  
> instructions to
>         // feed PHI nodes in successor blocks.
>         if (isa<TerminatorInst>(BI))
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list