diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-03-05 22:39:55 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-03-05 22:39:55 +0000 |
commit | d61a50a84d87a317cf929c6c1babf27d404b1e29 (patch) | |
tree | 24db658d8a3df1e07c5d862dfbfb216a71c9a8c7 /lib/CodeGen | |
parent | bf0a4dd2252408281cf9179c566af928699aab43 (diff) |
More function stop for objc2's ivar layout bit map.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 6b2f4b01e5..4d957ebd65 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -395,6 +395,17 @@ protected: /// name. The return value has type char *. llvm::Constant *GetClassName(IdentifierInfo *Ident); + /// BuildIvarLayout - Builds ivar layout bitmap for the class + /// implementation for the __strong or __weak case. + /// + llvm::Constant *BuildIvarLayout(ObjCImplementationDecl *OI, + bool ForStrongLayout); + + void BuildAggrIvarLayout(RecordDecl *RD, + const std::vector<FieldDecl*>& RecFields, + unsigned int BytePos, bool ForStrongLayout, + int &Index, int &SkIndex, bool &HasUnion); + /// GetIvarLayoutName - Returns a unique constant for the given /// ivar layout bitmap. llvm::Constant *GetIvarLayoutName(IdentifierInfo *Ident, @@ -2449,6 +2460,45 @@ llvm::Constant *CGObjCCommonMac::GetIvarLayoutName(IdentifierInfo *Ident, return llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy); } +void CGObjCCommonMac::BuildAggrIvarLayout(RecordDecl *RD, + const std::vector<FieldDecl*>& RecFields, + unsigned int BytePos, bool ForStrongLayout, + int &Index, int &SkIndex, bool &HasUnion) { + return; +} + +/// BuildIvarLayout - Builds ivar layout bitmap for the class +/// implementation for the __strong or __weak case. +/// The layout map displays which words in ivar list must be skipped +/// and which must be scanned by GC (see below). String is built of bytes. +/// Each byte is divided up in two nibbles (4-bit each). Left nibble is count +/// of words to skip and right nibble is count of words to scan. So, each +/// nibble represents up to 15 workds to skip or scan. Skipping the rest is +/// represented by a 0x00 byte which also ends the string. +/// 1. when ForStrongLayout is true, following ivars are scanned: +/// - id, Class +/// - object * +/// - __strong anything +/// +/// 2. When ForStrongLayout is false, following ivars are scanned: +/// - __weak anything +/// +llvm::Constant *CGObjCCommonMac::BuildIvarLayout(ObjCImplementationDecl *OMD, + bool ForStrongLayout) { + int iIndex = -1; + int iSkIndex = -1; + bool hasUnion = false; + + std::vector<FieldDecl*> RecFields; + ObjCInterfaceDecl *OI = OMD->getClassInterface(); + CGM.getContext().CollectObjCIvars(OI, RecFields); + if (RecFields.empty()) + return 0; + BuildAggrIvarLayout (0, RecFields, 0, ForStrongLayout, + iIndex, iSkIndex, hasUnion); + return 0; +} + llvm::Constant *CGObjCCommonMac::GetMethodVarName(Selector Sel) { llvm::GlobalVariable *&Entry = MethodVarNames[Sel]; |