Deleted Added
full compact
CGBlocks.h (207619) CGBlocks.h (208600)
1//===-- CGBlocks.h - state for LLVM CodeGen for blocks ----------*- C++ -*-===//
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//===----------------------------------------------------------------------===//

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

143 variable */
144 BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
145 helpers */
146 BLOCK_BYREF_CALLER = 128, /* called from __block (byref) copy/dispose
147 support routines */
148 BLOCK_BYREF_CURRENT_MAX = 256
149 };
150
1//===-- CGBlocks.h - state for LLVM CodeGen for blocks ----------*- C++ -*-===//
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//===----------------------------------------------------------------------===//

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

143 variable */
144 BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
145 helpers */
146 BLOCK_BYREF_CALLER = 128, /* called from __block (byref) copy/dispose
147 support routines */
148 BLOCK_BYREF_CURRENT_MAX = 256
149 };
150
151 /// BlockInfo - Information to generate a block literal.
152 struct BlockInfo {
153 /// BlockLiteralTy - The type of the block literal.
154 const llvm::Type *BlockLiteralTy;
155
156 /// Name - the name of the function this block was created for, if any.
157 const char *Name;
158
159 /// ByCopyDeclRefs - Variables from parent scopes that have been imported
160 /// into this block.
161 llvm::SmallVector<const BlockDeclRefExpr *, 8> DeclRefs;
162
163 BlockInfo(const llvm::Type *blt, const char *n)
164 : BlockLiteralTy(blt), Name(n) {
165 // Skip asm prefix, if any.
166 if (Name && Name[0] == '\01')
167 ++Name;
168 }
169 };
170
171 CGBuilderTy &Builder;
172
173 BlockFunction(CodeGenModule &cgm, CodeGenFunction &cgf, CGBuilderTy &B);
174
175 /// BlockOffset - The offset in bytes for the next allocation of an
176 /// imported block variable.
177 CharUnits BlockOffset;
178 /// BlockAlign - Maximal alignment needed for the Block expressed in
179 /// characters.
180 CharUnits BlockAlign;
181
151 CGBuilderTy &Builder;
152
153 BlockFunction(CodeGenModule &cgm, CodeGenFunction &cgf, CGBuilderTy &B);
154
155 /// BlockOffset - The offset in bytes for the next allocation of an
156 /// imported block variable.
157 CharUnits BlockOffset;
158 /// BlockAlign - Maximal alignment needed for the Block expressed in
159 /// characters.
160 CharUnits BlockAlign;
161
182 /// getBlockOffset - Allocate an offset for the ValueDecl from a
183 /// BlockDeclRefExpr in a block literal (BlockExpr).
184 CharUnits getBlockOffset(const BlockDeclRefExpr *E);
162 /// getBlockOffset - Allocate a location within the block's storage
163 /// for a value with the given size and alignment requirements.
164 CharUnits getBlockOffset(CharUnits Size, CharUnits Align);
185
186 /// BlockHasCopyDispose - True iff the block uses copy/dispose.
187 bool BlockHasCopyDispose;
188
165
166 /// BlockHasCopyDispose - True iff the block uses copy/dispose.
167 bool BlockHasCopyDispose;
168
189 /// BlockDeclRefDecls - Decls from BlockDeclRefExprs in apperance order
190 /// in a block literal. Decls without names are used for padding.
191 llvm::SmallVector<const Expr *, 8> BlockDeclRefDecls;
169 /// BlockLayout - The layout of the block's storage, represented as
170 /// a sequence of expressions which require such storage. The
171 /// expressions can be:
172 /// - a BlockDeclRefExpr, indicating that the given declaration
173 /// from an enclosing scope is needed by the block;
174 /// - a DeclRefExpr, which always wraps an anonymous VarDecl with
175 /// array type, used to insert padding into the block; or
176 /// - a CXXThisExpr, indicating that the C++ 'this' value should
177 /// propagate from the parent to the block.
178 /// This is a really silly representation.
179 llvm::SmallVector<const Expr *, 8> BlockLayout;
192
193 /// BlockDecls - Offsets for all Decls in BlockDeclRefExprs.
180
181 /// BlockDecls - Offsets for all Decls in BlockDeclRefExprs.
194 std::map<const Decl*, CharUnits> BlockDecls;
182 llvm::DenseMap<const Decl*, CharUnits> BlockDecls;
195
183
184 /// BlockCXXThisOffset - The offset of the C++ 'this' value within
185 /// the block structure.
186 CharUnits BlockCXXThisOffset;
187
196 ImplicitParamDecl *BlockStructDecl;
197 ImplicitParamDecl *getBlockStructDecl() { return BlockStructDecl; }
198
199 llvm::Constant *GenerateCopyHelperFunction(bool, const llvm::StructType *,
200 std::vector<HelperInfo> *);
201 llvm::Constant *GenerateDestroyHelperFunction(bool, const llvm::StructType *,
202 std::vector<HelperInfo> *);
203

--- 25 unchanged lines hidden ---
188 ImplicitParamDecl *BlockStructDecl;
189 ImplicitParamDecl *getBlockStructDecl() { return BlockStructDecl; }
190
191 llvm::Constant *GenerateCopyHelperFunction(bool, const llvm::StructType *,
192 std::vector<HelperInfo> *);
193 llvm::Constant *GenerateDestroyHelperFunction(bool, const llvm::StructType *,
194 std::vector<HelperInfo> *);
195

--- 25 unchanged lines hidden ---