[cfe-commits] r83185 - /cfe/trunk/lib/CodeGen/CGBlocks.cpp

Devang Patel devang.patel at gmail.com
Thu Oct 1 09:41:11 PDT 2009


Mike,

On Wed, Sep 30, 2009 at 5:27 PM, Mike Stump <mrs at apple.com> wrote:
> Author: mrs
> Date: Wed Sep 30 19:27:30 2009
> New Revision: 83185
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83185&view=rev
> Log:
> A couple of refinements for laying out debug information for
> BlockDeclRefDecls.
>
> Modified:
>    cfe/trunk/lib/CodeGen/CGBlocks.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=83185&r1=83184&r2=83185&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Sep 30 19:27:30 2009
> @@ -665,21 +665,20 @@
>
>   // Save a spot to insert the debug information for all the BlockDeclRefDecls.
>   llvm::BasicBlock *entry = Builder.GetInsertBlock();
> -  llvm::BasicBlock::iterator entry_ptr = Builder.GetInsertPoint();
>
>   CurFuncDecl = OuterFuncDecl;
>   CurCodeDecl = BD;
> +  // FIXME: Can we straighten this out not using multiple basic blocks?
> +  // Set body aside for now.
> +  llvm::BasicBlock *body = createBasicBlock("body");
> +  Builder.SetInsertPoint(body);


Please check llvm IR and make sure "body" has at least one
predecessor. Otherwise, the basic block will be dropped silently.
-
Devang

>   EmitStmt(BExpr->getBody());
> -
> +  // Remember where we were...
> +  llvm::BasicBlock *resume = Builder.GetInsertBlock();
> +  // Go back to the entry.
> +  Builder.SetInsertPoint(entry);
>   if (CGDebugInfo *DI = getDebugInfo()) {
> -    llvm::BasicBlock *end = Builder.GetInsertBlock();
> -    llvm::BasicBlock::iterator end_ptr = Builder.GetInsertPoint();
> -
>     // Emit debug information for all the BlockDeclRefDecls.
> -    // First, go back to the entry...
> -    Builder.SetInsertPoint(entry, entry_ptr);
> -
> -    // And then insert the debug information..
>     for (unsigned i=0; i < BlockDeclRefDecls.size(); ++i) {
>       const Expr *E = BlockDeclRefDecls[i];
>       const BlockDeclRefExpr *BDRE = dyn_cast<BlockDeclRefExpr>(E);
> @@ -691,10 +690,14 @@
>                                               Builder, this);
>       }
>     }
> -
> -    // Then go back to the end, and we're done.
> -    Builder.SetInsertPoint(end, end_ptr);
>   }
> +  // And now go back to the body
> +  EmitBlock(body);
> +  // And resume where we left off.
> +  if (resume == 0)
> +    Builder.ClearInsertionPoint();
> +  else
> +    Builder.SetInsertPoint(resume);
>
>   FinishFunction(cast<CompoundStmt>(BExpr->getBody())->getRBracLoc());
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
-
Devang




More information about the cfe-commits mailing list