[cfe-commits] r62806 - in /cfe/trunk: Driver/clang.cpp include/clang/Basic/LangOptions.h lib/CodeGen/CGObjCMac.cpp lib/CodeGen/CGObjCRuntime.h lib/CodeGen/CodeGenModule.cpp

Fariborz Jahanian fjahanian at apple.com
Thu Jan 22 15:02:59 PST 2009


Author: fjahanian
Date: Thu Jan 22 17:02:58 2009
New Revision: 62806

URL: http://llvm.org/viewvc/llvm-project?rev=62806&view=rev
Log:
Use NonFragileABI as name of new Next abi. More comments 
for the new meta-data.

Modified:
    cfe/trunk/Driver/clang.cpp
    cfe/trunk/include/clang/Basic/LangOptions.h
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/CodeGen/CGObjCRuntime.h
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=62806&r1=62805&r2=62806&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Thu Jan 22 17:02:58 2009
@@ -484,7 +484,7 @@
 EnableBlocks("fblocks", llvm::cl::desc("enable the 'blocks' language feature"));
 
 static llvm::cl::opt<bool>
-ObjCModernABI("fobjc-modern-abi", llvm::cl::desc("enable objective-c's modern abi"));
+ObjCNonFragileABI("fobjc-nonfragile-abi", llvm::cl::desc("enable objective-c's nonfragile abi"));
 
 
 // FIXME: This (and all GCC -f options) really come in -f... and
@@ -618,8 +618,8 @@
   else if (GNURuntime)
     Options.NeXTRuntime = 0;
 
-  if (ObjCModernABI)
-    Options.ObjCModernABI = 1;
+  if (ObjCNonFragileABI)
+    Options.ObjCNonFragileABI = 1;
 }
 
 static llvm::cl::opt<bool>

Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=62806&r1=62805&r2=62806&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Jan 22 17:02:58 2009
@@ -38,7 +38,7 @@
     
   unsigned ObjC1             : 1;  // Objective-C 1 support enabled.
   unsigned ObjC2             : 1;  // Objective-C 2 support enabled.
-  unsigned ObjCModernABI     : 1;  // Objective-C modern abi enabled
+  unsigned ObjCNonFragileABI : 1;  // Objective-C modern abi enabled
     
   unsigned PascalStrings     : 1;  // Allow Pascal strings
   unsigned Boolean           : 1;  // Allow bool/true/false
@@ -63,7 +63,7 @@
     Trigraphs = BCPLComment = DollarIdents = AsmPreprocessor = 0;
     ImplicitInt = Digraphs = 0;
     HexFloats = 0;
-    GC = ObjC1 = ObjC2 = ObjCModernABI = 0;
+    GC = ObjC1 = ObjC2 = ObjCNonFragileABI = 0;
     C99 = Microsoft = CPlusPlus = CPlusPlus0x = NoExtensions = 0;
     CXXOperatorNames = PascalStrings = Boolean = WritableStrings = 0;
     LaxVectorConversions = Exceptions = NeXTRuntime = 0;

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=62806&r1=62805&r2=62806&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Jan 22 17:02:58 2009
@@ -65,6 +65,19 @@
   /// SuperPtrTy - LLVM type for struct objc_super *.
   const llvm::Type *SuperPtrTy;
   
+  /// PropertyTy - LLVM type for struct objc_property (struct _prop_t
+  /// in GCC parlance).
+  const llvm::StructType *PropertyTy;
+  
+  /// PropertyListTy - LLVM type for struct objc_property_list
+  /// (_prop_list_t in GCC parlance).
+  const llvm::StructType *PropertyListTy;
+  /// PropertyListPtrTy - LLVM type for struct objc_property_list*.
+  const llvm::Type *PropertyListPtrTy;
+  
+  // MethodTy - LLVM type for struct objc_method.
+  const llvm::StructType *MethodTy;
+  
   llvm::Function *GetPropertyFn, *SetPropertyFn;
   
   llvm::Function *EnumerationMutationFn;
@@ -124,14 +137,6 @@
   /// MethodDescriptionListPtrTy - LLVM type for struct
   /// objc_method_description_list *.
   const llvm::Type *MethodDescriptionListPtrTy;
-  /// PropertyTy - LLVM type for struct objc_property (struct _prop_t
-  /// in GCC parlance).
-  const llvm::StructType *PropertyTy;
-  /// PropertyListTy - LLVM type for struct objc_property_list
-  /// (_prop_list_t in GCC parlance).
-  const llvm::StructType *PropertyListTy;
-  /// PropertyListPtrTy - LLVM type for struct objc_property_list*.
-  const llvm::Type *PropertyListPtrTy;
   /// ProtocolListTy - LLVM type for struct objc_property_list.
   const llvm::Type *ProtocolListTy;
   /// ProtocolListPtrTy - LLVM type for struct objc_property_list*.
@@ -156,8 +161,6 @@
   const llvm::Type *IvarListTy;
   /// IvarListPtrTy - LLVM type for struct objc_ivar_list *.
   const llvm::Type *IvarListPtrTy;
-  // MethodTy - LLVM type for struct objc_method.
-  const llvm::StructType *MethodTy;
   /// MethodListTy - LLVM type for struct objc_method_list.
   const llvm::Type *MethodListTy;
   /// MethodListPtrTy - LLVM type for struct objc_method_list *.
@@ -208,12 +211,12 @@
   }
 };
 
-/// ObjCModernTypesHelper - will have all types needed by objective-c's
+/// ObjCNonFragileABITypesHelper - will have all types needed by objective-c's
 /// modern abi
-class ObjCModernTypesHelper : public ObjCCommonTypesHelper {
+class ObjCNonFragileABITypesHelper : public ObjCCommonTypesHelper {
 public:
-  ObjCModernTypesHelper(CodeGen::CodeGenModule &cgm);
-  ~ObjCModernTypesHelper(){}
+  ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm);
+  ~ObjCNonFragileABITypesHelper(){}
 };
   
 class CGObjCCommonMac : public CodeGen::CGObjCRuntime {
@@ -492,11 +495,11 @@
                                         llvm::Value *src, llvm::Value *dest);
 };
   
-class CGObjCModernMac : public CGObjCCommonMac {
+class CGObjCNonFragileABIMac : public CGObjCCommonMac {
 private:
-  ObjCModernTypesHelper ObjCTypes;
+  ObjCNonFragileABITypesHelper ObjCTypes;
 public:
-  CGObjCModernMac(CodeGen::CodeGenModule &cgm);
+  CGObjCNonFragileABIMac(CodeGen::CodeGenModule &cgm);
 };
   
 } // end anonymous namespace
@@ -2256,7 +2259,7 @@
   CGM.getModule().appendModuleInlineAsm(s.str());
 }
 
-CGObjCModernMac::CGObjCModernMac(CodeGen::CodeGenModule &cgm) 
+CGObjCNonFragileABIMac::CGObjCNonFragileABIMac(CodeGen::CodeGenModule &cgm) 
   : CGObjCCommonMac(cgm),
   ObjCTypes(cgm)
 {
@@ -2312,6 +2315,41 @@
   SuperTy = cast<llvm::StructType>(Types.ConvertType(SuperCTy));
   SuperPtrTy = llvm::PointerType::getUnqual(SuperTy); 
   
+  // struct _prop_t {
+  //   char *name;
+  //   char *attributes; 
+  // }
+  PropertyTy = llvm::StructType::get(Int8PtrTy,
+                                     Int8PtrTy,
+                                     NULL);
+  CGM.getModule().addTypeName("struct._prop_t", 
+                              PropertyTy);
+  
+  // struct _prop_list_t {
+  //   uint32_t entsize;      // sizeof(struct _objc_property)
+  //   uint32_t count_of_properties;
+  //   struct _objc_property prop_list[count_of_properties];
+  // }
+  PropertyListTy = llvm::StructType::get(IntTy,
+                                         IntTy,
+                                         llvm::ArrayType::get(PropertyTy, 0),
+                                         NULL);
+  CGM.getModule().addTypeName("struct._prop_list_t", 
+                              PropertyListTy);
+  // struct _prop_list_t *
+  PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
+  
+  // struct _objc_method {
+  //   SEL _cmd;
+  //   char *method_type;
+  //   char *_imp;
+  // }
+  MethodTy = llvm::StructType::get(SelectorPtrTy,
+                                   Int8PtrTy,
+                                   Int8PtrTy,
+                                   NULL);
+  CGM.getModule().addTypeName("struct._objc_method", MethodTy);
+    
   // Property manipulation functions.
   
   // id objc_getProperty (id, SEL, ptrdiff_t, bool)
@@ -2413,30 +2451,6 @@
   MethodDescriptionListPtrTy = 
     llvm::PointerType::getUnqual(MethodDescriptionListTy);
 
-  // struct _objc_property {
-  //   char *name;
-  //   char *attributes; 
-  // }
-  PropertyTy = llvm::StructType::get(Int8PtrTy,
-                                     Int8PtrTy,
-                                     NULL);
-  CGM.getModule().addTypeName("struct._objc_property", 
-                              PropertyTy);
-
-  // struct _objc_property_list {
-  //   uint32_t entsize;      // sizeof(struct _objc_property)
-  //   uint32_t count_of_properties;
-  //   struct _objc_property prop_list[count_of_properties];
-  // }
-  PropertyListTy = llvm::StructType::get(IntTy,
-                                         IntTy,
-                                         llvm::ArrayType::get(PropertyTy, 0),
-                                         NULL);
-  CGM.getModule().addTypeName("struct._objc_property_list", 
-                              PropertyListTy);
-  // struct _objc_property_list *
-  PropertyListPtrTy = llvm::PointerType::getUnqual(PropertyListTy);
-
   // Protocol description structures
 
   // struct _objc_protocol_extension {
@@ -2512,17 +2526,6 @@
   CGM.getModule().addTypeName("struct._objc_ivar_list", IvarListTy);
   IvarListPtrTy = llvm::PointerType::getUnqual(IvarListTy);
 
-  // struct _objc_method {
-  //   SEL _cmd;
-  //   char *method_type;
-  //   char *_imp;
-  // }
-  MethodTy = llvm::StructType::get(SelectorPtrTy,
-                                   Int8PtrTy,
-                                   Int8PtrTy,
-                                   NULL);
-  CGM.getModule().addTypeName("struct._objc_method", MethodTy);
-  
   // struct _objc_method_list *
   MethodListTy = llvm::OpaqueType::get();
   CGM.getModule().addTypeName("struct._objc_method_list", MethodListTy);
@@ -2763,9 +2766,68 @@
   
 }
 
-ObjCModernTypesHelper::ObjCModernTypesHelper(CodeGen::CodeGenModule &cgm) 
+ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm) 
 : ObjCCommonTypesHelper(cgm)
 {
+  // struct _method_list_t {
+  //   uint32_t entsize;  // sizeof(struct _objc_method)
+  //   uint32_t method_count;
+  //   struct _objc_method method_list[method_count];
+  // }
+  
+  // struct _protocol_t {
+  //   id isa;  // NULL
+  //   const char * const protocol_name;
+  //   const struct  * _protocol_t const protocol_list;
+  //   const struct method_list_t * const instance_methods;
+  //   const struct method_list_t * const class_methods;
+  //   const struct method_list_t *optionalInstanceMethods;
+  //   const struct method_list_t *optionalClassMethods;
+  //   const struct _prop_list_t * const properties;
+  //   const uint32_t size;  // sizeof(struct _protocol_t)
+  //   const uint32_t flags;  // = 0
+  // }
+  
+  // struct _objc_protocol_list {
+  //   long protocol_count;
+  //   struct _protocol_t[protocol_count];
+  // }
+    
+  // struct _class_t {
+  //   struct _class_t *isa;
+  //   struct _class_t * const superclass;
+  //   void *cache;
+  //   IMP *vtable;
+  //   struct class_ro_t *ro;
+  // }
+  
+  // struct _ivar_t {
+  //   unsigned long int *offset;  // pointer to ivar offset location
+  //   char *name;
+  //   char *type;
+  //   uint32_t alignment;
+  //   uint32_t size;
+  // }
+  
+  // struct _ivar_list_t {
+  //   uint32 entsize;  // sizeof(struct _ivar_t)
+  //   uint32 count;
+  //   struct _iver_t list[count];
+  // }
+  
+  // struct class_ro_t {
+  //   uint32_t const flags;
+  //   uint32_t const instanceStart;
+  //   uint32_t const instanceSize;
+  //   uint32_t const reserved;  // only when building for 64bit targets
+  //   const uint8_t * const ivarLayout;
+  //   const char *const name;
+  //   const struct _method_list_t * const baseMethods;
+  //   const struct _objc_protocol_list *const baseProtocols;
+  //   const struct _ivar_list_t *const ivars;
+  //   const uint8_t * const weakIvarLayout;
+  //   const struct _prop_list_t * const properties;
+  // }
 }
 
 /* *** */
@@ -2776,7 +2838,7 @@
 }
 
 CodeGen::CGObjCRuntime *
-CodeGen::CreateMacModernObjCRuntime(CodeGen::CodeGenModule &CGM) {
+CodeGen::CreateMacNonFragileABIObjCRuntime(CodeGen::CodeGenModule &CGM) {
   return 0;
- // return new CGObjCModernMac(CGM);
+ // return new CGObjCNonFragileABIMac(CGM);
 }

Modified: cfe/trunk/lib/CodeGen/CGObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCRuntime.h?rev=62806&r1=62805&r2=62806&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCRuntime.h (original)
+++ cfe/trunk/lib/CodeGen/CGObjCRuntime.h Thu Jan 22 17:02:58 2009
@@ -161,7 +161,7 @@
 //TODO: This should include some way of selecting which runtime to target.
 CGObjCRuntime *CreateGNUObjCRuntime(CodeGenModule &CGM);
 CGObjCRuntime *CreateMacObjCRuntime(CodeGenModule &CGM);
-CGObjCRuntime *CreateMacModernObjCRuntime(CodeGenModule &CGM);
+CGObjCRuntime *CreateMacNonFragileABIObjCRuntime(CodeGenModule &CGM);
 }
 }
 #endif

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=62806&r1=62805&r2=62806&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jan 22 17:02:58 2009
@@ -39,7 +39,7 @@
 
   if (Features.ObjC1) {
     if (Features.NeXTRuntime) {
-      Runtime = Features.ObjCModernABI ? CreateMacModernObjCRuntime(*this) 
+      Runtime = Features.ObjCNonFragileABI ? CreateMacNonFragileABIObjCRuntime(*this) 
                                        : CreateMacObjCRuntime(*this);
     } else {
       Runtime = CreateGNUObjCRuntime(*this);





More information about the cfe-commits mailing list