[llvm-branch-commits] [llvm-gcc-branch] r81136 - in /llvm-gcc-4.2/branches/Apple/L2/gcc: ChangeLog.apple llvm-debug.cpp llvm-debug.h tree.c tree.h

Devang Patel dpatel at apple.com
Sun Sep 6 14:39:09 PDT 2009


Author: dpatel
Date: Sun Sep  6 16:39:09 2009
New Revision: 81136

URL: http://llvm.org/viewvc/llvm-project?rev=81136&view=rev
Log:
Revert following patches from L2.
80635
80626
80694
80407
80308
80296
80281
80108
80074
80062
79978


Modified:
    llvm-gcc-4.2/branches/Apple/L2/gcc/ChangeLog.apple
    llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.cpp
    llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.h
    llvm-gcc-4.2/branches/Apple/L2/gcc/tree.c
    llvm-gcc-4.2/branches/Apple/L2/gcc/tree.h

Modified: llvm-gcc-4.2/branches/Apple/L2/gcc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/L2/gcc/ChangeLog.apple?rev=81136&r1=81135&r2=81136&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/L2/gcc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/branches/Apple/L2/gcc/ChangeLog.apple Sun Sep  6 16:39:09 2009
@@ -1,9 +1,3 @@
-2009-08-31  Caroline Tice  <ctice at apple.com>
-
-	Radar 6419781
-	* tree.c (type_is_block_byref_struct):  New function.
-	* tree.h (type_is_block_byref_struct):  New extern function decl.
-
 2009-07-31  Bob Wilson  <bob.wilson at apple.com>
 	
 	Radar 7105099

Modified: llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.cpp?rev=81136&r1=81135&r2=81136&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.cpp Sun Sep  6 16:39:09 2009
@@ -272,7 +272,7 @@
   llvm::DIDescriptor D;
   if (!RegionStack.empty())
     D = RegionStack.back();
-  D = DebugFactory.CreateLexicalBlock(D);
+  D = DebugFactory.CreateBlock(D);
   RegionStack.push_back(D);
   DebugFactory.InsertRegionStart(D, CurBB);
 }
@@ -401,7 +401,6 @@
     break;
   }
   }
-
   return 
     DebugFactory.CreateBasicType(getOrCreateCompileUnit(main_input_filename),
                                  TypeName, 
@@ -445,20 +444,14 @@
                   TREE_CODE(type) == BLOCK_POINTER_TYPE) ?
     DW_TAG_pointer_type :
     DW_TAG_reference_type;
-  unsigned Flags = 0;
-  if (type_is_block_byref_struct(type))
-    Flags |= llvm::DIType::FlagBlockByrefStruct;
   expanded_location Loc = GetNodeLocation(type);
-
-  std::string PName;
-  FromTy.getName(PName);
-  return  DebugFactory.CreateDerivedType(Tag, findRegion(type), PName,
+  return  DebugFactory.CreateDerivedType(Tag, findRegion(type), "", 
                                          getOrCreateCompileUnit(NULL), 
                                          0 /*line no*/, 
                                          NodeSizeInBits(type),
                                          NodeAlignInBits(type),
                                          0 /*offset */, 
-                                         Flags, 
+                                         0 /* flags */, 
                                          FromTy);
 }
 
@@ -583,26 +576,13 @@
   // recursive) and replace all  uses of the forward declaration with the 
   // final definition. 
   expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false);
-  // FIXME: findRegion() is not able to find context all the time. This
-  // means when type names in different context match then FwdDecl is
-  // reused because MDNodes are uniqued. To avoid this, use type context
-  /// also while creating FwdDecl for now.
-  std::string FwdName;
-  if (TYPE_CONTEXT(type))
-    FwdName = GetNodeName(TYPE_CONTEXT(type));
-  FwdName = FwdName + GetNodeName(type);
-  unsigned Flags = llvm::DIType::FlagFwdDecl;
-  if (TYPE_BLOCK_IMPL_STRUCT(type))
-    Flags |= llvm::DIType::FlagAppleBlock;
-  if (type_is_block_byref_struct(type))
-    Flags |= llvm::DIType::FlagBlockByrefStruct;
   llvm::DICompositeType FwdDecl =
     DebugFactory.CreateCompositeType(Tag, 
                                      findRegion(type),
-                                     FwdName,
+                                     GetNodeName(type),
                                      getOrCreateCompileUnit(Loc.file), 
                                      Loc.line, 
-                                     0, 0, 0, Flags,
+                                     0, 0, 0, llvm::DIType::FlagFwdDecl,
                                      llvm::DIType(), llvm::DIArray(),
                                      RunTimeLang);
   
@@ -611,7 +591,7 @@
     return FwdDecl;
   
   // Insert into the TypeCache so that recursive uses will find it.
-  TypeCache[type] =  FwdDecl.getNode();
+  TypeCache[type] =  FwdDecl;
   
   // Convert all the elements.
   llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
@@ -622,6 +602,7 @@
       tree BInfoType = BINFO_TYPE (BInfo);
       DIType BaseClass = getOrCreateType(BInfoType);
       
+      expanded_location loc = GetNodeLocation(type);
       // FIXME : name, size, align etc...
       DIType DTy = 
         DebugFactory.CreateDerivedType(DW_TAG_inheritance, 
@@ -701,14 +682,14 @@
   
   llvm::DIArray Elements =
     DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size());
-
+  
   llvm::DICompositeType RealDecl =
     DebugFactory.CreateCompositeType(Tag, findRegion(type),
                                      GetNodeName(type),
                                      getOrCreateCompileUnit(Loc.file),
                                      Loc.line, 
                                      NodeSizeInBits(type), NodeAlignInBits(type),
-                                     0, Flags, llvm::DIType(), Elements,
+                                     0, 0, llvm::DIType(), Elements,
                                      RunTimeLang);
   
   // Now that we have a real decl for the struct, replace anything using the
@@ -721,14 +702,11 @@
 DIType DebugInfo::createVariantType(tree type, DIType MainTy) {
   
   DIType Ty;
-  if (tree TyDef = TYPE_NAME(type)) {
-      std::map<tree_node *, MDNode *>::iterator I = TypeCache.find(TyDef);
-      if (I != TypeCache.end())
-        return DIType(I->second);
-    if (TREE_CODE(TyDef) == TYPE_DECL &&  DECL_ORIGINAL_TYPE(TyDef)) {
-      expanded_location TypeDefLoc = GetNodeLocation(TyDef);
-      Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(TyDef),
-                                          GetNodeName(TyDef), 
+  if (tree Name = TYPE_NAME(type)) {
+    if (TREE_CODE(Name) == TYPE_DECL &&  DECL_ORIGINAL_TYPE(Name)) {
+      expanded_location TypeDefLoc = GetNodeLocation(Name);
+      Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(type),
+                                          GetNodeName(Name), 
                                           getOrCreateCompileUnit(TypeDefLoc.file),
                                           TypeDefLoc.line,
                                           0 /*size*/,
@@ -736,7 +714,8 @@
                                           0 /*offset */, 
                                           0 /*flags*/, 
                                           MainTy);
-      TypeCache[TyDef] = Ty.getNode();
+      // Set the slot early to prevent recursion difficulties.
+      TypeCache[type] = Ty;
       return Ty;
     }
   }
@@ -766,7 +745,7 @@
                                          MainTy);
   
   if (TYPE_VOLATILE(type) || TYPE_READONLY(type)) {
-    TypeCache[type] = Ty.getNode();
+    TypeCache[type] = Ty;
     return Ty;
   }
 
@@ -786,13 +765,17 @@
   if (TREE_CODE(type) == VOID_TYPE) return DIType();
   
   // Check to see if the compile unit already has created this type.
-  std::map<tree_node *, MDNode *>::iterator I = TypeCache.find(type);
-  if (I != TypeCache.end())
-    return DIType(I->second);
-
+  DIType &Slot = TypeCache[type];
+  if (!Slot.isNull())
+    return Slot;
+  
   DIType MainTy;
-  if (type != TYPE_MAIN_VARIANT(type) && TYPE_MAIN_VARIANT(type))
-    MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type));
+  if (type != TYPE_MAIN_VARIANT(type)) {
+    if (TYPE_NEXT_VARIANT(type) && type != TYPE_NEXT_VARIANT(type))
+      MainTy = getOrCreateType(TYPE_NEXT_VARIANT(type));
+    else if (TYPE_MAIN_VARIANT(type))
+      MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type));
+  }
 
   DIType Ty = createVariantType(type, MainTy);
   if (!Ty.isNull())
@@ -810,17 +793,10 @@
     
     case POINTER_TYPE:
     case REFERENCE_TYPE:
+    case BLOCK_POINTER_TYPE:
       Ty = createPointerType(type);
       break;
-
-    case BLOCK_POINTER_TYPE: {
-      DEBUGASSERT (generic_block_literal_struct_type && 
-                   "Generic struct type for Blocks is missing!");
-      tree tmp_type = build_pointer_type(generic_block_literal_struct_type);
-      Ty = createPointerType(tmp_type);
-      break;
-    }
-
+    
     case OFFSET_TYPE: {
       // gen_type_die(TYPE_OFFSET_BASETYPE(type), context_die);
       // gen_type_die(TREE_TYPE(type), context_die);
@@ -855,7 +831,7 @@
       Ty = createBasicType(type);
       break;
   }
-  TypeCache[type] = Ty.getNode();
+  TypeCache[type] = Ty;
   return Ty;
 }
 
@@ -881,7 +857,7 @@
                                                 bool isMain) {
   if (!FullPath)
     FullPath = main_input_filename;
-  MDNode *&CU = CUCache[FullPath];
+  GlobalVariable *&CU = CUCache[FullPath];
   if (CU)
     return DICompileUnit(CU);
 
@@ -929,7 +905,7 @@
                                                         version_string, isMain,
                                                         optimize, Flags,
                                                         ObjcRunTimeVer);
-  CU = NewCU.getNode();
+  CU = NewCU.getGV();
   return NewCU;
 }
 

Modified: llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.h?rev=81136&r1=81135&r2=81136&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/branches/Apple/L2/gcc/llvm-debug.h Sun Sep  6 16:39:09 2009
@@ -59,8 +59,8 @@
   const char *PrevFullPath;             // Previous location file encountered.
   int PrevLineNo;                       // Previous location line# encountered.
   BasicBlock *PrevBB;                   // Last basic block encountered.
-  std::map<std::string, MDNode *> CUCache;
-  std::map<tree_node *, MDNode *> TypeCache;
+  std::map<std::string, GlobalVariable *> CUCache;
+  std::map<tree_node *, DIType> TypeCache;
                                         // Cache of previously constructed 
                                         // Types.
   std::vector<DIDescriptor> RegionStack;

Modified: llvm-gcc-4.2/branches/Apple/L2/gcc/tree.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/L2/gcc/tree.c?rev=81136&r1=81135&r2=81136&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/L2/gcc/tree.c (original)
+++ llvm-gcc-4.2/branches/Apple/L2/gcc/tree.c Sun Sep  6 16:39:09 2009
@@ -7975,35 +7975,4 @@
 }
 /* APPLE LOCAL end weak_import on property 6676828 */
 
-/* LLVM LOCAL begin radar 6419781 */
-bool
-type_is_block_byref_struct (tree type)
-{
-  if (!type)
-    return false;
-
-  if (TREE_CODE (type) == POINTER_TYPE)
-    type = TREE_TYPE (type);
-
-  if (!type 
-      || ! TYPE_NAME (type)
-      || ! (TREE_CODE (type) == RECORD_TYPE))
-    return false;
-
-  if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE
-      && strncmp (IDENTIFIER_POINTER (TYPE_NAME (type)),
-                  "__Block_byref_", 14) == 0)
-    return true;
-  else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
-           && DECL_NAME (TYPE_NAME (type))
-           && IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))
-           && (strncmp 
-               (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
-                "__Block_byref_", 14) == 0))
-    return true;
-  else
-    return false;
-}
-/* LLVM LOCAL begin end 6419781 */
-
 #include "gt-tree.h"

Modified: llvm-gcc-4.2/branches/Apple/L2/gcc/tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/L2/gcc/tree.h?rev=81136&r1=81135&r2=81136&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/L2/gcc/tree.h (original)
+++ llvm-gcc-4.2/branches/Apple/L2/gcc/tree.h Sun Sep  6 16:39:09 2009
@@ -4892,8 +4892,4 @@
 
 /* APPLE LOCAL end radar 6300081  */
 
-/* LLVM LOCAL begin radar 6419781 */
-extern bool type_is_block_byref_struct (tree);
-/* LLVM LOCAL end radar 6419781 */
-
 #endif  /* GCC_TREE_H  */





More information about the llvm-branch-commits mailing list