summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBlocks.h
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-08-17 15:46:07 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-08-17 15:46:07 +0000
commit0e6cfa4e8a86bd9f35d69f44aae209918475e44d (patch)
tree50aa9fd719d71c1186b7e3aaa993af0120be12df /lib/CodeGen/CGBlocks.h
parentb8333ea1b79511446166134a1b573e79ad9fa917 (diff)
downloadclang-0e6cfa4e8a86bd9f35d69f44aae209918475e44d.tar.gz
[CodeGen] Merge identical block descriptor global variables.
Currently, clang generates a new block descriptor global variable for each new block literal. This commit merges block descriptors that are identical inside and across translation units using the same approach taken in r339438. To enable merging identical block descriptors, the size and signature of the block and information about the captures are encoded into the name of the block descriptor variable. Also, the block descriptor variable is marked as linkonce_odr and unnamed_addr. rdar://problem/42640703 Differential Revision: https://reviews.llvm.org/D50783 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBlocks.h')
-rw-r--r--lib/CodeGen/CGBlocks.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGBlocks.h b/lib/CodeGen/CGBlocks.h
index 402acea70e..c802948af0 100644
--- a/lib/CodeGen/CGBlocks.h
+++ b/lib/CodeGen/CGBlocks.h
@@ -132,6 +132,9 @@ public:
friend bool operator&(BlockFieldFlags l, BlockFieldFlags r) {
return (l.flags & r.flags);
}
+ bool operator==(BlockFieldFlags Other) const {
+ return flags == Other.flags;
+ }
};
inline BlockFieldFlags operator|(BlockFieldFlag_t l, BlockFieldFlag_t r) {
return BlockFieldFlags(l) | BlockFieldFlags(r);