aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2009-03-04 03:23:46 +0000
committerMike Stump <mrs@apple.com>2009-03-04 03:23:46 +0000
commitdab514fc30242c7afd6c03956e46136c400fb0d3 (patch)
tree4e0b95fba8f049e941f13a488596abf18a08d77a /lib/CodeGen/CodeGenFunction.h
parent41168eac256fed59ec5406a75fce91c59cd5dd91 (diff)
Improved ABI compliance for __block variables. No testcases yet as we
still give an unsupported error for them due to the fact this is a work in progress. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r--lib/CodeGen/CodeGenFunction.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index bf9c4e5ba5..f2b7ed4795 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -264,6 +264,30 @@ public:
// Block Bits
//===--------------------------------------------------------------------===//
+ enum {
+ BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)),
+ block, ... */
+ BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
+ BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the __block
+ variable */
+ BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy
+ helpers */
+ BLOCK_BYREF_CALLER = 128 /* called from __block (byref) copy/dispose
+ support routines */
+ };
+
+ enum {
+ BLOCK_NEEDS_FREE = (1 << 24),
+ BLOCK_HAS_COPY_DISPOSE = (1 << 25),
+ BLOCK_HAS_CXX_OBJ = (1 << 26),
+ BLOCK_IS_GC = (1 << 27),
+ BLOCK_IS_GLOBAL = (1 << 28),
+ BLOCK_HAS_DESCRIPTOR = (1 << 29)
+ };
+
+ llvm::Value *BuildCopyHelper(int flag);
+ llvm::Value *BuildDestroyHelper(int flag);
+
llvm::Value *BuildBlockLiteralTmp(const BlockExpr *);
llvm::Constant *BuildDescriptorBlockDecl(uint64_t Size);
@@ -319,6 +343,15 @@ public:
llvm::Value *GetAddrOfBlockDecl(const BlockDeclRefExpr *E);
+ const llvm::Type *BuildByRefType(QualType Ty, uint64_t Align);
+ bool BlockRequiresCopying(QualType Ty) {
+ if (Ty->isBlockPointerType())
+ return true;
+ if (getContext().isObjCNSObjectType(Ty))
+ return true;
+ return false;
+ }
+
void GenerateCode(const FunctionDecl *FD,
llvm::Function *Fn);
void StartFunction(const Decl *D, QualType RetTy,