Deleted Added
full compact
CGBlocks.cpp (199482) CGBlocks.cpp (199990)
1//===--- CGBlocks.cpp - Emit LLVM Code for declarations -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 277 unchanged lines hidden (view full) ---

286
287 if (LocalDeclMap[VD]) {
288 if (BDRE->isByRef()) {
289 NoteForHelper[helpersize].flag = BLOCK_FIELD_IS_BYREF |
290 // FIXME: Someone double check this.
291 (VD->getType().isObjCGCWeak() ? BLOCK_FIELD_IS_WEAK : 0);
292 llvm::Value *Loc = LocalDeclMap[VD];
293 Loc = Builder.CreateStructGEP(Loc, 1, "forwarding");
1//===--- CGBlocks.cpp - Emit LLVM Code for declarations -------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//

--- 277 unchanged lines hidden (view full) ---

286
287 if (LocalDeclMap[VD]) {
288 if (BDRE->isByRef()) {
289 NoteForHelper[helpersize].flag = BLOCK_FIELD_IS_BYREF |
290 // FIXME: Someone double check this.
291 (VD->getType().isObjCGCWeak() ? BLOCK_FIELD_IS_WEAK : 0);
292 llvm::Value *Loc = LocalDeclMap[VD];
293 Loc = Builder.CreateStructGEP(Loc, 1, "forwarding");
294 Loc = Builder.CreateLoad(Loc, false);
294 Loc = Builder.CreateLoad(Loc);
295 Builder.CreateStore(Loc, Addr);
296 ++helpersize;
297 continue;
298 } else
299 E = new (getContext()) DeclRefExpr (cast<NamedDecl>(VD),
295 Builder.CreateStore(Loc, Addr);
296 ++helpersize;
297 continue;
298 } else
299 E = new (getContext()) DeclRefExpr (cast<NamedDecl>(VD),
300 VD->getType(), SourceLocation(),
301 false, false);
300 VD->getType(),
301 SourceLocation());
302 }
303 if (BDRE->isByRef()) {
304 NoteForHelper[helpersize].flag = BLOCK_FIELD_IS_BYREF |
305 // FIXME: Someone double check this.
306 (VD->getType().isObjCGCWeak() ? BLOCK_FIELD_IS_WEAK : 0);
307 E = new (getContext())
308 UnaryOperator(E, UnaryOperator::AddrOf,
309 getContext().getPointerType(E->getType()),

--- 16 unchanged lines hidden (view full) ---

326 llvm::Value *BlockLiteral = LoadBlockStruct();
327
328 Loc = Builder.CreateGEP(BlockLiteral,
329 llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
330 offset),
331 "block.literal");
332 Ty = llvm::PointerType::get(Ty, 0);
333 Loc = Builder.CreateBitCast(Loc, Ty);
302 }
303 if (BDRE->isByRef()) {
304 NoteForHelper[helpersize].flag = BLOCK_FIELD_IS_BYREF |
305 // FIXME: Someone double check this.
306 (VD->getType().isObjCGCWeak() ? BLOCK_FIELD_IS_WEAK : 0);
307 E = new (getContext())
308 UnaryOperator(E, UnaryOperator::AddrOf,
309 getContext().getPointerType(E->getType()),

--- 16 unchanged lines hidden (view full) ---

326 llvm::Value *BlockLiteral = LoadBlockStruct();
327
328 Loc = Builder.CreateGEP(BlockLiteral,
329 llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
330 offset),
331 "block.literal");
332 Ty = llvm::PointerType::get(Ty, 0);
333 Loc = Builder.CreateBitCast(Loc, Ty);
334 Loc = Builder.CreateLoad(Loc, false);
334 Loc = Builder.CreateLoad(Loc);
335 // Loc = Builder.CreateBitCast(Loc, Ty);
336 }
337 Builder.CreateStore(Loc, Addr);
338 } else if (r.isComplex())
339 // FIXME: implement
340 ErrorUnsupported(BE, "complex in block literal");
341 else if (r.isAggregate())
342 ; // Already created into the destination

--- 146 unchanged lines hidden (view full) ---

489
490 QualType FnType = BPT->getPointeeType();
491
492 // And the rest of the arguments.
493 EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(),
494 E->arg_begin(), E->arg_end());
495
496 // Load the function.
335 // Loc = Builder.CreateBitCast(Loc, Ty);
336 }
337 Builder.CreateStore(Loc, Addr);
338 } else if (r.isComplex())
339 // FIXME: implement
340 ErrorUnsupported(BE, "complex in block literal");
341 else if (r.isAggregate())
342 ; // Already created into the destination

--- 146 unchanged lines hidden (view full) ---

489
490 QualType FnType = BPT->getPointeeType();
491
492 // And the rest of the arguments.
493 EmitCallArgs(Args, FnType->getAs<FunctionProtoType>(),
494 E->arg_begin(), E->arg_end());
495
496 // Load the function.
497 llvm::Value *Func = Builder.CreateLoad(FuncPtr, false, "tmp");
497 llvm::Value *Func = Builder.CreateLoad(FuncPtr, "tmp");
498
499 QualType ResultType = FnType->getAs<FunctionType>()->getResultType();
500
501 const CGFunctionInfo &FnInfo =
502 CGM.getTypes().getFunctionInfo(ResultType, Args);
503
504 // Cast the function pointer to the right type.
505 const llvm::Type *BlockFTy =

--- 40 unchanged lines hidden (view full) ---

546 const llvm::Type *PtrStructTy
547 = llvm::PointerType::get(BuildByRefType(VD), 0);
548 // The block literal will need a copy/destroy helper.
549 BlockHasCopyDispose = true;
550
551 const llvm::Type *Ty = PtrStructTy;
552 Ty = llvm::PointerType::get(Ty, 0);
553 V = Builder.CreateBitCast(V, Ty);
498
499 QualType ResultType = FnType->getAs<FunctionType>()->getResultType();
500
501 const CGFunctionInfo &FnInfo =
502 CGM.getTypes().getFunctionInfo(ResultType, Args);
503
504 // Cast the function pointer to the right type.
505 const llvm::Type *BlockFTy =

--- 40 unchanged lines hidden (view full) ---

546 const llvm::Type *PtrStructTy
547 = llvm::PointerType::get(BuildByRefType(VD), 0);
548 // The block literal will need a copy/destroy helper.
549 BlockHasCopyDispose = true;
550
551 const llvm::Type *Ty = PtrStructTy;
552 Ty = llvm::PointerType::get(Ty, 0);
553 V = Builder.CreateBitCast(V, Ty);
554 V = Builder.CreateLoad(V, false);
554 V = Builder.CreateLoad(V);
555 V = Builder.CreateStructGEP(V, 1, "forwarding");
555 V = Builder.CreateStructGEP(V, 1, "forwarding");
556 V = Builder.CreateLoad(V, false);
556 V = Builder.CreateLoad(V);
557 V = Builder.CreateBitCast(V, PtrStructTy);
558 V = Builder.CreateStructGEP(V, getByRefValueLLVMField(VD),
559 VD->getNameAsString());
560 } else {
561 const llvm::Type *Ty = CGM.getTypes().ConvertType(VD->getType());
562
563 Ty = llvm::PointerType::get(Ty, 0);
564 V = Builder.CreateBitCast(V, Ty);

--- 266 unchanged lines hidden (view full) ---

831 llvm::ArrayType::get(llvm::Type::getInt8Ty(VMContext), Pad);
832 QualType PadTy = getContext().getConstantArrayType(getContext().CharTy,
833 llvm::APInt(32, Pad),
834 ArrayType::Normal, 0);
835 ValueDecl *PadDecl = VarDecl::Create(getContext(), 0, SourceLocation(),
836 0, QualType(PadTy), 0, VarDecl::None);
837 Expr *E;
838 E = new (getContext()) DeclRefExpr(PadDecl, PadDecl->getType(),
557 V = Builder.CreateBitCast(V, PtrStructTy);
558 V = Builder.CreateStructGEP(V, getByRefValueLLVMField(VD),
559 VD->getNameAsString());
560 } else {
561 const llvm::Type *Ty = CGM.getTypes().ConvertType(VD->getType());
562
563 Ty = llvm::PointerType::get(Ty, 0);
564 V = Builder.CreateBitCast(V, Ty);

--- 266 unchanged lines hidden (view full) ---

831 llvm::ArrayType::get(llvm::Type::getInt8Ty(VMContext), Pad);
832 QualType PadTy = getContext().getConstantArrayType(getContext().CharTy,
833 llvm::APInt(32, Pad),
834 ArrayType::Normal, 0);
835 ValueDecl *PadDecl = VarDecl::Create(getContext(), 0, SourceLocation(),
836 0, QualType(PadTy), 0, VarDecl::None);
837 Expr *E;
838 E = new (getContext()) DeclRefExpr(PadDecl, PadDecl->getType(),
839 SourceLocation(), false, false);
839 SourceLocation());
840 BlockDeclRefDecls.push_back(E);
841 }
842 BlockDeclRefDecls.push_back(BDRE);
843
844 BlockOffset += Size;
845 return BlockOffset-Size;
846}
847

--- 370 unchanged lines hidden ---
840 BlockDeclRefDecls.push_back(E);
841 }
842 BlockDeclRefDecls.push_back(BDRE);
843
844 BlockOffset += Size;
845 return BlockOffset-Size;
846}
847

--- 370 unchanged lines hidden ---