[cfe-commits] r71824 - /cfe/trunk/lib/CodeGen/CGDecl.cpp
Mike Stump
mrs at apple.com
Thu May 14 17:29:57 PDT 2009
Author: mrs
Date: Thu May 14 19:29:54 2009
New Revision: 71824
URL: http://llvm.org/viewvc/llvm-project?rev=71824&view=rev
Log:
Fixup debug information for the location information for __block
variables. For this to work, the backend needs to handle more complex
forms for locations.
A typical utterance would be:
%forwarding = getelementptr %0* %use_by_ref, i32 0, i32 1 ; <i8**> [#uses=1]
%0 = load i8** %forwarding ; <i8*> [#uses=1]
%1 = bitcast i8* %0 to %0* ; <%0*> [#uses=1]
%x = getelementptr %0* %1, i32 0, i32 4 ; <i32*> [#uses=1]
%2 = bitcast i32* %x to { }* ; <{ }*> [#uses=1]
call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))
Presently when selection finds something it doesn't understand, it
just avoids generating any information, which is safe, just
incomplete. Radar 6867696
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=71824&r1=71823&r2=71824&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu May 14 19:29:54 2009
@@ -315,8 +315,10 @@
if (isByRef) {
llvm::Value *Loc;
bool needsCopyDispose = BlockRequiresCopying(Ty);
- // FIXME: I think we need to indirect through the forwarding pointer first
- Loc = Builder.CreateStructGEP(DeclPtr, needsCopyDispose*2+4, "x");
+ Loc = Builder.CreateStructGEP(DeclPtr, 1, "forwarding");
+ Loc = Builder.CreateLoad(Loc, false);
+ Loc = Builder.CreateBitCast(Loc, DeclPtr->getType());
+ Loc = Builder.CreateStructGEP(Loc, needsCopyDispose*2+4, "x");
DI->EmitDeclareOfAutoVariable(&D, Loc, Builder);
} else
DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
More information about the cfe-commits
mailing list