summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-02-07 10:33:21 +0000
committerJohn McCall <rjmccall@apple.com>2011-02-07 10:33:21 +0000
commit351762cda239e2bb90fb2084e546878fea90ebf6 (patch)
tree22efeaf25ffe22b569427e2cb8054db1c5ec5172 /clang/lib/CodeGen/CGDecl.cpp
parent867cb633b428b0017ea8ecf548176ae6000fcef2 (diff)
downloadbcm5719-llvm-351762cda239e2bb90fb2084e546878fea90ebf6.tar.gz
bcm5719-llvm-351762cda239e2bb90fb2084e546878fea90ebf6.zip
A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls - BDREs no longer store copy expressions - BlockDecls now store a list of captured variables, information about how they're captured, and a copy expression if necessary With that in hand, change IR generation to use the captures data in blocks instead of walking the block independently. Additionally, optimize block layout by emitting fields in descending alignment order, with a heuristic for filling in words when alignment of the end of the block header is insufficient for the most aligned field. llvm-svn: 125005
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 65ddfa6051b..0f74a3f530a 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -328,7 +328,7 @@ llvm::Value *CodeGenFunction::BuildBlockByrefAddress(llvm::Value *BaseAddr,
/// T x;
/// } x
///
-const llvm::Type *CodeGenFunction::BuildByRefType(const ValueDecl *D) {
+const llvm::Type *CodeGenFunction::BuildByRefType(const VarDecl *D) {
std::pair<const llvm::Type *, unsigned> &Info = ByRefValueInfo[D];
if (Info.first)
return Info.first;
@@ -353,7 +353,7 @@ const llvm::Type *CodeGenFunction::BuildByRefType(const ValueDecl *D) {
// int32_t __size;
Types.push_back(Int32Ty);
- bool HasCopyAndDispose = BlockRequiresCopying(Ty);
+ bool HasCopyAndDispose = getContext().BlockRequiresCopying(Ty);
if (HasCopyAndDispose) {
/// void *__copy_helper;
Types.push_back(Int8PtrTy);
@@ -507,7 +507,7 @@ namespace {
void Emit(CodeGenFunction &CGF, bool IsForEH) {
llvm::Value *V = CGF.Builder.CreateStructGEP(Addr, 1, "forwarding");
V = CGF.Builder.CreateLoad(V);
- CGF.BuildBlockRelease(V);
+ CGF.BuildBlockRelease(V, BlockFunction::BLOCK_FIELD_IS_BYREF);
}
};
}
@@ -788,7 +788,6 @@ void CodeGenFunction::EmitAutoVarDecl(const VarDecl &D,
Builder.CreateStore(V, size_field);
if (flags & BLOCK_HAS_COPY_DISPOSE) {
- SynthesizeCopyDisposeHelpers = true;
llvm::Value *copy_helper = Builder.CreateStructGEP(DeclPtr, 4);
Builder.CreateStore(BuildbyrefCopyHelper(DeclPtr->getType(), flag,
Align.getQuantity(), &D),
OpenPOWER on IntegriCloud